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

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

Issue 491313003: SkMultiPictureDraw API (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix clang complaint Created 6 years, 4 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/gmslides.gypi ('k') | src/core/SkMultiPictureDraw.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * Copyright 2014 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8 #ifndef SkMultiPictureDraw_DEFINED
9 #define SkMultiPictureDraw_DEFINED
10
11 #include "SkMatrix.h"
12 #include "SkTDArray.h"
13
14 class SkCanvas;
15 class SkPaint;
16 class SkPicture;
17
18 /** \class SkMultiPictureDraw
19
20 The MultiPictureDraw object accepts several picture/canvas pairs and
21 then attempts to optimally draw the pictures into the canvases, sharing
22 as many resources as possible.
23 */
24 class SK_API SkMultiPictureDraw {
25 public:
26 /**
27 * Create an object to optimize the drawing of multiple pictures.
28 * @param reserve Hint for the number of add calls expected to be issued
29 */
30 SkMultiPictureDraw(int reserve = 0);
31 ~SkMultiPictureDraw() { this->reset(); }
32
33 /**
34 * Add a canvas/picture pair for later rendering.
35 * @param canvas the canvas in which to draw picture
36 * @param picture the picture to draw into canvas
37 * @param matrix if non-NULL, applied to the CTM when drawing
38 * @param paint if non-NULL, draw picture to a temporary buffer
39 * and then apply the paint when the result is drawn
40 */
41 void add(SkCanvas* canvas,
42 const SkPicture* picture,
43 const SkMatrix* matrix = NULL,
44 const SkPaint* paint = NULL);
45
46 /**
47 * Perform all the previously added draws. This will reset the state
48 * of this object.
49 */
50 void draw();
51
52 /**
53 * Abandon all buffered draws and reset to the initial state.
54 */
55 void reset();
56
57 private:
58 struct DrawData {
59 SkCanvas* canvas; // reffed
60 const SkPicture* picture; // reffed
61 SkMatrix matrix;
62 SkPaint* paint; // owned
63 };
64
65 SkTDArray<DrawData> fDrawData;
66 };
67
68 #endif
OLDNEW
« no previous file with comments | « gyp/gmslides.gypi ('k') | src/core/SkMultiPictureDraw.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698