Skip to content

Commit

Permalink
Override drawRRect in fake SkBitmapDevices.
Browse files Browse the repository at this point in the history
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
  • Loading branch information
scroggo@google.com committed Nov 13, 2013
1 parent a314611 commit bf4f0e2
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 0 deletions.
10 changes: 10 additions & 0 deletions skia/ext/analysis_canvas.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
3 changes: 3 additions & 0 deletions skia/ext/analysis_canvas.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
7 changes: 7 additions & 0 deletions skia/ext/vector_platform_device_emf_win.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 2 additions & 0 deletions skia/ext/vector_platform_device_emf_win.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit bf4f0e2

Please sign in to comment.