1ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com
2ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com/*
3ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com * Copyright 2006 The Android Open Source Project
4ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com *
5ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com * Use of this source code is governed by a BSD-style license that can be
6ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com * found in the LICENSE file.
7ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com */
8ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com
98a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
108a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#ifndef SkDrawBitmap_DEFINED
118a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#define SkDrawBitmap_DEFINED
128a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
138a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#include "SkBoundable.h"
148a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#include "SkBase64.h"
158a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#include "SkBitmap.h"
168a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com// #include "SkImageDecoder.h"
178a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#include "SkMemberInfo.h"
188a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
198a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comclass SkBaseBitmap : public SkBoundable {
208a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    DECLARE_MEMBER_INFO(BaseBitmap);
218a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    SkBaseBitmap();
228a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    virtual ~SkBaseBitmap();
238a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    virtual bool draw(SkAnimateMaker& );
248a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comprotected:
258a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    SkBitmap fBitmap;
268a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    SkScalar x;
278a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    SkScalar y;
288a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comprivate:
298a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    friend class SkDrawTo;
308a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    friend class SkDrawBitmapShader;
318a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    typedef SkBoundable INHERITED;
328a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com};
338a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
348a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comclass SkDrawBitmap : public SkBaseBitmap {
358a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    DECLARE_DRAW_MEMBER_INFO(Bitmap);
368a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    SkDrawBitmap();
378a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    virtual ~SkDrawBitmap();
388a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#ifdef SK_DUMP_ENABLED
398a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    virtual void dump(SkAnimateMaker* );
408a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#endif
418a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    virtual void onEndElement(SkAnimateMaker& );
428a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    virtual bool setProperty(int index, SkScriptValue& value);
438a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comprotected:
448a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    int /*SkBitmap::Config*/ format;
458a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    int32_t height;
468a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    int32_t rowBytes;
478a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    int32_t width;
488a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    SkColor fColor;
498a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    SkBool fColorSet;
508a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    typedef SkBaseBitmap INHERITED;
518a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com};
528a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
53bdae027bd86b7900d1874ad77f0ec9e31f6cbcabreed@google.comclass SkImageBaseBitmap : public SkBaseBitmap {
54bdae027bd86b7900d1874ad77f0ec9e31f6cbcabreed@google.com    DECLARE_MEMBER_INFO(ImageBaseBitmap);
55bdae027bd86b7900d1874ad77f0ec9e31f6cbcabreed@google.com    SkImageBaseBitmap();
56bdae027bd86b7900d1874ad77f0ec9e31f6cbcabreed@google.com    virtual ~SkImageBaseBitmap();
578a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    virtual SkDisplayable* deepCopy(SkAnimateMaker* );
588a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    virtual void dirty();
598a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    virtual bool draw(SkAnimateMaker& );
608a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    virtual bool getProperty(int index, SkScriptValue* value) const;
618a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    virtual void onEndElement(SkAnimateMaker& maker);
628a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comprivate:
63bdae027bd86b7900d1874ad77f0ec9e31f6cbcabreed@google.com    void resolve() const { (const_cast<SkImageBaseBitmap*>(this))->resolve(); }
648a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    void resolve();
658a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comprotected:
668a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    SkBase64 base64;
678a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    SkString src;
68d6176b0dcacb124539e0cfd051e6d93a9782f020rmistry@google.com    SkString fLast; // cache of src so that stream isn't unnecessarily decoded
698a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    SkBool fDirty;
708a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    const char* fUriBase;
718a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    typedef SkBaseBitmap INHERITED;
728a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com};
738a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
748a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#endif // SkDrawBitmap_DEFINED
75