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 |
(...skipping 18 matching lines...) Expand all Loading... |
29 void initWithProps(const SkSurfaceProps& props) { | 29 void initWithProps(const SkSurfaceProps& props) { |
30 SkASSERT(this->unique()); // only viewed by one thread | 30 SkASSERT(this->unique()); // only viewed by one thread |
31 SkSurfaceProps* mutableProps = const_cast<SkSurfaceProps*>(&fProps); | 31 SkSurfaceProps* mutableProps = const_cast<SkSurfaceProps*>(&fProps); |
32 SkASSERT(mutableProps != &props); // check for self-assignment | 32 SkASSERT(mutableProps != &props); // check for self-assignment |
33 mutableProps->~SkSurfaceProps(); | 33 mutableProps->~SkSurfaceProps(); |
34 new (mutableProps) SkSurfaceProps(props); | 34 new (mutableProps) SkSurfaceProps(props); |
35 } | 35 } |
36 | 36 |
37 const SkSurfaceProps& props() const { return fProps; } | 37 const SkSurfaceProps& props() const { return fProps; } |
38 | 38 |
39 virtual void onDraw(SkCanvas*, SkScalar x, SkScalar y, const SkPaint*) const
= 0; | |
40 virtual void onDrawRect(SkCanvas*, const SkRect* src, | |
41 const SkRect& dst, const SkPaint*) const = 0; | |
42 virtual SkSurface* onNewSurface(const SkImageInfo&, const SkSurfaceProps&) c
onst = 0; | 39 virtual SkSurface* onNewSurface(const SkImageInfo&, const SkSurfaceProps&) c
onst = 0; |
43 | 40 |
44 virtual const void* onPeekPixels(SkImageInfo*, size_t* /*rowBytes*/) const { | 41 virtual const void* onPeekPixels(SkImageInfo*, size_t* /*rowBytes*/) const { |
45 return NULL; | 42 return NULL; |
46 } | 43 } |
47 | 44 |
48 // Default impl calls onDraw | 45 // Default impl calls onDraw |
49 virtual bool onReadPixels(const SkImageInfo& dstInfo, void* dstPixels, size_
t dstRowBytes, | 46 virtual bool onReadPixels(const SkImageInfo& dstInfo, void* dstPixels, size_
t dstRowBytes, |
50 int srcX, int srcY) const; | 47 int srcX, int srcY) const; |
51 | 48 |
(...skipping 19 matching lines...) Expand all Loading... |
71 | 68 |
72 static inline SkImage_Base* as_IB(SkImage* image) { | 69 static inline SkImage_Base* as_IB(SkImage* image) { |
73 return static_cast<SkImage_Base*>(image); | 70 return static_cast<SkImage_Base*>(image); |
74 } | 71 } |
75 | 72 |
76 static inline const SkImage_Base* as_IB(const SkImage* image) { | 73 static inline const SkImage_Base* as_IB(const SkImage* image) { |
77 return static_cast<const SkImage_Base*>(image); | 74 return static_cast<const SkImage_Base*>(image); |
78 } | 75 } |
79 | 76 |
80 #endif | 77 #endif |
OLD | NEW |