aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-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.h4
-rw-r--r--include/pdf/SkPDFDevice.h2
-rw-r--r--include/utils/SkDeferredCanvas.h1
-rw-r--r--include/utils/SkNWayCanvas.h1
-rw-r--r--src/core/SkBitmapDevice.cpp4
-rw-r--r--src/core/SkCanvas.cpp8
-rw-r--r--src/core/SkDevice.cpp5
-rw-r--r--src/core/SkPictureRecord.cpp8
-rw-r--r--src/core/SkPictureRecord.h1
-rw-r--r--src/core/SkRecordDraw.cpp3
-rw-r--r--src/core/SkRecordDraw.h29
-rw-r--r--src/core/SkRecorder.cpp4
-rw-r--r--src/core/SkRecorder.h1
-rw-r--r--src/core/SkRecords.h1
-rw-r--r--src/gpu/GrLayerHoister.cpp13
-rw-r--r--src/gpu/SkGpuDevice.cpp19
-rw-r--r--src/gpu/SkGpuDevice.h4
-rw-r--r--src/image/SkSurface_Gpu.cpp2
-rw-r--r--src/pdf/SkPDFDevice.cpp14
-rw-r--r--src/pipe/SkGPipeWrite.cpp15
-rw-r--r--src/utils/SkDeferredCanvas.cpp12
-rw-r--r--src/utils/SkGatherPixelRefsAndRects.h3
-rw-r--r--src/utils/SkNWayCanvas.cpp7
-rw-r--r--src/utils/SkPictureUtils.cpp4
-rw-r--r--src/utils/debugger/SkDebugCanvas.cpp4
-rw-r--r--src/utils/debugger/SkDebugCanvas.h2
-rw-r--r--tests/DeferredCanvasTest.cpp8
-rw-r--r--tests/RecordDrawTest.cpp26
31 files changed, 36 insertions, 199 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 962e70990d..dc5e32bffd 100644
--- a/include/core/SkDevice.h
+++ b/include/core/SkDevice.h
@@ -164,8 +164,9 @@ protected:
private:
/** 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);
public:
/** These are called inside the per-device-layer loop for each draw call.
diff --git a/include/core/SkPicture.h b/include/core/SkPicture.h
index 2c377b8c8e..f764d346cc 100644
--- a/include/core/SkPicture.h
+++ b/include/core/SkPicture.h
@@ -245,8 +245,8 @@ 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
- // Added PictureResolution and FilterLevel options to SkPictureImageFilter
+ // V37: Added shadow only option to SkDropShadowImageFilter (last version to record CLEAR)
+ // V37: Added PictureResolution and FilterLevel options to SkPictureImageFilter
// 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;
diff --git a/src/core/SkBitmapDevice.cpp b/src/core/SkBitmapDevice.cpp
index 9df7c9b655..020f1da13b 100644
--- a/src/core/SkBitmapDevice.cpp
+++ b/src/core/SkBitmapDevice.cpp
@@ -127,10 +127,6 @@ void SkBitmapDevice::unlockPixels() {
}
}
-void SkBitmapDevice::clear(SkColor color) {
- fBitmap.eraseColor(color);
-}
-
const SkBitmap& SkBitmapDevice::onAccessBitmap() {
return fBitmap;
}
diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp
index 25d15b450c..a6f263f517 100644
--- a/src/core/SkCanvas.cpp
+++ b/src/core/SkCanvas.cpp
@@ -1706,14 +1706,6 @@ void SkCanvas::drawDRRect(const SkRRect& outer, const SkRRect& inner,
// These are the virtual drawing methods
//////////////////////////////////////////////////////////////////////////////
-void SkCanvas::clear(SkColor color) {
- SkDrawIter iter(this);
- this->predrawNotify();
- while (iter.next()) {
- iter.fDevice->clear(color);
- }
-}
-
void SkCanvas::onDiscard() {
if (fSurfaceBase) {
fSurfaceBase->aboutToDraw(SkSurface::kDiscard_ContentChangeMode);
diff --git a/src/core/SkDevice.cpp b/src/core/SkDevice.cpp
index bc6c892079..570cea45e3 100644
--- a/src/core/SkDevice.cpp
+++ b/src/core/SkDevice.cpp
@@ -90,6 +90,11 @@ SkSurface* SkBaseDevice::newSurface(const SkImageInfo&, const SkSurfaceProps&) {
const void* SkBaseDevice::peekPixels(SkImageInfo*, size_t*) { return NULL; }
+// DEPRECATED : remove when chrome subclass have been updated to not override clear()
+void SkBaseDevice::clear(SkColor color) {
+ SkFAIL("SkDevice::clear() should not be called");
+}
+
void SkBaseDevice::drawDRRect(const SkDraw& draw, const SkRRect& outer,
const SkRRect& inner, const SkPaint& paint) {
SkPath path;
diff --git a/src/core/SkPictureRecord.cpp b/src/core/SkPictureRecord.cpp
index 0003658893..ac05e841d7 100644
--- a/src/core/SkPictureRecord.cpp
+++ b/src/core/SkPictureRecord.cpp
@@ -460,14 +460,6 @@ size_t SkPictureRecord::recordClipRegion(const SkRegion& region, SkRegion::Op op
return offset;
}
-void SkPictureRecord::clear(SkColor color) {
- // op + color
- size_t size = 2 * kUInt32Size;
- size_t initialOffset = this->addDraw(DRAW_CLEAR, &size);
- this->addInt(color);
- this->validate(initialOffset, size);
-}
-
void SkPictureRecord::drawPaint(const SkPaint& paint) {
// op + paint index
size_t size = 2 * kUInt32Size;
diff --git a/src/core/SkPictureRecord.h b/src/core/SkPictureRecord.h
index 8aee0a817a..2a3e4e1070 100644
--- a/src/core/SkPictureRecord.h
+++ b/src/core/SkPictureRecord.h
@@ -29,7 +29,6 @@ public:
SkPictureRecord(const SkISize& dimensions, uint32_t recordFlags);
virtual ~SkPictureRecord();
- virtual void clear(SkColor) SK_OVERRIDE;
virtual void drawPaint(const SkPaint& paint) SK_OVERRIDE;
virtual void drawPoints(PointMode, size_t count, const SkPoint pts[],
const SkPaint&) SK_OVERRIDE;
diff --git a/src/core/SkRecordDraw.cpp b/src/core/SkRecordDraw.cpp
index 47bafe3a2e..4443071f22 100644
--- a/src/core/SkRecordDraw.cpp
+++ b/src/core/SkRecordDraw.cpp
@@ -61,13 +61,12 @@ void SkRecordDraw(const SkRecord& record,
void SkRecordPartialDraw(const SkRecord& record, SkCanvas* canvas,
SkPicture const* const drawablePicts[], int drawableCount,
- const SkRect& clearRect,
unsigned start, unsigned stop,
const SkMatrix& initialCTM) {
SkAutoCanvasRestore saveRestore(canvas, true /*save now, restore at exit*/);
stop = SkTMin(stop, record.count());
- SkRecords::PartialDraw draw(canvas, NULL, 0, clearRect, initialCTM);
+ SkRecords::Draw draw(canvas, drawablePicts, NULL, drawableCount, &initialCTM);
for (unsigned i = start; i < stop; i++) {
record.visit<void>(i, draw);
}
diff --git a/src/core/SkRecordDraw.h b/src/core/SkRecordDraw.h
index e95123bbe6..509f5a6c72 100644
--- a/src/core/SkRecordDraw.h
+++ b/src/core/SkRecordDraw.h
@@ -29,15 +29,14 @@ void SkRecordDraw(const SkRecord&, SkCanvas*, SkPicture const* const drawablePic
SkCanvasDrawable* const drawables[], int drawableCount,
const SkBBoxHierarchy*, SkDrawPictureCallback*);
-// Draw a portion of an SkRecord into an SkCanvas while replacing clears with drawRects.
+// Draw a portion of an SkRecord into an SkCanvas.
// When drawing a portion of an SkRecord the CTM on the passed in canvas must be
// the composition of the replay matrix with the record-time CTM (for the portion
// of the record that is being replayed). For setMatrix calls to behave correctly
// the initialCTM parameter must set to just the replay matrix.
void SkRecordPartialDraw(const SkRecord&, SkCanvas*,
SkPicture const* const drawablePicts[], int drawableCount,
- const SkRect&, unsigned start, unsigned stop,
- const SkMatrix& initialCTM);
+ unsigned start, unsigned stop, const SkMatrix& initialCTM);
namespace SkRecords {
@@ -76,30 +75,6 @@ private:
int fDrawableCount;
};
-// Used by SkRecordPartialDraw.
-class PartialDraw : public Draw {
-public:
- PartialDraw(SkCanvas* canvas, SkPicture const* const drawablePicts[], int drawableCount,
- const SkRect& clearRect, const SkMatrix& initialCTM)
- : INHERITED(canvas, drawablePicts, NULL, drawableCount, &initialCTM), fClearRect(clearRect)
- {}
-
- // Same as Draw for all ops except Clear.
- template <typename T> void operator()(const T& r) {
- this->INHERITED::operator()(r);
- }
- void operator()(const Clear& c) {
- SkPaint p;
- p.setColor(c.color);
- DrawRect drawRect(p, fClearRect);
- this->INHERITED::operator()(drawRect);
- }
-
-private:
- const SkRect fClearRect;
- typedef Draw INHERITED;
-};
-
} // namespace SkRecords
#endif//SkRecordDraw_DEFINED
diff --git a/src/core/SkRecorder.cpp b/src/core/SkRecorder.cpp
index 5ba43099b7..04da7c440c 100644
--- a/src/core/SkRecorder.cpp
+++ b/src/core/SkRecorder.cpp
@@ -118,10 +118,6 @@ char* SkRecorder::copy(const char* src) {
}
-void SkRecorder::clear(SkColor color) {
- APPEND(Clear, color);
-}
-
void SkRecorder::drawPaint(const SkPaint& paint) {
APPEND(DrawPaint, delay_copy(paint));
}
diff --git a/src/core/SkRecorder.h b/src/core/SkRecorder.h
index be67dddd2e..ff5c9ed96c 100644
--- a/src/core/SkRecorder.h
+++ b/src/core/SkRecorder.h
@@ -45,7 +45,6 @@ public:
// Make SkRecorder forget entirely about its SkRecord*; all calls to SkRecorder will fail.
void forgetRecord();
- void clear(SkColor) SK_OVERRIDE;
void drawPaint(const SkPaint& paint) SK_OVERRIDE;
void drawPoints(PointMode mode,
size_t count,
diff --git a/src/core/SkRecords.h b/src/core/SkRecords.h
index 00332c341c..046626af4b 100644
--- a/src/core/SkRecords.h
+++ b/src/core/SkRecords.h
@@ -234,6 +234,7 @@ RECORD3(ClipRRect, SkIRect, devBounds, SkRRect, rrect, RegionOpAndAA, opAA);
RECORD3(ClipRect, SkIRect, devBounds, SkRect, rect, RegionOpAndAA, opAA);
RECORD3(ClipRegion, SkIRect, devBounds, SkRegion, region, SkRegion::Op, op);
+// Picture version 37 was last to record this op-code; clear is now non-virtual
RECORD1(Clear, SkColor, color);
RECORD1(BeginCommentGroup, PODArray<char>, description);
diff --git a/src/gpu/GrLayerHoister.cpp b/src/gpu/GrLayerHoister.cpp
index a17c7ddf97..5d2d5493b4 100644
--- a/src/gpu/GrLayerHoister.cpp
+++ b/src/gpu/GrLayerHoister.cpp
@@ -193,10 +193,6 @@ void GrLayerHoister::DrawLayersToAtlas(GrContext* context,
SkCanvas* atlasCanvas = surface->getCanvas();
- SkPaint clearPaint;
- clearPaint.setColor(SK_ColorTRANSPARENT);
- clearPaint.setXfermode(SkXfermode::Create(SkXfermode::kSrc_Mode))->unref();
-
for (int i = 0; i < atlased.count(); ++i) {
const GrCachedLayer* layer = atlased[i].fLayer;
const SkPicture* pict = atlased[i].fPicture;
@@ -211,9 +207,7 @@ void GrLayerHoister::DrawLayersToAtlas(GrContext* context,
// extend beyond the boundaries of the atlased sub-rect
const SkRect bound = SkRect::Make(layer->rect());
atlasCanvas->clipRect(bound);
-
- // Since 'clear' doesn't respect the clip we need to draw a rect
- atlasCanvas->drawRect(bound, clearPaint);
+ atlasCanvas->clear(0);
// '-offset' maps the layer's top/left to the origin.
// Since this layer is atlased, the top/left corner needs
@@ -228,7 +222,7 @@ void GrLayerHoister::DrawLayersToAtlas(GrContext* context,
SkRecordPartialDraw(*pict->fRecord.get(), atlasCanvas,
pict->drawablePicts(), pict->drawableCount(),
- bound, layer->start() + 1, layer->stop(), initialCTM);
+ layer->start() + 1, layer->stop(), initialCTM);
atlasCanvas->restore();
}
@@ -255,7 +249,6 @@ void GrLayerHoister::DrawLayers(GrContext* context, const SkTDArray<GrHoistedLay
// extend beyond the boundaries of the layer
const SkRect bound = SkRect::Make(layer->rect());
layerCanvas->clipRect(bound);
-
layerCanvas->clear(SK_ColorTRANSPARENT);
SkMatrix initialCTM;
@@ -267,7 +260,7 @@ void GrLayerHoister::DrawLayers(GrContext* context, const SkTDArray<GrHoistedLay
SkRecordPartialDraw(*pict->fRecord.get(), layerCanvas,
pict->drawablePicts(), pict->drawableCount(),
- bound, layer->start()+1, layer->stop(), initialCTM);
+ layer->start()+1, layer->stop(), initialCTM);
layerCanvas->flush();
}
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp
index 407f36037d..f09ebf291f 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -68,7 +68,7 @@ enum { kDefaultImageFilterCacheSize = 32 * 1024 * 1024 };
#define DO_DEFERRED_CLEAR() \
do { \
if (fFlags & kNeedClear_Flag) { \
- this->clear(SK_ColorTRANSPARENT); \
+ this->clearAll(); \
} \
} while (false) \
@@ -294,6 +294,14 @@ GrRenderTarget* SkGpuDevice::accessRenderTarget() {
return fRenderTarget;
}
+void SkGpuDevice::clearAll() {
+ GrColor color = 0;
+ GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice::clearAll", fContext);
+ SkIRect rect = SkIRect::MakeWH(this->width(), this->height());
+ fContext->clear(&rect, color, true, fRenderTarget);
+ fFlags &= ~kNeedClear_Flag;
+}
+
///////////////////////////////////////////////////////////////////////////////
SK_COMPILE_ASSERT(SkShader::kNone_BitmapType == 0, shader_type_mismatch);
@@ -309,13 +317,6 @@ SK_COMPILE_ASSERT(SkShader::kLast_BitmapType == 6, shader_type_mismatch);
///////////////////////////////////////////////////////////////////////////////
-void SkGpuDevice::clear(SkColor color) {
- GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice::clear", fContext);
- SkIRect rect = SkIRect::MakeWH(this->width(), this->height());
- fContext->clear(&rect, SkColor2GrColor(color), true, fRenderTarget);
- fFlags &= ~kNeedClear_Flag;
-}
-
void SkGpuDevice::drawPaint(const SkDraw& draw, const SkPaint& paint) {
CHECK_SHOULD_DRAW(draw, false);
GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice::drawPaint", fContext);
@@ -1514,7 +1515,7 @@ void SkGpuDevice::drawDevice(const SkDraw& draw, SkBaseDevice* device,
SkGpuDevice* dev = static_cast<SkGpuDevice*>(device);
if (dev->fFlags & kNeedClear_Flag) {
// TODO: could check here whether we really need to draw at all
- dev->clear(0x0);
+ dev->clearAll();
}
// drawDevice is defined to be in device coords.
diff --git a/src/gpu/SkGpuDevice.h b/src/gpu/SkGpuDevice.h
index f7088e3fa3..2fb6de7eb8 100644
--- a/src/gpu/SkGpuDevice.h
+++ b/src/gpu/SkGpuDevice.h
@@ -65,13 +65,15 @@ public:
GrContext* context() const { return fContext; }
+ // set all pixels to 0
+ void clearAll();
+
virtual GrRenderTarget* accessRenderTarget() SK_OVERRIDE;
virtual SkImageInfo imageInfo() const SK_OVERRIDE {
return fRenderTarget ? fRenderTarget->surfacePriv().info() : SkImageInfo::MakeUnknown();
}
- virtual void clear(SkColor color) SK_OVERRIDE;
virtual void drawPaint(const SkDraw&, const SkPaint& paint) SK_OVERRIDE;
virtual void drawPoints(const SkDraw&, SkCanvas::PointMode mode, size_t count,
const SkPoint[], const SkPaint& paint) SK_OVERRIDE;
diff --git a/src/image/SkSurface_Gpu.cpp b/src/image/SkSurface_Gpu.cpp
index 9ac6d55340..848709445d 100644
--- a/src/image/SkSurface_Gpu.cpp
+++ b/src/image/SkSurface_Gpu.cpp
@@ -44,7 +44,7 @@ SkSurface_Gpu::SkSurface_Gpu(GrRenderTarget* renderTarget, const SkSurfaceProps*
fDevice = SkGpuDevice::Create(renderTarget, this->props(), deviceFlags);
if (kRGB_565_GrPixelConfig != renderTarget->config() && doClear) {
- fDevice->clear(0x0);
+ fDevice->clearAll();
}
}
diff --git a/src/pdf/SkPDFDevice.cpp b/src/pdf/SkPDFDevice.cpp
index fb8df838eb..6592ba0c68 100644
--- a/src/pdf/SkPDFDevice.cpp
+++ b/src/pdf/SkPDFDevice.cpp
@@ -801,20 +801,6 @@ void SkPDFDevice::cleanUp(bool clearFontUsage) {
}
}
-void SkPDFDevice::clear(SkColor color) {
- this->cleanUp(true);
- this->init();
-
- SkPaint paint;
- paint.setColor(color);
- paint.setStyle(SkPaint::kFill_Style);
- SkMatrix identity;
- identity.reset();
- ScopedContentEntry content(this, &fExistingClipStack, fExistingClipRegion,
- identity, paint);
- internalDrawPaint(paint, content.entry());
-}
-
void SkPDFDevice::drawPaint(const SkDraw& d, const SkPaint& paint) {
SkPaint newPaint = paint;
newPaint.setStyle(SkPaint::kFill_Style);
diff --git a/src/pipe/SkGPipeWrite.cpp b/src/pipe/SkGPipeWrite.cpp
index 41b0234480..a5af6c7111 100644
--- a/src/pipe/SkGPipeWrite.cpp
+++ b/src/pipe/SkGPipeWrite.cpp
@@ -233,7 +233,6 @@ public:
// overrides from SkCanvas
virtual bool isDrawingToLayer() const SK_OVERRIDE;
- virtual void clear(SkColor) SK_OVERRIDE;
virtual void drawPaint(const SkPaint& paint) SK_OVERRIDE;
virtual void drawPoints(PointMode, size_t count, const SkPoint pts[],
const SkPaint&) SK_OVERRIDE;
@@ -690,20 +689,6 @@ void SkGPipeCanvas::onClipRegion(const SkRegion& region, SkRegion::Op rgnOp) {
///////////////////////////////////////////////////////////////////////////////
-void SkGPipeCanvas::clear(SkColor color) {
- NOTIFY_SETUP(this);
- unsigned flags = 0;
- if (color) {
- flags |= kClear_HasColor_DrawOpFlag;
- }
- if (this->needOpBytes(sizeof(SkColor))) {
- this->writeOp(kDrawClear_DrawOp, flags, 0);
- if (color) {
- fWriter.write32(color);
- }
- }
-}
-
void SkGPipeCanvas::drawPaint(const SkPaint& paint) {
NOTIFY_SETUP(this);
this->writePaint(paint);
diff --git a/src/utils/SkDeferredCanvas.cpp b/src/utils/SkDeferredCanvas.cpp
index 3c845b1d65..34b9146996 100644
--- a/src/utils/SkDeferredCanvas.cpp
+++ b/src/utils/SkDeferredCanvas.cpp
@@ -170,8 +170,6 @@ protected:
// None of the following drawing methods should ever get called on the
// deferred device
- virtual void clear(SkColor color) SK_OVERRIDE
- {SkASSERT(0);}
virtual void drawPaint(const SkDraw&, const SkPaint& paint) SK_OVERRIDE
{SkASSERT(0);}
virtual void drawPoints(const SkDraw&, SkCanvas::PointMode mode,
@@ -741,16 +739,6 @@ void SkDeferredCanvas::onClipRegion(const SkRegion& deviceRgn, SkRegion::Op op)
this->recordedDrawCommand();
}
-void SkDeferredCanvas::clear(SkColor color) {
- // purge pending commands
- if (fDeferredDrawing) {
- this->getDeferredDevice()->skipPendingCommands();
- }
-
- this->drawingCanvas()->clear(color);
- this->recordedDrawCommand();
-}
-
void SkDeferredCanvas::drawPaint(const SkPaint& paint) {
if (fDeferredDrawing && this->isFullFrame(NULL, &paint) &&
isPaintOpaque(&paint)) {
diff --git a/src/utils/SkGatherPixelRefsAndRects.h b/src/utils/SkGatherPixelRefsAndRects.h
index 4eeb56c14c..6e11fbe6d5 100644
--- a/src/utils/SkGatherPixelRefsAndRects.h
+++ b/src/utils/SkGatherPixelRefsAndRects.h
@@ -40,9 +40,6 @@ public:
}
protected:
- virtual void clear(SkColor color) SK_OVERRIDE {
- NothingToDo();
- }
virtual void drawPaint(const SkDraw& draw, const SkPaint& paint) SK_OVERRIDE {
SkBitmap bm;
diff --git a/src/utils/SkNWayCanvas.cpp b/src/utils/SkNWayCanvas.cpp
index a6722d8364..ddd9b927fd 100644
--- a/src/utils/SkNWayCanvas.cpp
+++ b/src/utils/SkNWayCanvas.cpp
@@ -134,13 +134,6 @@ void SkNWayCanvas::onClipRegion(const SkRegion& deviceRgn, SkRegion::Op op) {
this->INHERITED::onClipRegion(deviceRgn, op);
}
-void SkNWayCanvas::clear(SkColor color) {
- Iter iter(fList);
- while (iter.next()) {
- iter->clear(color);
- }
-}
-
void SkNWayCanvas::drawPaint(const SkPaint& paint) {
Iter iter(fList);
while (iter.next()) {
diff --git a/src/utils/SkPictureUtils.cpp b/src/utils/SkPictureUtils.cpp
index 7f9409adac..2c6b8f56b5 100644
--- a/src/utils/SkPictureUtils.cpp
+++ b/src/utils/SkPictureUtils.cpp
@@ -77,10 +77,6 @@ public:
return false;
}
- virtual void clear(SkColor color) SK_OVERRIDE {
- nothing_to_do();
- }
-
virtual void drawPaint(const SkDraw&, const SkPaint& paint) SK_OVERRIDE {
this->addBitmapFromPaint(paint);
}
diff --git a/src/utils/debugger/SkDebugCanvas.cpp b/src/utils/debugger/SkDebugCanvas.cpp
index 95256e7d13..787cf89299 100644
--- a/src/utils/debugger/SkDebugCanvas.cpp
+++ b/src/utils/debugger/SkDebugCanvas.cpp
@@ -426,10 +426,6 @@ void SkDebugCanvas::overrideTexFiltering(bool overrideTexFiltering, SkPaint::Fil
fTexOverrideFilter->setFilterLevel(level);
}
-void SkDebugCanvas::clear(SkColor color) {
- this->addDrawCommand(new SkClearCommand(color));
-}
-
void SkDebugCanvas::onClipPath(const SkPath& path, SkRegion::Op op, ClipEdgeStyle edgeStyle) {
this->addDrawCommand(new SkClipPathCommand(path, op, kSoft_ClipEdgeStyle == edgeStyle));
}
diff --git a/src/utils/debugger/SkDebugCanvas.h b/src/utils/debugger/SkDebugCanvas.h
index bdd04aa2db..2c079bd4c3 100644
--- a/src/utils/debugger/SkDebugCanvas.h
+++ b/src/utils/debugger/SkDebugCanvas.h
@@ -158,8 +158,6 @@ public:
// Inherited from SkCanvas
////////////////////////////////////////////////////////////////////////////////
- virtual void clear(SkColor) SK_OVERRIDE;
-
virtual void drawBitmap(const SkBitmap&, SkScalar left, SkScalar top,
const SkPaint*) SK_OVERRIDE;
diff --git a/tests/DeferredCanvasTest.cpp b/tests/DeferredCanvasTest.cpp
index da2d6b9dd3..043fe33557 100644
--- a/tests/DeferredCanvasTest.cpp
+++ b/tests/DeferredCanvasTest.cpp
@@ -284,14 +284,6 @@ static void TestDeferredCanvasFreshFrame(skiatest::Reporter* reporter) {
canvas->restore();
REPORTER_ASSERT(reporter, !canvas->isFreshFrame());
- // Verify that a clear with clipping triggers a fresh frame
- // (clear is not affected by clipping)
- canvas->save();
- canvas->clipRect(partialRect, SkRegion::kIntersect_Op, false);
- canvas->clear(0x00000000);
- canvas->restore();
- REPORTER_ASSERT(reporter, canvas->isFreshFrame());
-
// Verify that full frame rects with different forms of opaque paint
// trigger frames to be marked as fresh
{
diff --git a/tests/RecordDrawTest.cpp b/tests/RecordDrawTest.cpp
index 48981ef0a2..30be24c28a 100644
--- a/tests/RecordDrawTest.cpp
+++ b/tests/RecordDrawTest.cpp
@@ -191,7 +191,7 @@ DEF_TEST(RecordDraw_PartialStartStop, r) {
SkRecord rerecord;
SkRecorder canvas(&rerecord, kWidth, kHeight);
- SkRecordPartialDraw(record, &canvas, NULL, 0, r1, 1, 2, SkMatrix::I()); // replay just drawRect of r2
+ SkRecordPartialDraw(record, &canvas, NULL, 0, 1, 2, SkMatrix::I()); // replay just drawRect of r2
REPORTER_ASSERT(r, 3 == rerecord.count());
assert_type<SkRecords::Save> (r, rerecord, 0);
@@ -202,30 +202,6 @@ DEF_TEST(RecordDraw_PartialStartStop, r) {
REPORTER_ASSERT(r, drawRect->rect == r2);
}
-// Check that clears are converted to drawRects
-DEF_TEST(RecordDraw_PartialClear, r) {
- static const int kWidth = 10, kHeight = 10;
-
- SkRect rect = { 0, 0, kWidth, kHeight };
-
- SkRecord record;
- SkRecorder recorder(&record, kWidth, kHeight);
- recorder.clear(SK_ColorRED);
-
- SkRecord rerecord;
- SkRecorder canvas(&rerecord, kWidth, kHeight);
- SkRecordPartialDraw(record, &canvas, NULL, 0, rect, 0, 1, SkMatrix::I()); // replay just the clear
-
- REPORTER_ASSERT(r, 3 == rerecord.count());
- assert_type<SkRecords::Save> (r, rerecord, 0);
- assert_type<SkRecords::DrawRect>(r, rerecord, 1);
- assert_type<SkRecords::Restore> (r, rerecord, 2);
-
- const SkRecords::DrawRect* drawRect = assert_type<SkRecords::DrawRect>(r, rerecord, 1);
- REPORTER_ASSERT(r, drawRect->rect == rect);
- REPORTER_ASSERT(r, drawRect->paint.getColor() == SK_ColorRED);
-}
-
// A regression test for crbug.com/415468 and skbug.com/2957.
//
// This also now serves as a regression test for crbug.com/418417. We used to adjust the