Override drawRRect in fake SkBitmapDevices.

Recent changes to SkBitmapDevice modified ::drawRRect() to take
an optimized drawing case. 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.

R=reed@google.com, robertphillips@google.com

Review URL: https://codereview.chromium.org/70443002

git-svn-id: http://skia.googlecode.com/svn/trunk@12247 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
scroggo@google.com 2013-11-12 17:10:02 +00:00
parent f14bcd25e5
commit cac8d01eab
4 changed files with 22 additions and 0 deletions

View File

@ -85,6 +85,11 @@ protected:
const SkRect& r,
const SkPaint& paint) SK_OVERRIDE;
virtual void drawRRect(
const SkDraw&,
const SkRRect&,
const SkPaint& paint) SK_OVERRIDE;
virtual void drawPath(
const SkDraw&,
const SkPath& platonicPath,

View File

@ -1203,6 +1203,14 @@ void SkXPSDevice::drawRect(const SkDraw& d,
this->internalDrawRect(d, r, true, paint);
}
void SkXPSDevice::drawRRect(const SkDraw& d,
const SkRRect& rr,
const SkPaint& paint) {
SkPath path;
path.addRRect(rr);
this->drawPath(d, path, paint, NULL, true);
}
void SkXPSDevice::internalDrawRect(const SkDraw& d,
const SkRect& r,
bool transformRect,

View File

@ -137,6 +137,7 @@ void DeferredPipeController::playback(bool silent) {
//-----------------------------------------------------------------------------
// DeferredDevice
//-----------------------------------------------------------------------------
// FIXME: Derive from SkBaseDevice.
class DeferredDevice : public SkBitmapDevice {
public:
explicit DeferredDevice(SkBaseDevice* immediateDevice);
@ -197,6 +198,9 @@ protected:
virtual void drawRect(const SkDraw&, const SkRect& r,
const SkPaint& paint) SK_OVERRIDE
{SkASSERT(0);}
virtual void drawRRect(const SkDraw&, const SkRRect& rr,
const SkPaint& paint) SK_OVERRIDE
{SkASSERT(0);}
virtual void drawPath(const SkDraw&, const SkPath& path,
const SkPaint& paint,
const SkMatrix* prePathMatrix = NULL,

View File

@ -46,6 +46,7 @@ static void nothing_to_do() {}
* This device will route all bitmaps (primitives and in shaders) to its PRSet.
* It should never actually draw anything, so there need not be any pixels
* behind its device-bitmap.
* FIXME: Derive from SkBaseDevice.
*/
class GatherPixelRefDevice : public SkBitmapDevice {
private:
@ -93,6 +94,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);