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

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

Issue 872543002: Take budgeted param when snapping new image. (Closed) Base URL: https://skia.googlesource.com/skia.git@budgeted
Patch Set: Address comment and rebase Created 5 years, 11 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 | « gyp/gpu.gypi ('k') | src/image/SkImagePriv.h » ('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 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 * SkSurface* surfaceB = surfaceA->newSurface(...); 176 * SkSurface* surfaceB = surfaceA->newSurface(...);
177 * SkCanvas* canvasB = surfaceB->newCanvas(); 177 * SkCanvas* canvasB = surfaceB->newCanvas();
178 * ... // draw using canvasB 178 * ... // draw using canvasB
179 * canvasA->drawSurface(surfaceB); // <--- this will always be optimal! 179 * canvasA->drawSurface(surfaceB); // <--- this will always be optimal!
180 */ 180 */
181 SkSurface* newSurface(const SkImageInfo&); 181 SkSurface* newSurface(const SkImageInfo&);
182 182
183 /** 183 /**
184 * Returns an image of the current state of the surface pixels up to this 184 * Returns an image of the current state of the surface pixels up to this
185 * point. Subsequent changes to the surface (by drawing into its canvas) 185 * point. Subsequent changes to the surface (by drawing into its canvas)
186 * will not be reflected in this image. 186 * will not be reflected in this image. If a copy must be made the Budgeted
187 * parameter controls whether it counts against the resource budget
188 * (currently for the gpu backend only).
187 */ 189 */
188 SkImage* newImageSnapshot(); 190 SkImage* newImageSnapshot(Budgeted = kYes_Budgeted);
189 191
190 /** 192 /**
191 * Thought the caller could get a snapshot image explicitly, and draw that, 193 * Though the caller could get a snapshot image explicitly, and draw that,
192 * it seems that directly drawing a surface into another canvas might be 194 * it seems that directly drawing a surface into another canvas might be
193 * a common pattern, and that we could possibly be more efficient, since 195 * a common pattern, and that we could possibly be more efficient, since
194 * we'd know that the "snapshot" need only live until we've handed it off 196 * we'd know that the "snapshot" need only live until we've handed it off
195 * to the canvas. 197 * to the canvas.
196 */ 198 */
197 void draw(SkCanvas*, SkScalar x, SkScalar y, const SkPaint*); 199 void draw(SkCanvas*, SkScalar x, SkScalar y, const SkPaint*);
198 200
199 /** 201 /**
200 * If the surface has direct access to its pixels (i.e. they are in local 202 * If the surface has direct access to its pixels (i.e. they are in local
201 * RAM) return the const-address of those pixels, and if not null, return 203 * RAM) return the const-address of those pixels, and if not null, return
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 private: 245 private:
244 const SkSurfaceProps fProps; 246 const SkSurfaceProps fProps;
245 const int fWidth; 247 const int fWidth;
246 const int fHeight; 248 const int fHeight;
247 uint32_t fGenerationID; 249 uint32_t fGenerationID;
248 250
249 typedef SkRefCnt INHERITED; 251 typedef SkRefCnt INHERITED;
250 }; 252 };
251 253
252 #endif 254 #endif
OLDNEW
« no previous file with comments | « gyp/gpu.gypi ('k') | src/image/SkImagePriv.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698