epoger@google.com | ec3ed6a | 2011-07-28 14:26:00 +0000 | [diff] [blame] | 1 | |
| 2 | /* |
| 3 | * Copyright 2006 The Android Open Source Project |
| 4 | * |
| 5 | * Use of this source code is governed by a BSD-style license that can be |
| 6 | * found in the LICENSE file. |
| 7 | */ |
| 8 | |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 9 | |
| 10 | #ifndef SkBitmapProcShader_DEFINED |
| 11 | #define SkBitmapProcShader_DEFINED |
| 12 | |
| 13 | #include "SkShader.h" |
| 14 | #include "SkBitmapProcState.h" |
| 15 | |
| 16 | class SkBitmapProcShader : public SkShader { |
| 17 | public: |
| 18 | SkBitmapProcShader(const SkBitmap& src, TileMode tx, TileMode ty); |
| 19 | |
| 20 | // overrides from SkShader |
junov@chromium.org | b6e1619 | 2011-12-09 15:48:03 +0000 | [diff] [blame] | 21 | virtual bool isOpaque() const SK_OVERRIDE; |
robertphillips@google.com | 76f9e93 | 2013-01-15 20:17:47 +0000 | [diff] [blame] | 22 | virtual bool setContext(const SkBitmap&, const SkPaint&, const SkMatrix&) SK_OVERRIDE; |
| 23 | virtual void endContext() SK_OVERRIDE; |
| 24 | virtual uint32_t getFlags() SK_OVERRIDE { return fFlags; } |
| 25 | virtual void shadeSpan(int x, int y, SkPMColor dstC[], int count) SK_OVERRIDE; |
reed@google.com | 3bafe74 | 2012-10-12 18:56:18 +0000 | [diff] [blame] | 26 | virtual ShadeProc asAShadeProc(void** ctx) SK_OVERRIDE; |
robertphillips@google.com | 76f9e93 | 2013-01-15 20:17:47 +0000 | [diff] [blame] | 27 | virtual void shadeSpan16(int x, int y, uint16_t dstC[], int count) SK_OVERRIDE; |
| 28 | virtual BitmapType asABitmap(SkBitmap*, SkMatrix*, TileMode*) const SK_OVERRIDE; |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 29 | |
| 30 | static bool CanDo(const SkBitmap&, TileMode tx, TileMode ty); |
skia.committer@gmail.com | ff21c2e | 2013-01-16 07:05:56 +0000 | [diff] [blame] | 31 | |
robertphillips@google.com | 76f9e93 | 2013-01-15 20:17:47 +0000 | [diff] [blame] | 32 | SK_DEVELOPER_TO_STRING() |
djsollen@google.com | ba28d03 | 2012-03-26 17:57:35 +0000 | [diff] [blame] | 33 | SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkBitmapProcShader) |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 34 | |
bsalomon@google.com | e197cbf | 2013-01-14 16:46:26 +0000 | [diff] [blame] | 35 | #if SK_SUPPORT_GPU |
bsalomon@google.com | 0ac6af4 | 2013-01-16 15:16:18 +0000 | [diff] [blame] | 36 | GrEffectRef* asNewEffect(GrContext*, const SkPaint&) const SK_OVERRIDE; |
bsalomon@google.com | e197cbf | 2013-01-14 16:46:26 +0000 | [diff] [blame] | 37 | #endif |
| 38 | |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 39 | protected: |
| 40 | SkBitmapProcShader(SkFlattenableReadBuffer& ); |
djsollen@google.com | 5492424 | 2012-03-29 15:18:04 +0000 | [diff] [blame] | 41 | virtual void flatten(SkFlattenableWriteBuffer&) const SK_OVERRIDE; |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 42 | |
| 43 | SkBitmap fRawBitmap; // experimental for RLE encoding |
| 44 | SkBitmapProcState fState; |
| 45 | uint32_t fFlags; |
| 46 | |
reed@google.com | 7c2f27d | 2011-03-07 19:29:00 +0000 | [diff] [blame] | 47 | private: |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 48 | typedef SkShader INHERITED; |
| 49 | }; |
| 50 | |
| 51 | #endif |