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

Unified Diff: src/image/SkSurface.cpp

Issue 14263017: Cleanup: Removing unnecessary args/complexity in SkSurface_Base and friends (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 8 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/SkCanvas.cpp ('k') | src/image/SkSurface_Base.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/image/SkSurface.cpp
===================================================================
--- src/image/SkSurface.cpp (revision 8683)
+++ src/image/SkSurface.cpp (working copy)
@@ -59,28 +59,27 @@
return fCachedImage;
}
-void SkSurface_Base::aboutToDraw(SkCanvas* canvas) {
+void SkSurface_Base::aboutToDraw() {
this->dirtyGenerationID();
- if (canvas) {
- SkASSERT(canvas == fCachedCanvas);
- SkASSERT(canvas->getSurfaceBase() == this);
- canvas->setSurfaceBase(NULL);
+ if (NULL == fCachedImage || NULL == fCachedCanvas) {
reed1 2013/04/16 16:04:14 Not sure we should do nothing if we have an image
Justin Novosad 2013/04/16 18:11:47 You're right I was completely ignoring that use ca
+ return;
}
- if (fCachedImage) {
- // the surface may need to fork its backend, if its sharing it with
- // the cached image. Note: we only call if there is an outstanding owner
- // on the image (besides us).
- if (fCachedImage->getRefCnt() > 1) {
- this->onCopyOnWrite(fCachedImage, canvas);
- }
+ SkASSERT(fCachedCanvas->getSurfaceBase() == this);
+ fCachedCanvas->setSurfaceBase(NULL);
- // regardless of copy-on-write, we must drop our cached image now, so
- // that the next request will get our new contents.
- fCachedImage->unref();
- fCachedImage = NULL;
+ // the surface may need to fork its backend, if its sharing it with
+ // the cached image. Note: we only call if there is an outstanding owner
+ // on the image (besides us).
+ if (fCachedImage->getRefCnt() > 1) {
+ this->onCopyOnWrite();
}
+
+ // regardless of copy-on-write, we must drop our cached image now, so
+ // that the next request will get our new contents.
+ fCachedImage->unref();
+ fCachedImage = NULL;
}
uint32_t SkSurface_Base::newGenerationID() {
@@ -110,7 +109,7 @@
}
void SkSurface::notifyContentChanged() {
- asSB(this)->aboutToDraw(NULL);
+ asSB(this)->aboutToDraw();
}
SkCanvas* SkSurface::getCanvas() {
« no previous file with comments | « src/core/SkCanvas.cpp ('k') | src/image/SkSurface_Base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698