| 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; |
| 39 virtual SkSurface* onNewSurface(const SkImageInfo&, const SkSurfaceProps&) c
onst = 0; | 42 virtual SkSurface* onNewSurface(const SkImageInfo&, const SkSurfaceProps&) c
onst = 0; |
| 40 | 43 |
| 41 virtual const void* onPeekPixels(SkImageInfo*, size_t* /*rowBytes*/) const { | 44 virtual const void* onPeekPixels(SkImageInfo*, size_t* /*rowBytes*/) const { |
| 42 return NULL; | 45 return NULL; |
| 43 } | 46 } |
| 44 | 47 |
| 45 // Default impl calls onDraw | 48 // Default impl calls onDraw |
| 46 virtual bool onReadPixels(const SkImageInfo& dstInfo, void* dstPixels, size_
t dstRowBytes, | 49 virtual bool onReadPixels(const SkImageInfo& dstInfo, void* dstPixels, size_
t dstRowBytes, |
| 47 int srcX, int srcY) const; | 50 int srcX, int srcY) const; |
| 48 | 51 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 68 | 71 |
| 69 static inline SkImage_Base* as_IB(SkImage* image) { | 72 static inline SkImage_Base* as_IB(SkImage* image) { |
| 70 return static_cast<SkImage_Base*>(image); | 73 return static_cast<SkImage_Base*>(image); |
| 71 } | 74 } |
| 72 | 75 |
| 73 static inline const SkImage_Base* as_IB(const SkImage* image) { | 76 static inline const SkImage_Base* as_IB(const SkImage* image) { |
| 74 return static_cast<const SkImage_Base*>(image); | 77 return static_cast<const SkImage_Base*>(image); |
| 75 } | 78 } |
| 76 | 79 |
| 77 #endif | 80 #endif |
| OLD | NEW |