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

Side by Side Diff: src/image/SkSurface_Base.h

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 unified diff | Download patch
« no previous file with comments | « src/image/SkSurface.cpp ('k') | src/image/SkSurface_Gpu.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2012 Google Inc. 2 * Copyright 2012 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #ifndef SkSurface_Base_DEFINED 8 #ifndef SkSurface_Base_DEFINED
9 #define SkSurface_Base_DEFINED 9 #define SkSurface_Base_DEFINED
10 10
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 * being shared with the cachedImage. 59 * being shared with the cachedImage.
60 */ 60 */
61 virtual void onCopyOnWrite(ContentChangeMode) = 0; 61 virtual void onCopyOnWrite(ContentChangeMode) = 0;
62 62
63 inline SkCanvas* getCachedCanvas(); 63 inline SkCanvas* getCachedCanvas();
64 inline SkImage* getCachedImage(Budgeted); 64 inline SkImage* getCachedImage(Budgeted);
65 65
66 // called by SkSurface to compute a new genID 66 // called by SkSurface to compute a new genID
67 uint32_t newGenerationID(); 67 uint32_t newGenerationID();
68 68
69 void aboutToDraw(ContentChangeMode mode);
70
69 private: 71 private:
70 SkCanvas* fCachedCanvas; 72 SkCanvas* fCachedCanvas;
71 SkImage* fCachedImage; 73 SkImage* fCachedImage;
72 74
73 void aboutToDraw(ContentChangeMode mode);
74 friend class SkCanvas;
75 friend class SkSurface; 75 friend class SkSurface;
76
77 typedef SkSurface INHERITED; 76 typedef SkSurface INHERITED;
78 }; 77 };
79 78
80 SkCanvas* SkSurface_Base::getCachedCanvas() { 79 SkCanvas* SkSurface_Base::getCachedCanvas() {
81 if (NULL == fCachedCanvas) { 80 if (NULL == fCachedCanvas) {
82 fCachedCanvas = this->onNewCanvas(); 81 fCachedCanvas = this->onNewCanvas();
83 if (fCachedCanvas) {
84 fCachedCanvas->setSurfaceBase(this);
85 }
86 } 82 }
87 return fCachedCanvas; 83 return fCachedCanvas;
88 } 84 }
89 85
90 SkImage* SkSurface_Base::getCachedImage(Budgeted budgeted) { 86 SkImage* SkSurface_Base::getCachedImage(Budgeted budgeted) {
91 if (NULL == fCachedImage) { 87 if (NULL == fCachedImage) {
92 fCachedImage = this->onNewImageSnapshot(budgeted); 88 fCachedImage = this->onNewImageSnapshot(budgeted);
93 SkASSERT(!fCachedCanvas || fCachedCanvas->getSurfaceBase() == this);
94 } 89 }
95 return fCachedImage; 90 return fCachedImage;
96 } 91 }
97 92
98 #endif 93 #endif
OLDNEW
« no previous file with comments | « src/image/SkSurface.cpp ('k') | src/image/SkSurface_Gpu.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698