gfx/skia/trunk/src/image/SkImage_Base.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/gfx/skia/trunk/src/image/SkImage_Base.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,38 @@
     1.4 +/*
     1.5 + * Copyright 2012 Google Inc.
     1.6 + *
     1.7 + * Use of this source code is governed by a BSD-style license that can be
     1.8 + * found in the LICENSE file.
     1.9 + */
    1.10 +
    1.11 +#ifndef SkImage_Base_DEFINED
    1.12 +#define SkImage_Base_DEFINED
    1.13 +
    1.14 +#include "SkImage.h"
    1.15 +
    1.16 +class SkImage_Base : public SkImage {
    1.17 +public:
    1.18 +    SkImage_Base(int width, int height) : INHERITED(width, height) {}
    1.19 +
    1.20 +    virtual void onDraw(SkCanvas*, SkScalar x, SkScalar y, const SkPaint*) = 0;
    1.21 +    virtual void onDrawRectToRect(SkCanvas*, const SkRect* src,
    1.22 +                                  const SkRect& dst, const SkPaint*) = 0;
    1.23 +
    1.24 +    // Default impl calls onDraw
    1.25 +    virtual bool onReadPixels(SkBitmap*, const SkIRect& subset) const;
    1.26 +
    1.27 +    virtual const void* onPeekPixels(SkImageInfo*, size_t* /*rowBytes*/) const {
    1.28 +        return NULL;
    1.29 +    }
    1.30 +
    1.31 +    virtual GrTexture* onGetTexture() { return NULL; }
    1.32 +
    1.33 +    // return a read-only copy of the pixels. We promise to not modify them,
    1.34 +    // but only inspect them (or encode them).
    1.35 +    virtual bool getROPixels(SkBitmap*) const { return false; }
    1.36 +
    1.37 +private:
    1.38 +    typedef SkImage INHERITED;
    1.39 +};
    1.40 +
    1.41 +#endif

mercurial