aboutsummaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorGravatar reed <reed@google.com>2014-12-02 10:08:11 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2014-12-02 10:08:11 -0800
commit3729469d6a12266037b697c2192768545e097ab0 (patch)
tree3260a913c22c9cbf3a24e78ebfd45f1e73815e02 /include
parentcc969c4dd936c97670788395c9cbee3f346e87d1 (diff)
Change clear() to respect the clip
patch from issue 769703002 at patchset 1 (http://crrev.com/769703002#ps1) BUG=skia: Review URL: https://codereview.chromium.org/772533004
Diffstat (limited to 'include')
-rw-r--r--include/core/SkBitmapDevice.h5
-rw-r--r--include/core/SkCanvas.h22
-rw-r--r--include/core/SkDevice.h3
-rw-r--r--include/core/SkPicture.h2
-rw-r--r--include/pdf/SkPDFDevice.h2
-rw-r--r--include/utils/SkDeferredCanvas.h1
-rw-r--r--include/utils/SkNWayCanvas.h1
7 files changed, 8 insertions, 28 deletions
diff --git a/include/core/SkBitmapDevice.h b/include/core/SkBitmapDevice.h
index dff5e65bc8..03fd014d45 100644
--- a/include/core/SkBitmapDevice.h
+++ b/include/core/SkBitmapDevice.h
@@ -40,11 +40,6 @@ public:
protected:
bool onShouldDisableLCD(const SkPaint&) const SK_OVERRIDE;
- /** Clears the entire device to the specified color (including alpha).
- * Ignores the clip.
- */
- virtual void clear(SkColor color) SK_OVERRIDE;
-
/** These are called inside the per-device-layer loop for each draw call.
When these are called, we have already applied any saveLayer operations,
and are handling any looping from the paint, and any effects from the
diff --git a/include/core/SkCanvas.h b/include/core/SkCanvas.h
index 0685b6a8e6..ee539c4244 100644
--- a/include/core/SkCanvas.h
+++ b/include/core/SkCanvas.h
@@ -619,24 +619,12 @@ public:
@param color the color to draw with
@param mode the mode to apply the color in (defaults to SrcOver)
*/
- void drawColor(SkColor color,
- SkXfermode::Mode mode = SkXfermode::kSrcOver_Mode);
+ void drawColor(SkColor color, SkXfermode::Mode mode = SkXfermode::kSrcOver_Mode);
- /**
- * This erases the entire drawing surface to the specified color,
- * irrespective of the clip. It does not blend with the previous pixels,
- * but always overwrites them.
- *
- * It is roughly equivalent to the following:
- * canvas.save();
- * canvas.clipRect(hugeRect, kReplace_Op);
- * paint.setColor(color);
- * paint.setXfermodeMode(kSrc_Mode);
- * canvas.drawPaint(paint);
- * canvas.restore();
- * though it is almost always much more efficient.
- */
- virtual void clear(SkColor);
+ // TODO: remove virtual when chrome subclass stop overriding this.
+ virtual void clear(SkColor color) {
+ this->drawColor(color, SkXfermode::kSrc_Mode);
+ }
/**
* This makes the contents of the canvas undefined. Subsequent calls that
diff --git a/include/core/SkDevice.h b/include/core/SkDevice.h
index 3c26baca5b..f20ebf719a 100644
--- a/include/core/SkDevice.h
+++ b/include/core/SkDevice.h
@@ -163,8 +163,9 @@ protected:
/** Clears the entire device to the specified color (including alpha).
* Ignores the clip.
+ * DEPRECATED : will go away when chrome subclasses have been updated
*/
- virtual void clear(SkColor color) = 0;
+ virtual void clear(SkColor color);
SK_ATTR_DEPRECATED("use clear() instead")
void eraseColor(SkColor eraseColor) { this->clear(eraseColor); }
diff --git a/include/core/SkPicture.h b/include/core/SkPicture.h
index c63a201cd8..b3bdda1354 100644
--- a/include/core/SkPicture.h
+++ b/include/core/SkPicture.h
@@ -245,7 +245,7 @@ private:
// V34: Add SkTextBlob serialization.
// V35: Store SkRect (rather then width & height) in header
// V36: Remove (obsolete) alphatype from SkColorTable
- // V37: Added shadow only option to SkDropShadowImageFilter
+ // V37: Added shadow only option to SkDropShadowImageFilter (last version to record CLEAR)
// Note: If the picture version needs to be increased then please follow the
// steps to generate new SKPs in (only accessible to Googlers): http://goo.gl/qATVcw
diff --git a/include/pdf/SkPDFDevice.h b/include/pdf/SkPDFDevice.h
index 1e09b72b06..fa0e5128a6 100644
--- a/include/pdf/SkPDFDevice.h
+++ b/include/pdf/SkPDFDevice.h
@@ -70,8 +70,6 @@ public:
const SkMatrix& initialTransform);
SK_API virtual ~SkPDFDevice();
- virtual void clear(SkColor color) SK_OVERRIDE;
-
/** These are called inside the per-device-layer loop for each draw call.
When these are called, we have already applied any saveLayer operations,
and are handling any looping from the paint, and any effects from the
diff --git a/include/utils/SkDeferredCanvas.h b/include/utils/SkDeferredCanvas.h
index 69c8c3e5e6..ec5ea13b59 100644
--- a/include/utils/SkDeferredCanvas.h
+++ b/include/utils/SkDeferredCanvas.h
@@ -145,7 +145,6 @@ public:
// Overrides of the SkCanvas interface
virtual bool isDrawingToLayer() const SK_OVERRIDE;
- virtual void clear(SkColor) SK_OVERRIDE;
virtual void drawPaint(const SkPaint& paint) SK_OVERRIDE;
virtual void drawPoints(PointMode mode, size_t count, const SkPoint pts[],
const SkPaint& paint) SK_OVERRIDE;
diff --git a/include/utils/SkNWayCanvas.h b/include/utils/SkNWayCanvas.h
index a90f7d3dea..ec5d49afea 100644
--- a/include/utils/SkNWayCanvas.h
+++ b/include/utils/SkNWayCanvas.h
@@ -23,7 +23,6 @@ public:
///////////////////////////////////////////////////////////////////////////
// These are forwarded to the N canvases we're referencing
- virtual void clear(SkColor) SK_OVERRIDE;
virtual void drawPaint(const SkPaint& paint) SK_OVERRIDE;
virtual void drawPoints(PointMode mode, size_t count, const SkPoint pts[],
const SkPaint&) SK_OVERRIDE;