Index: src/utils/SkPictureUtils.cpp |
diff --git a/src/utils/SkPictureUtils.cpp b/src/utils/SkPictureUtils.cpp |
index ce516146544f6260305df71346204de6593cc0bf..ad0b30df5cb6c720191ecfe34746c18be6101832 100644 |
--- a/src/utils/SkPictureUtils.cpp |
+++ b/src/utils/SkPictureUtils.cpp |
@@ -47,7 +47,7 @@ static void nothing_to_do() {} |
* It should never actually draw anything, so there need not be any pixels |
* behind its device-bitmap. |
*/ |
-class GatherPixelRefDevice : public SkBitmapDevice { |
+class GatherPixelRefDevice : public SkBaseDevice { |
private: |
PixelRefSet* fPRSet; |
@@ -70,10 +70,36 @@ private: |
} |
public: |
- GatherPixelRefDevice(const SkBitmap& bm, PixelRefSet* prset) : SkBitmapDevice(bm) { |
+ GatherPixelRefDevice(int width, int height, PixelRefSet* prset) { |
+ fSize.set(width, height); |
+ fEmptyBitmap.setConfig(SkBitmap::kNo_Config, width, height); |
fPRSet = prset; |
} |
+ virtual uint32_t getDeviceCapabilities() SK_OVERRIDE { return 0; } |
+ virtual int width() const SK_OVERRIDE { return fSize.width(); } |
+ virtual int height() const SK_OVERRIDE { return fSize.height(); } |
+ virtual bool isOpaque() const SK_OVERRIDE { return false; } |
+ virtual SkBitmap::Config config() const SK_OVERRIDE { |
+ return SkBitmap::kNo_Config; |
+ } |
+ virtual GrRenderTarget* accessRenderTarget() SK_OVERRIDE { return NULL; } |
+ virtual bool filterTextFlags(const SkPaint& paint, TextFlags*) SK_OVERRIDE { |
+ return true; |
+ } |
+ // TODO: allow this call to return failure, or move to SkBitmapDevice only. |
robertphillips
2013/11/12 18:36:24
I would like it to be on SkBitmapDevice only (alth
|
+ virtual const SkBitmap& onAccessBitmap() SK_OVERRIDE { |
+ return fEmptyBitmap; |
+ } |
+ virtual void lockPixels() SK_OVERRIDE { nothing_to_do(); } |
+ virtual void unlockPixels() SK_OVERRIDE { nothing_to_do(); } |
+ virtual bool allowImageFilter(SkImageFilter*) SK_OVERRIDE { return false; } |
+ virtual bool canHandleImageFilter(SkImageFilter*) SK_OVERRIDE { return false; } |
+ virtual bool filterImage(SkImageFilter*, const SkBitmap&, const SkMatrix&, |
+ SkBitmap* result, SkIPoint* offset) SK_OVERRIDE { |
+ return false; |
+ } |
+ |
virtual void clear(SkColor color) SK_OVERRIDE { |
nothing_to_do(); |
} |
@@ -93,6 +119,10 @@ public: |
const SkPaint& paint) SK_OVERRIDE { |
this->addBitmapFromPaint(paint); |
} |
+ virtual void drawRRect(const SkDraw&, const SkRRect&, |
+ const SkPaint& paint) SK_OVERRIDE { |
+ this->addBitmapFromPaint(paint); |
+ } |
virtual void drawOval(const SkDraw&, const SkRect&, |
const SkPaint& paint) SK_OVERRIDE { |
this->addBitmapFromPaint(paint); |
@@ -151,8 +181,21 @@ protected: |
return false; |
} |
robertphillips
2013/11/12 18:36:24
Can this move to SkBitmapDevice?
|
+ virtual void replaceBitmapBackendForRasterSurface(const SkBitmap&) SK_OVERRIDE { |
+ not_supported(); |
+ } |
robertphillips
2013/11/12 18:36:24
I would think this could work - in theory.
|
+ virtual SkBaseDevice* onCreateCompatibleDevice(SkBitmap::Config config, |
scroggo
2013/11/12 18:22:00
nit: newline between functions.
|
+ int width, int height, |
+ bool isOpaque, |
+ Usage usage) SK_OVERRIDE { |
+ return NULL; |
+ } |
+ virtual void flush() SK_OVERRIDE {} |
scroggo
2013/11/12 18:22:00
nit: newline between functions.
|
+ |
private: |
- typedef SkBitmapDevice INHERITED; |
+ SkBitmap fEmptyBitmap; // legacy -- need to remove the need for this guy |
+ SkISize fSize; |
+ typedef SkBaseDevice INHERITED; |
}; |
class NoSaveLayerCanvas : public SkCanvas { |
@@ -213,7 +256,7 @@ SkData* SkPictureUtils::GatherPixelRefs(SkPicture* pict, const SkRect& area) { |
emptyBitmap.setConfig(SkBitmap::kARGB_8888_Config, pict->width(), pict->height()); |
// note: we do not set any pixels (shouldn't need to) |
- GatherPixelRefDevice device(emptyBitmap, &prset); |
+ GatherPixelRefDevice device(pict->width(), pict->height(), &prset); |
NoSaveLayerCanvas canvas(&device); |
canvas.clipRect(area, SkRegion::kIntersect_Op, false); |