reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 1 | /* |
epoger@google.com | ec3ed6a | 2011-07-28 14:26:00 +0000 | [diff] [blame] | 2 | * Copyright 2006 The Android Open Source Project |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 3 | * |
epoger@google.com | ec3ed6a | 2011-07-28 14:26:00 +0000 | [diff] [blame] | 4 | * Use of this source code is governed by a BSD-style license that can be |
| 5 | * found in the LICENSE file. |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 6 | */ |
| 7 | |
| 8 | #ifndef SkTransparentShader_DEFINED |
| 9 | #define SkTransparentShader_DEFINED |
| 10 | |
| 11 | #include "SkShader.h" |
| 12 | |
tfarina@chromium.org | 6806fe8 | 2012-10-12 14:41:39 +0000 | [diff] [blame] | 13 | class SK_API SkTransparentShader : public SkShader { |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 14 | public: |
| 15 | SkTransparentShader() {} |
reed@google.com | 7716afb | 2011-12-07 15:17:50 +0000 | [diff] [blame] | 16 | |
commit-bot@chromium.org | 87fcd95 | 2014-04-23 19:10:51 +0000 | [diff] [blame] | 17 | virtual size_t contextSize() const SK_OVERRIDE; |
| 18 | |
| 19 | class TransparentShaderContext : public SkShader::Context { |
| 20 | public: |
commit-bot@chromium.org | e901b6d | 2014-05-01 19:31:31 +0000 | [diff] [blame] | 21 | TransparentShaderContext(const SkTransparentShader& shader, const ContextRec&); |
commit-bot@chromium.org | 87fcd95 | 2014-04-23 19:10:51 +0000 | [diff] [blame] | 22 | virtual ~TransparentShaderContext(); |
| 23 | |
| 24 | virtual uint32_t getFlags() const SK_OVERRIDE; |
| 25 | virtual void shadeSpan(int x, int y, SkPMColor[], int count) SK_OVERRIDE; |
| 26 | virtual void shadeSpan16(int x, int y, uint16_t span[], int count) SK_OVERRIDE; |
| 27 | |
| 28 | private: |
| 29 | const SkBitmap* fDevice; |
| 30 | |
| 31 | typedef SkShader::Context INHERITED; |
| 32 | }; |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 33 | |
commit-bot@chromium.org | 0f10f7b | 2014-03-13 18:02:17 +0000 | [diff] [blame] | 34 | SK_TO_STRING_OVERRIDE() |
djsollen@google.com | ba28d03 | 2012-03-26 17:57:35 +0000 | [diff] [blame] | 35 | SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkTransparentShader) |
reed@google.com | 7716afb | 2011-12-07 15:17:50 +0000 | [diff] [blame] | 36 | |
commit-bot@chromium.org | ce56d96 | 2014-05-05 18:39:18 +0000 | [diff] [blame] | 37 | protected: |
| 38 | virtual Context* onCreateContext(const ContextRec&, void* storage) const SK_OVERRIDE; |
| 39 | |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 40 | private: |
commit-bot@chromium.org | 8b0e8ac | 2014-01-30 18:58:24 +0000 | [diff] [blame] | 41 | SkTransparentShader(SkReadBuffer& buffer) : INHERITED(buffer) {} |
rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 42 | |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 43 | typedef SkShader INHERITED; |
| 44 | }; |
| 45 | |
| 46 | #endif |