blob: 9542ba3b2e4659cffa90bc9c9defcb60b7d0eaae [file] [log] [blame]
reed@google.com58b21ec2012-07-30 18:20:12 +00001/*
2 * Copyright 2012 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8#ifndef SkImage_Base_DEFINED
9#define SkImage_Base_DEFINED
10
11#include "SkImage.h"
12
13class SkImage_Base : public SkImage {
14public:
15 SkImage_Base(int width, int height) : INHERITED(width, height) {}
16
reed8572fc02014-08-11 13:03:55 -070017 virtual void onDraw(SkCanvas*, SkScalar x, SkScalar y, const SkPaint*) const = 0;
skia.committer@gmail.com7f1af502013-07-24 07:01:12 +000018 virtual void onDrawRectToRect(SkCanvas*, const SkRect* src,
reed8572fc02014-08-11 13:03:55 -070019 const SkRect& dst, const SkPaint*) const = 0;
reed@google.com4f7c6152014-02-06 14:11:56 +000020
21 // Default impl calls onDraw
22 virtual bool onReadPixels(SkBitmap*, const SkIRect& subset) const;
23
24 virtual const void* onPeekPixels(SkImageInfo*, size_t* /*rowBytes*/) const {
25 return NULL;
26 }
27
reed8572fc02014-08-11 13:03:55 -070028 virtual GrTexture* onGetTexture() const { return NULL; }
skia.committer@gmail.com3e50e992013-05-21 07:01:40 +000029
reed@google.com4b0757b2013-05-20 16:33:41 +000030 // return a read-only copy of the pixels. We promise to not modify them,
31 // but only inspect them (or encode them).
32 virtual bool getROPixels(SkBitmap*) const { return false; }
reed@google.com58b21ec2012-07-30 18:20:12 +000033
piotaixr76d5b472014-07-22 15:02:05 -070034 virtual SkShader* onNewShader(SkShader::TileMode,
35 SkShader::TileMode,
36 const SkMatrix* localMatrix) const { return NULL; };
rmistry@google.comfbfcd562012-08-23 18:09:54 +000037private:
reed@google.com58b21ec2012-07-30 18:20:12 +000038 typedef SkImage INHERITED;
39};
40
41#endif