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

Side by Side Diff: include/utils/SkDeferredCanvas.h

Issue 545813002: Picture Recording: fix the performance bottleneck in SkDeferredCanvas::isFullFrame (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: a small fix for memory leak in unit test Created 6 years, 3 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 | « no previous file | src/utils/SkDeferredCanvas.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 SkDeferredCanvas_DEFINED 8 #ifndef SkDeferredCanvas_DEFINED
9 #define SkDeferredCanvas_DEFINED 9 #define SkDeferredCanvas_DEFINED
10 10
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 * of the previous frame. For example, if a canvas is cleared before 82 * of the previous frame. For example, if a canvas is cleared before
83 * drawing each frame, the frames will all be considered fresh. 83 * drawing each frame, the frames will all be considered fresh.
84 * A frame is defined as the graphics image produced by as a result 84 * A frame is defined as the graphics image produced by as a result
85 * of all the canvas draws operation executed between two successive 85 * of all the canvas draws operation executed between two successive
86 * calls to isFreshFrame. The result of isFreshFrame is computed 86 * calls to isFreshFrame. The result of isFreshFrame is computed
87 * conservatively, so it may report false negatives. 87 * conservatively, so it may report false negatives.
88 */ 88 */
89 bool isFreshFrame() const; 89 bool isFreshFrame() const;
90 90
91 /** 91 /**
92 * Returns canvas's size.
93 */
94 SkISize getCanvasSize() const;
95
96 /**
92 * Returns true if the canvas has recorded draw commands that have 97 * Returns true if the canvas has recorded draw commands that have
93 * not yet been played back. 98 * not yet been played back.
94 */ 99 */
95 bool hasPendingCommands() const; 100 bool hasPendingCommands() const;
96 101
97 /** 102 /**
98 * Flushes pending draw commands, if any, and returns an image of the 103 * Flushes pending draw commands, if any, and returns an image of the
99 * current state of the surface pixels up to this point. Subsequent 104 * current state of the surface pixels up to this point. Subsequent
100 * changes to the surface (by drawing into its canvas) will not be 105 * changes to the surface (by drawing into its canvas) will not be
101 * reflected in this image. Will return NULL if the deferred canvas 106 * reflected in this image. Will return NULL if the deferred canvas
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 void recordedDrawCommand(); 248 void recordedDrawCommand();
244 SkCanvas* drawingCanvas() const; 249 SkCanvas* drawingCanvas() const;
245 SkCanvas* immediateCanvas() const; 250 SkCanvas* immediateCanvas() const;
246 bool isFullFrame(const SkRect*, const SkPaint*) const; 251 bool isFullFrame(const SkRect*, const SkPaint*) const;
247 void validate() const; 252 void validate() const;
248 void init(); 253 void init();
249 254
250 size_t fBitmapSizeThreshold; 255 size_t fBitmapSizeThreshold;
251 bool fDeferredDrawing; 256 bool fDeferredDrawing;
252 257
258 mutable SkISize fCachedCanvasSize;
259 mutable bool fCachedCanvasSizeDirty;
260
253 friend class SkDeferredCanvasTester; // for unit testing 261 friend class SkDeferredCanvasTester; // for unit testing
254 typedef SkCanvas INHERITED; 262 typedef SkCanvas INHERITED;
255 }; 263 };
256 264
257 265
258 #endif 266 #endif
OLDNEW
« no previous file with comments | « no previous file | src/utils/SkDeferredCanvas.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698