SkEmptyShader.h revision 59ccef695cef28a74ab2ea13d5a6c9017af45402
137a201231b8f6381938282675eb9abb50ab3b389reed@google.com
2ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com/*
3ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com * Copyright 2011 Google Inc.
4ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com *
5ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com * Use of this source code is governed by a BSD-style license that can be
6ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com * found in the LICENSE file.
737a201231b8f6381938282675eb9abb50ab3b389reed@google.com */
837a201231b8f6381938282675eb9abb50ab3b389reed@google.com
937a201231b8f6381938282675eb9abb50ab3b389reed@google.com
10ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com
1137a201231b8f6381938282675eb9abb50ab3b389reed@google.com#ifndef SkEmptyShader_DEFINED
1237a201231b8f6381938282675eb9abb50ab3b389reed@google.com#define SkEmptyShader_DEFINED
1337a201231b8f6381938282675eb9abb50ab3b389reed@google.com
1437a201231b8f6381938282675eb9abb50ab3b389reed@google.com#include "SkShader.h"
1537a201231b8f6381938282675eb9abb50ab3b389reed@google.com
1637a201231b8f6381938282675eb9abb50ab3b389reed@google.com/**
1737a201231b8f6381938282675eb9abb50ab3b389reed@google.com *  \class SkEmptyShader
1859ccef695cef28a74ab2ea13d5a6c9017af45402reed@google.com *  A Shader that always draws nothing. Its setContext always returns false,
1959ccef695cef28a74ab2ea13d5a6c9017af45402reed@google.com *  so it never expects that its shadeSpan() methods will get called.
2037a201231b8f6381938282675eb9abb50ab3b389reed@google.com */
2137a201231b8f6381938282675eb9abb50ab3b389reed@google.comclass SK_API SkEmptyShader : public SkShader {
2237a201231b8f6381938282675eb9abb50ab3b389reed@google.compublic:
2359ccef695cef28a74ab2ea13d5a6c9017af45402reed@google.com    SkEmptyShader() {}
2437a201231b8f6381938282675eb9abb50ab3b389reed@google.com
2559ccef695cef28a74ab2ea13d5a6c9017af45402reed@google.com    virtual uint32_t getFlags() SK_OVERRIDE;
2659ccef695cef28a74ab2ea13d5a6c9017af45402reed@google.com    virtual uint8_t getSpan16Alpha() const SK_OVERRIDE;
2759ccef695cef28a74ab2ea13d5a6c9017af45402reed@google.com    virtual bool setContext(const SkBitmap&, const SkPaint&,
2859ccef695cef28a74ab2ea13d5a6c9017af45402reed@google.com                            const SkMatrix&) SK_OVERRIDE;
2959ccef695cef28a74ab2ea13d5a6c9017af45402reed@google.com    virtual void shadeSpan(int x, int y, SkPMColor span[], int count) SK_OVERRIDE;
3059ccef695cef28a74ab2ea13d5a6c9017af45402reed@google.com    virtual void shadeSpan16(int x, int y, uint16_t span[], int count) SK_OVERRIDE;
3159ccef695cef28a74ab2ea13d5a6c9017af45402reed@google.com    virtual void shadeSpanAlpha(int x, int y, uint8_t alpha[], int count) SK_OVERRIDE;
3237a201231b8f6381938282675eb9abb50ab3b389reed@google.com
3337a201231b8f6381938282675eb9abb50ab3b389reed@google.comprotected:
3437a201231b8f6381938282675eb9abb50ab3b389reed@google.com    SkEmptyShader(SkFlattenableReadBuffer&);
3559ccef695cef28a74ab2ea13d5a6c9017af45402reed@google.com
3659ccef695cef28a74ab2ea13d5a6c9017af45402reed@google.com    virtual Factory getFactory() SK_OVERRIDE;
3759ccef695cef28a74ab2ea13d5a6c9017af45402reed@google.com    virtual void flatten(SkFlattenableWriteBuffer&) SK_OVERRIDE;
3837a201231b8f6381938282675eb9abb50ab3b389reed@google.com
3937a201231b8f6381938282675eb9abb50ab3b389reed@google.comprivate:
4037a201231b8f6381938282675eb9abb50ab3b389reed@google.com    typedef SkShader INHERITED;
4137a201231b8f6381938282675eb9abb50ab3b389reed@google.com};
4237a201231b8f6381938282675eb9abb50ab3b389reed@google.com
4337a201231b8f6381938282675eb9abb50ab3b389reed@google.com#endif
44