Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(333)

Unified Diff: src/core/SkDevice.cpp

Issue 773903002: implement device::clear until we can remove callers in chrome skia/ext (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkDevice.cpp
diff --git a/src/core/SkDevice.cpp b/src/core/SkDevice.cpp
index 570cea45e3d7b265d8ebddc364525fa63dacdca6..329ee33f5cb9a7ced9b08d1c20a5cec26741593f 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,
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698