Chromium Code Reviews| OLD | NEW |
|---|---|
| (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 SkMultiPictureDraw { | |
| 25 public: | |
| 26 SkMultiPictureDraw(int sizeHint = 0); | |
|
reed1
2014/08/21 17:58:01
document or remove
bsalomon
2014/08/21 17:58:40
wonder if we should call this reserve to be consis
bsalomon
2014/08/21 17:58:40
wonder if we should call this reserve to be consis
robertphillips
2014/08/21 18:21:35
Done.
robertphillips
2014/08/21 18:21:35
Done.
| |
| 27 ~SkMultiPictureDraw() { this->unrefAll(); } | |
| 28 | |
| 29 /** | |
| 30 * Add a canvas/picture pair for later rendering. | |
| 31 * @param canvas the canvas in which to draw picture | |
| 32 * @param picture the picture to draw into canvas | |
| 33 * @param matrix if non-NULL, applied to the CTM when drawing | |
| 34 * @param paint if non-NULL, draw picture to a temporary buffer | |
| 35 * and then apply the paint when the result is drawn | |
| 36 */ | |
| 37 void add(SkCanvas* canvas, | |
| 38 const SkPicture* picture, | |
| 39 const SkMatrix* matrix = NULL, | |
| 40 const SkPaint* paint = NULL); | |
| 41 | |
| 42 /** | |
| 43 * Perform all the previously added draws. This will reset the state | |
| 44 * of this object. | |
| 45 */ | |
| 46 void draw(); | |
| 47 | |
| 48 private: | |
| 49 struct DrawData { | |
| 50 SkCanvas* canvas; // reffed | |
| 51 const SkPicture* picture; // reffed | |
| 52 SkMatrix matrix; | |
| 53 SkPaint* paint; // owned | |
| 54 }; | |
| 55 | |
| 56 SkTDArray<DrawData> fDrawData; | |
| 57 | |
| 58 void unrefAll(); | |
| 59 }; | |
| 60 | |
| 61 #endif | |
| OLD | NEW |