blob: 270545d0ee98a2674bf33ac1879b2d7482fc251c [file] [log] [blame]
epoger@google.comec3ed6a2011-07-28 14:26:00 +00001
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.com8a1c16f2008-12-17 15:59:43 +00009
10#ifndef SkDrawBitmap_DEFINED
11#define SkDrawBitmap_DEFINED
12
13#include "SkBoundable.h"
14#include "SkBase64.h"
15#include "SkBitmap.h"
16// #include "SkImageDecoder.h"
17#include "SkMemberInfo.h"
18
19class SkBaseBitmap : public SkBoundable {
20 DECLARE_MEMBER_INFO(BaseBitmap);
21 SkBaseBitmap();
22 virtual ~SkBaseBitmap();
mtklein36352bf2015-03-25 18:17:31 -070023 bool draw(SkAnimateMaker& ) override;
reed@android.com8a1c16f2008-12-17 15:59:43 +000024protected:
25 SkBitmap fBitmap;
26 SkScalar x;
27 SkScalar y;
28private:
29 friend class SkDrawTo;
30 friend class SkDrawBitmapShader;
31 typedef SkBoundable INHERITED;
32};
33
34class SkDrawBitmap : public SkBaseBitmap {
35 DECLARE_DRAW_MEMBER_INFO(Bitmap);
36 SkDrawBitmap();
37 virtual ~SkDrawBitmap();
38#ifdef SK_DUMP_ENABLED
mtklein36352bf2015-03-25 18:17:31 -070039 void dump(SkAnimateMaker* ) override;
reed@android.com8a1c16f2008-12-17 15:59:43 +000040#endif
mtklein36352bf2015-03-25 18:17:31 -070041 void onEndElement(SkAnimateMaker& ) override;
42 bool setProperty(int index, SkScriptValue& value) override;
reed@android.com8a1c16f2008-12-17 15:59:43 +000043protected:
44 int /*SkBitmap::Config*/ format;
45 int32_t height;
46 int32_t rowBytes;
47 int32_t width;
48 SkColor fColor;
49 SkBool fColorSet;
50 typedef SkBaseBitmap INHERITED;
51};
52
reed@google.combdae0272012-07-27 15:30:40 +000053class SkImageBaseBitmap : public SkBaseBitmap {
54 DECLARE_MEMBER_INFO(ImageBaseBitmap);
55 SkImageBaseBitmap();
56 virtual ~SkImageBaseBitmap();
mtklein36352bf2015-03-25 18:17:31 -070057 SkDisplayable* deepCopy(SkAnimateMaker* ) override;
58 void dirty() override;
59 bool draw(SkAnimateMaker& ) override;
60 bool getProperty(int index, SkScriptValue* value) const override;
61 void onEndElement(SkAnimateMaker& maker) override;
reed@android.com8a1c16f2008-12-17 15:59:43 +000062private:
reed@google.combdae0272012-07-27 15:30:40 +000063 void resolve() const { (const_cast<SkImageBaseBitmap*>(this))->resolve(); }
reed@android.com8a1c16f2008-12-17 15:59:43 +000064 void resolve();
65protected:
66 SkBase64 base64;
67 SkString src;
rmistry@google.comd6176b02012-08-23 18:14:13 +000068 SkString fLast; // cache of src so that stream isn't unnecessarily decoded
reed@android.com8a1c16f2008-12-17 15:59:43 +000069 SkBool fDirty;
70 const char* fUriBase;
71 typedef SkBaseBitmap INHERITED;
72};
73
74#endif // SkDrawBitmap_DEFINED