From bf4f0e2b6ef5533562fae8fcc83ab5e1e404f9e2 Mon Sep 17 00:00:00 2001 From: "scroggo@google.com" Date: Wed, 13 Nov 2013 02:53:43 +0000 Subject: [PATCH] Override drawRRect in fake SkBitmapDevices. Recent changes to SkBitmapDevice modified ::drawRRect() to take an optimized drawing case (currently hidden behind a flag). Some subclasses of SkBitmapDevice were depending on the old behavior of calling ::drawPath(). Since they do not draw, attempting to take the drawing path can cause problems. For these subclasses, call drawPath in the subclass. Review URL: https://codereview.chromium.org/58933005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@234717 0039d316-1c4b-4281-b951-d872f2087c98 --- skia/ext/analysis_canvas.cc | 10 ++++++++++ skia/ext/analysis_canvas.h | 3 +++ skia/ext/vector_platform_device_emf_win.cc | 7 +++++++ skia/ext/vector_platform_device_emf_win.h | 2 ++ 4 files changed, 22 insertions(+) diff --git a/skia/ext/analysis_canvas.cc b/skia/ext/analysis_canvas.cc index 99dc4740e16120..79b44a6d9c3a22 100644 --- a/skia/ext/analysis_canvas.cc +++ b/skia/ext/analysis_canvas.cc @@ -196,6 +196,16 @@ void AnalysisDevice::drawOval(const SkDraw& draw, is_transparent_ = false; } +void AnalysisDevice::drawRRect(const SkDraw& draw, + const SkRRect& rr, + const SkPaint& paint) { + // This should add the SkRRect to an SkPath, and call + // drawPath, but since drawPath ignores the SkPath, just + // do the same work here. + is_solid_color_ = false; + is_transparent_ = false; +} + void AnalysisDevice::drawPath(const SkDraw& draw, const SkPath& path, const SkPaint& paint, diff --git a/skia/ext/analysis_canvas.h b/skia/ext/analysis_canvas.h index 5cbb5d79bb2849..00fadac1126e55 100644 --- a/skia/ext/analysis_canvas.h +++ b/skia/ext/analysis_canvas.h @@ -86,6 +86,9 @@ class SK_API AnalysisDevice : public SkBitmapDevice { virtual void drawRect(const SkDraw& draw, const SkRect& rect, const SkPaint& paint) OVERRIDE; + virtual void drawRRect(const SkDraw& draw, + const SkRRect& rr, + const SkPaint& paint) OVERRIDE; virtual void drawOval(const SkDraw& draw, const SkRect& oval, const SkPaint& paint) OVERRIDE; diff --git a/skia/ext/vector_platform_device_emf_win.cc b/skia/ext/vector_platform_device_emf_win.cc index fe1ba2927dbe8b..3356f217adf45c 100644 --- a/skia/ext/vector_platform_device_emf_win.cc +++ b/skia/ext/vector_platform_device_emf_win.cc @@ -211,6 +211,13 @@ void VectorPlatformDeviceEmf::drawRect(const SkDraw& draw, Cleanup(); } +void VectorPlatformDeviceEmf::drawRRect(const SkDraw& draw, const SkRRect& rr, + const SkPaint& paint) { + SkPath path; + path.addRRect(rr); + this->drawPath(draw, path, paint, NULL, true); +} + void VectorPlatformDeviceEmf::drawPath(const SkDraw& draw, const SkPath& path, const SkPaint& paint, diff --git a/skia/ext/vector_platform_device_emf_win.h b/skia/ext/vector_platform_device_emf_win.h index 61ea4413f345ed..df8315c4fc0069 100644 --- a/skia/ext/vector_platform_device_emf_win.h +++ b/skia/ext/vector_platform_device_emf_win.h @@ -42,6 +42,8 @@ class VectorPlatformDeviceEmf : public SkBitmapDevice, public PlatformDevice { const SkPaint& paint) OVERRIDE; virtual void drawRect(const SkDraw& draw, const SkRect& r, const SkPaint& paint) OVERRIDE; + virtual void drawRRect(const SkDraw&, const SkRRect& rr, + const SkPaint& paint) OVERRIDE; virtual void drawPath(const SkDraw& draw, const SkPath& path, const SkPaint& paint, const SkMatrix* prePathMatrix = NULL,