aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/core
diff options
context:
space:
mode:
authorGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2011-07-05 18:54:12 +0000
committerGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2011-07-05 18:54:12 +0000
commit37a201231b8f6381938282675eb9abb50ab3b389 (patch)
tree21788feb3881a72c82406a419f3c1674dd9478dc /include/core
parent1d6ee0bd4db7f3b676209341214641d9af5a965f (diff)
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
Diffstat (limited to 'include/core')
-rw-r--r--include/core/SkEmptyShader.h48
1 files changed, 48 insertions, 0 deletions
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