Chromium Code Reviews| Index: src/utils/SkPictureUtils.cpp |
| diff --git a/src/utils/SkPictureUtils.cpp b/src/utils/SkPictureUtils.cpp |
| index ffd9aa4429d24c307693b2b07fe465de8e78f5fb..edf629f5033e24414200147b86d61210aadf751a 100644 |
| --- a/src/utils/SkPictureUtils.cpp |
| +++ b/src/utils/SkPictureUtils.cpp |
| @@ -48,7 +48,7 @@ static void nothing_to_do() {} |
| * behind its device-bitmap. |
| * FIXME: Derive from SkBaseDevice. |
|
scroggo
2013/11/12 18:37:31
I guess you just rebased and got this, but it's no
reed1
2013/11/12 21:21:25
Done.
|
| */ |
| -class GatherPixelRefDevice : public SkBitmapDevice { |
| +class GatherPixelRefDevice : public SkBaseDevice { |
| private: |
| PixelRefSet* fPRSet; |
| @@ -71,10 +71,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. |
| + 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(); |
| } |
| @@ -156,8 +182,21 @@ protected: |
| return false; |
| } |
| + virtual void replaceBitmapBackendForRasterSurface(const SkBitmap&) SK_OVERRIDE { |
| + not_supported(); |
| + } |
| + virtual SkBaseDevice* onCreateCompatibleDevice(SkBitmap::Config config, |
| + int width, int height, |
| + bool isOpaque, |
| + Usage usage) SK_OVERRIDE { |
| + return NULL; |
| + } |
| + virtual void flush() SK_OVERRIDE {} |
| + |
| private: |
| - typedef SkBitmapDevice INHERITED; |
| + SkBitmap fEmptyBitmap; // legacy -- need to remove the need for this guy |
| + SkISize fSize; |
| + typedef SkBaseDevice INHERITED; |
| }; |
| class NoSaveLayerCanvas : public SkCanvas { |
| @@ -218,7 +257,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); |