michael@0: /* michael@0: * Copyright 2012 Google Inc. michael@0: * michael@0: * Use of this source code is governed by a BSD-style license that can be michael@0: * found in the LICENSE file. michael@0: */ michael@0: michael@0: #ifndef SkImage_Base_DEFINED michael@0: #define SkImage_Base_DEFINED michael@0: michael@0: #include "SkImage.h" michael@0: michael@0: class SkImage_Base : public SkImage { michael@0: public: michael@0: SkImage_Base(int width, int height) : INHERITED(width, height) {} michael@0: michael@0: virtual void onDraw(SkCanvas*, SkScalar x, SkScalar y, const SkPaint*) = 0; michael@0: virtual void onDrawRectToRect(SkCanvas*, const SkRect* src, michael@0: const SkRect& dst, const SkPaint*) = 0; michael@0: michael@0: // Default impl calls onDraw michael@0: virtual bool onReadPixels(SkBitmap*, const SkIRect& subset) const; michael@0: michael@0: virtual const void* onPeekPixels(SkImageInfo*, size_t* /*rowBytes*/) const { michael@0: return NULL; michael@0: } michael@0: michael@0: virtual GrTexture* onGetTexture() { return NULL; } michael@0: michael@0: // return a read-only copy of the pixels. We promise to not modify them, michael@0: // but only inspect them (or encode them). michael@0: virtual bool getROPixels(SkBitmap*) const { return false; } michael@0: michael@0: private: michael@0: typedef SkImage INHERITED; michael@0: }; michael@0: michael@0: #endif