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 SkDrawBitmap_DEFINED |
| 11 | #define SkDrawBitmap_DEFINED |
| 12 | |
| 13 | #include "SkBoundable.h" |
| 14 | #include "SkBase64.h" |
| 15 | #include "SkBitmap.h" |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 16 | #include "SkMemberInfo.h" |
| 17 | |
| 18 | class SkBaseBitmap : public SkBoundable { |
| 19 | DECLARE_MEMBER_INFO(BaseBitmap); |
| 20 | SkBaseBitmap(); |
| 21 | virtual ~SkBaseBitmap(); |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 22 | bool draw(SkAnimateMaker& ) override; |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 23 | protected: |
| 24 | SkBitmap fBitmap; |
| 25 | SkScalar x; |
| 26 | SkScalar y; |
| 27 | private: |
| 28 | friend class SkDrawTo; |
| 29 | friend class SkDrawBitmapShader; |
| 30 | typedef SkBoundable INHERITED; |
| 31 | }; |
| 32 | |
| 33 | class SkDrawBitmap : public SkBaseBitmap { |
| 34 | DECLARE_DRAW_MEMBER_INFO(Bitmap); |
| 35 | SkDrawBitmap(); |
| 36 | virtual ~SkDrawBitmap(); |
| 37 | #ifdef SK_DUMP_ENABLED |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 38 | void dump(SkAnimateMaker* ) override; |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 39 | #endif |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 40 | void onEndElement(SkAnimateMaker& ) override; |
| 41 | bool setProperty(int index, SkScriptValue& value) override; |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 42 | protected: |
| 43 | int /*SkBitmap::Config*/ format; |
| 44 | int32_t height; |
| 45 | int32_t rowBytes; |
| 46 | int32_t width; |
| 47 | SkColor fColor; |
| 48 | SkBool fColorSet; |
| 49 | typedef SkBaseBitmap INHERITED; |
| 50 | }; |
| 51 | |
reed@google.com | bdae027 | 2012-07-27 15:30:40 +0000 | [diff] [blame] | 52 | class SkImageBaseBitmap : public SkBaseBitmap { |
| 53 | DECLARE_MEMBER_INFO(ImageBaseBitmap); |
| 54 | SkImageBaseBitmap(); |
| 55 | virtual ~SkImageBaseBitmap(); |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 56 | SkDisplayable* deepCopy(SkAnimateMaker* ) override; |
| 57 | void dirty() override; |
| 58 | bool draw(SkAnimateMaker& ) override; |
| 59 | bool getProperty(int index, SkScriptValue* value) const override; |
| 60 | void onEndElement(SkAnimateMaker& maker) override; |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 61 | private: |
reed@google.com | bdae027 | 2012-07-27 15:30:40 +0000 | [diff] [blame] | 62 | void resolve() const { (const_cast<SkImageBaseBitmap*>(this))->resolve(); } |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 63 | void resolve(); |
| 64 | protected: |
| 65 | SkBase64 base64; |
| 66 | SkString src; |
rmistry@google.com | d6176b0 | 2012-08-23 18:14:13 +0000 | [diff] [blame] | 67 | SkString fLast; // cache of src so that stream isn't unnecessarily decoded |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 68 | SkBool fDirty; |
| 69 | const char* fUriBase; |
| 70 | typedef SkBaseBitmap INHERITED; |
| 71 | }; |
| 72 | |
| 73 | #endif // SkDrawBitmap_DEFINED |