diff options
author | reed <reed@google.com> | 2014-12-02 12:53:04 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-12-02 12:53:05 -0800 |
commit | 252fccfb546efe83fb1d2c7a0b3c18a96ff46ea4 (patch) | |
tree | b4968af09ed37b664ef71c932d5e4bab5a2396b1 /src | |
parent | a2a64672f302ba1e89154bb26767e63e7c1e944b (diff) |
implement device::clear until we can remove callers in chrome skia/ext
BUG=skia:
TBR=
Review URL: https://codereview.chromium.org/773903002
Diffstat (limited to 'src')
-rw-r--r-- | src/core/SkDevice.cpp | 20 |
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, |