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

Unified Diff: src/core/SkCanvas.cpp

Issue 926843003: Move canvas->surface association to the device subclasses (Closed) Base URL: https://skia.googlesource.com/skia.git@skimage-filters-03-sksurface-set-root-device-simple
Patch Set: Created 5 years, 10 months 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 | « src/core/SkBitmapDevice.cpp ('k') | src/core/SkPictureRecord.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkCanvas.cpp
diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp
index 221ed93ac8c20122ebe47b1c6dccce8defcc3fb9..a8666c46864e8be5fff81058fb81063018b9354b 100644
--- a/src/core/SkCanvas.cpp
+++ b/src/core/SkCanvas.cpp
@@ -78,12 +78,6 @@ bool SkCanvas::Internal_Private_GetTreatSpriteAsBitmap() {
typedef SkTLazy<SkPaint> SkLazyPaint;
-void SkCanvas::predrawNotify() {
- if (fSurfaceBase) {
- fSurfaceBase->aboutToDraw(SkSurface::kRetain_ContentChangeMode);
- }
-}
-
///////////////////////////////////////////////////////////////////////////////
static uint32_t filter_paint_flags(const SkSurfaceProps& props, uint32_t flags) {
@@ -409,13 +403,11 @@ bool AutoDrawLooper::doNext(SkDrawFilter::Type drawType) {
////////// macros to place around the internal draw calls //////////////////
#define LOOPER_BEGIN_DRAWDEVICE(paint, type) \
- this->predrawNotify(); \
AutoDrawLooper looper(this, fProps, paint, true); \
while (looper.next(type)) { \
SkDrawIter iter(this);
#define LOOPER_BEGIN(paint, type, bounds) \
- this->predrawNotify(); \
AutoDrawLooper looper(this, fProps, paint, false, bounds); \
while (looper.next(type)) { \
SkDrawIter iter(this);
@@ -440,8 +432,6 @@ SkBaseDevice* SkCanvas::init(SkBaseDevice* device, InitFlags flags) {
fMCRec->fLayer = SkNEW_ARGS(DeviceCM, (NULL, 0, 0, NULL, NULL, fConservativeRasterClip));
fMCRec->fTopLayer = fMCRec->fLayer;
- fSurfaceBase = NULL;
-
fClipStack.reset(SkNEW(SkClipStack));
if (device) {
@@ -717,9 +707,6 @@ bool SkCanvas::writePixels(const SkImageInfo& origInfo, const void* pixels, size
// here x,y are either 0 or negative
pixels = ((const char*)pixels - y * rowBytes - x * info.bytesPerPixel());
- // Tell our owning surface to bump its generation ID
- this->predrawNotify();
-
// The device can assert that the requested area is always contained in its bounds
return device->writePixels(info, pixels, rowBytes, target.x(), target.y());
}
@@ -1665,8 +1652,8 @@ void SkCanvas::drawSprite(const SkBitmap& bitmap, int left, int top, const SkPai
//////////////////////////////////////////////////////////////////////////////
void SkCanvas::onDiscard() {
- if (fSurfaceBase) {
- fSurfaceBase->aboutToDraw(SkSurface::kDiscard_ContentChangeMode);
+ if (this->getDevice()) {
+ this->getDevice()->discard();
}
}
« no previous file with comments | « src/core/SkBitmapDevice.cpp ('k') | src/core/SkPictureRecord.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698