OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #ifndef SkImage_Base_DEFINED | 8 #ifndef SkImage_Base_DEFINED |
9 #define SkImage_Base_DEFINED | 9 #define SkImage_Base_DEFINED |
10 | 10 |
11 #include "SkImage.h" | 11 #include "SkImage.h" |
12 | 12 |
13 class SkImage_Base : public SkImage { | 13 class SkImage_Base : public SkImage { |
14 public: | 14 public: |
15 SkImage_Base(int width, int height) : INHERITED(width, height) {} | 15 SkImage_Base(int width, int height) : INHERITED(width, height) {} |
| 16 SkImage_Base(const SkImageInfo& info) : INHERITED(info.fWidth, info.fHeight)
{} |
16 | 17 |
17 virtual void onDraw(SkCanvas*, SkScalar x, SkScalar y, const SkPaint*) = 0; | 18 virtual void onDraw(SkCanvas*, SkScalar x, SkScalar y, const SkPaint*) = 0; |
18 virtual void onDrawRectToRect(SkCanvas*, const SkRect* src, | 19 virtual void onDrawRectToRect(SkCanvas*, const SkRect* src, |
19 const SkRect& dst, const SkPaint*) = 0; | 20 const SkRect& dst, const SkPaint*) = 0; |
20 virtual GrTexture* onGetTexture() { return NULL; } | 21 virtual GrTexture* onGetTexture() { return NULL; } |
21 | 22 |
22 // return a read-only copy of the pixels. We promise to not modify them, | 23 // return a read-only copy of the pixels. We promise to not modify them, |
23 // but only inspect them (or encode them). | 24 // but only inspect them (or encode them). |
24 virtual bool getROPixels(SkBitmap*) const { return false; } | 25 virtual bool getROPixels(SkBitmap*) const { return false; } |
25 | 26 |
26 private: | 27 private: |
27 typedef SkImage INHERITED; | 28 typedef SkImage INHERITED; |
28 }; | 29 }; |
29 | 30 |
30 #endif | 31 #endif |
OLD | NEW |