From 37a201231b8f6381938282675eb9abb50ab3b389 Mon Sep 17 00:00:00 2001 From: "reed@google.com" Date: Tue, 5 Jul 2011 18:54:12 +0000 Subject: add SkEmptyShader, and return it from CreateBitmapShader if the bitmap is empty (i.e. has no pixels at all) git-svn-id: http://skia.googlecode.com/svn/trunk@1792 2bbb7eff-a529-9590-31e7-b0007b416f81 --- include/core/SkEmptyShader.h | 48 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 include/core/SkEmptyShader.h (limited to 'include/core/SkEmptyShader.h') diff --git a/include/core/SkEmptyShader.h b/include/core/SkEmptyShader.h new file mode 100644 index 0000000000..1c40d0b1e0 --- /dev/null +++ b/include/core/SkEmptyShader.h @@ -0,0 +1,48 @@ +/* + Copyright 2011 Google Inc. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + */ + + +#ifndef SkEmptyShader_DEFINED +#define SkEmptyShader_DEFINED + +#include "SkShader.h" + +/** + * \class SkEmptyShader + * A Shader that always draws nothing. + */ +class SK_API SkEmptyShader : public SkShader { +public: + SkEmptyShader(); + + virtual uint32_t getFlags(); + virtual uint8_t getSpan16Alpha() const; + virtual bool setContext(const SkBitmap& device, const SkPaint& paint, + const SkMatrix& matrix); + virtual void shadeSpan(int x, int y, SkPMColor span[], int count); + virtual void shadeSpan16(int x, int y, uint16_t span[], int count); + virtual void shadeSpanAlpha(int x, int y, uint8_t alpha[], int count); + +protected: + SkEmptyShader(SkFlattenableReadBuffer&); + virtual Factory getFactory(); + virtual void flatten(SkFlattenableWriteBuffer&); + +private: + typedef SkShader INHERITED; +}; + +#endif -- cgit v1.2.3