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

Side by Side Diff: include/core/SkSurface.h

Issue 14063015: Adding optimization to avoid image copy in SkSurface copy on write when content is discardable (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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | src/core/SkCanvas.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_DEFINED 8 #ifndef SkSurface_DEFINED
9 #define SkSurface_DEFINED 9 #define SkSurface_DEFINED
10 10
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 * surface. Each time the content is changed changed, either by drawing 72 * surface. Each time the content is changed changed, either by drawing
73 * into this surface, or explicitly calling notifyContentChanged()) this 73 * into this surface, or explicitly calling notifyContentChanged()) this
74 * method will return a new value. 74 * method will return a new value.
75 * 75 *
76 * If this surface is empty (i.e. has a zero-dimention), this will return 76 * If this surface is empty (i.e. has a zero-dimention), this will return
77 * 0. 77 * 0.
78 */ 78 */
79 uint32_t generationID(); 79 uint32_t generationID();
80 80
81 /** 81 /**
82 * Call this if the contents have changed. This will (lazily) force a new 82 * Modes that can be passed to notifyContentWillChange
83 */
84 enum ContentChangeMode {
85 /**
86 * Use this mode if it is known that the upcoming content changes will
87 * clear or overwrite prior contents, thus making them discardable.
88 */
89 kDiscard_ContentChangeMode,
90 /**
91 * Use this mode if prior surface contents need to be preserved or
92 * if in doubt.
93 */
94 kRetain_ContentChangeMode,
95 };
96
97 /**
98 * Call this if the contents are about to change. This will (lazily) force a new
83 * value to be returned from generationID() when it is called next. 99 * value to be returned from generationID() when it is called next.
84 */ 100 */
85 void notifyContentChanged(); 101 void notifyContentWillChange(ContentChangeMode mode);
86 102
87 /** 103 /**
88 * Return a canvas that will draw into this surface. This will always 104 * Return a canvas that will draw into this surface. This will always
89 * return the same canvas for a given surface, and is manged/owned by the 105 * return the same canvas for a given surface, and is manged/owned by the
90 * surface. It should not be used when its parent surface has gone out of 106 * surface. It should not be used when its parent surface has gone out of
91 * scope. 107 * scope.
92 */ 108 */
93 SkCanvas* getCanvas(); 109 SkCanvas* getCanvas();
94 110
95 /** 111 /**
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 149
134 private: 150 private:
135 const int fWidth; 151 const int fWidth;
136 const int fHeight; 152 const int fHeight;
137 uint32_t fGenerationID; 153 uint32_t fGenerationID;
138 154
139 typedef SkRefCnt INHERITED; 155 typedef SkRefCnt INHERITED;
140 }; 156 };
141 157
142 #endif 158 #endif
OLDNEW
« no previous file with comments | « no previous file | src/core/SkCanvas.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698