aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar reed <reed@google.com>2014-12-02 12:53:04 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2014-12-02 12:53:05 -0800
commit252fccfb546efe83fb1d2c7a0b3c18a96ff46ea4 (patch)
treeb4968af09ed37b664ef71c932d5e4bab5a2396b1
parenta2a64672f302ba1e89154bb26767e63e7c1e944b (diff)
implement device::clear until we can remove callers in chrome skia/ext
BUG=skia: TBR= Review URL: https://codereview.chromium.org/773903002
-rw-r--r--src/core/SkDevice.cpp20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/core/SkDevice.cpp b/src/core/SkDevice.cpp
index 570cea45e3..329ee33f5c 100644
--- a/src/core/SkDevice.cpp
+++ b/src/core/SkDevice.cpp
@@ -10,6 +10,7 @@
#include "SkDraw.h"
#include "SkMetaData.h"
#include "SkPatchUtils.h"
+#include "SkRasterClip.h"
#include "SkShader.h"
#include "SkTextBlob.h"
@@ -92,7 +93,24 @@ 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");
+ SkPaint paint;
+ paint.setColor(color);
+ paint.setXfermodeMode(SkXfermode::kSrc_Mode);
+
+ SkMatrix matrix;
+ matrix.reset();
+
+ SkRasterClip rc(SkIRect::MakeWH(this->width(), this->height()));
+
+ SkDraw draw;
+ sk_bzero(&draw, sizeof(draw));
+
+ draw.fBitmap = &this->accessBitmap(true);
+ draw.fMatrix = &matrix;
+ draw.fClip = &rc.forceGetBW();
+ draw.fRC = &rc;
+ draw.fDevice = this;
+ this->drawPaint(draw, paint);
}
void SkBaseDevice::drawDRRect(const SkDraw& draw, const SkRRect& outer,