blob: 9fd25d604a27832afdedd520e023609174c9208b [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"
reed@android.com8a1c16f2008-12-17 15:59:43 +000016#include "SkMemberInfo.h"
17
18class SkBaseBitmap : public SkBoundable {
19 DECLARE_MEMBER_INFO(BaseBitmap);
20 SkBaseBitmap();
21 virtual ~SkBaseBitmap();
mtklein36352bf2015-03-25 18:17:31 -070022 bool draw(SkAnimateMaker& ) override;
reed@android.com8a1c16f2008-12-17 15:59:43 +000023protected:
24 SkBitmap fBitmap;
25 SkScalar x;
26 SkScalar y;
27private:
28 friend class SkDrawTo;
29 friend class SkDrawBitmapShader;
30 typedef SkBoundable INHERITED;
31};
32
33class SkDrawBitmap : public SkBaseBitmap {
34 DECLARE_DRAW_MEMBER_INFO(Bitmap);
35 SkDrawBitmap();
36 virtual ~SkDrawBitmap();
37#ifdef SK_DUMP_ENABLED
mtklein36352bf2015-03-25 18:17:31 -070038 void dump(SkAnimateMaker* ) override;
reed@android.com8a1c16f2008-12-17 15:59:43 +000039#endif
mtklein36352bf2015-03-25 18:17:31 -070040 void onEndElement(SkAnimateMaker& ) override;
41 bool setProperty(int index, SkScriptValue& value) override;
reed@android.com8a1c16f2008-12-17 15:59:43 +000042protected:
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.combdae0272012-07-27 15:30:40 +000052class SkImageBaseBitmap : public SkBaseBitmap {
53 DECLARE_MEMBER_INFO(ImageBaseBitmap);
54 SkImageBaseBitmap();
55 virtual ~SkImageBaseBitmap();
mtklein36352bf2015-03-25 18:17:31 -070056 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.com8a1c16f2008-12-17 15:59:43 +000061private:
reed@google.combdae0272012-07-27 15:30:40 +000062 void resolve() const { (const_cast<SkImageBaseBitmap*>(this))->resolve(); }
reed@android.com8a1c16f2008-12-17 15:59:43 +000063 void resolve();
64protected:
65 SkBase64 base64;
66 SkString src;
rmistry@google.comd6176b02012-08-23 18:14:13 +000067 SkString fLast; // cache of src so that stream isn't unnecessarily decoded
reed@android.com8a1c16f2008-12-17 15:59:43 +000068 SkBool fDirty;
69 const char* fUriBase;
70 typedef SkBaseBitmap INHERITED;
71};
72
73#endif // SkDrawBitmap_DEFINED