gfx/skia/trunk/src/animator/SkDrawBitmap.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/gfx/skia/trunk/src/animator/SkDrawBitmap.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,74 @@
     1.4 +
     1.5 +/*
     1.6 + * Copyright 2006 The Android Open Source Project
     1.7 + *
     1.8 + * Use of this source code is governed by a BSD-style license that can be
     1.9 + * found in the LICENSE file.
    1.10 + */
    1.11 +
    1.12 +
    1.13 +#ifndef SkDrawBitmap_DEFINED
    1.14 +#define SkDrawBitmap_DEFINED
    1.15 +
    1.16 +#include "SkBoundable.h"
    1.17 +#include "SkBase64.h"
    1.18 +#include "SkBitmap.h"
    1.19 +// #include "SkImageDecoder.h"
    1.20 +#include "SkMemberInfo.h"
    1.21 +
    1.22 +class SkBaseBitmap : public SkBoundable {
    1.23 +    DECLARE_MEMBER_INFO(BaseBitmap);
    1.24 +    SkBaseBitmap();
    1.25 +    virtual ~SkBaseBitmap();
    1.26 +    virtual bool draw(SkAnimateMaker& );
    1.27 +protected:
    1.28 +    SkBitmap fBitmap;
    1.29 +    SkScalar x;
    1.30 +    SkScalar y;
    1.31 +private:
    1.32 +    friend class SkDrawTo;
    1.33 +    friend class SkDrawBitmapShader;
    1.34 +    typedef SkBoundable INHERITED;
    1.35 +};
    1.36 +
    1.37 +class SkDrawBitmap : public SkBaseBitmap {
    1.38 +    DECLARE_DRAW_MEMBER_INFO(Bitmap);
    1.39 +    SkDrawBitmap();
    1.40 +    virtual ~SkDrawBitmap();
    1.41 +#ifdef SK_DUMP_ENABLED
    1.42 +    virtual void dump(SkAnimateMaker* );
    1.43 +#endif
    1.44 +    virtual void onEndElement(SkAnimateMaker& );
    1.45 +    virtual bool setProperty(int index, SkScriptValue& value);
    1.46 +protected:
    1.47 +    int /*SkBitmap::Config*/ format;
    1.48 +    int32_t height;
    1.49 +    int32_t rowBytes;
    1.50 +    int32_t width;
    1.51 +    SkColor fColor;
    1.52 +    SkBool fColorSet;
    1.53 +    typedef SkBaseBitmap INHERITED;
    1.54 +};
    1.55 +
    1.56 +class SkImageBaseBitmap : public SkBaseBitmap {
    1.57 +    DECLARE_MEMBER_INFO(ImageBaseBitmap);
    1.58 +    SkImageBaseBitmap();
    1.59 +    virtual ~SkImageBaseBitmap();
    1.60 +    virtual SkDisplayable* deepCopy(SkAnimateMaker* );
    1.61 +    virtual void dirty();
    1.62 +    virtual bool draw(SkAnimateMaker& );
    1.63 +    virtual bool getProperty(int index, SkScriptValue* value) const;
    1.64 +    virtual void onEndElement(SkAnimateMaker& maker);
    1.65 +private:
    1.66 +    void resolve() const { (const_cast<SkImageBaseBitmap*>(this))->resolve(); }
    1.67 +    void resolve();
    1.68 +protected:
    1.69 +    SkBase64 base64;
    1.70 +    SkString src;
    1.71 +    SkString fLast; // cache of src so that stream isn't unnecessarily decoded
    1.72 +    SkBool fDirty;
    1.73 +    const char* fUriBase;
    1.74 +    typedef SkBaseBitmap INHERITED;
    1.75 +};
    1.76 +
    1.77 +#endif // SkDrawBitmap_DEFINED

mercurial