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

Side by Side Diff: src/core/SkRecordDraw.h

Issue 454123003: Plumbing for using a BBH in SkRecordDraw. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: clang says asserts are always true 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 | « src/core/SkPictureRecorder.cpp ('k') | src/core/SkRecordDraw.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 2014 Google Inc. 2 * Copyright 2014 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 SkRecordDraw_DEFINED 8 #ifndef SkRecordDraw_DEFINED
9 #define SkRecordDraw_DEFINED 9 #define SkRecordDraw_DEFINED
10 10
11 #include "SkRecord.h" 11 #include "SkBBoxHierarchy.h"
12 #include "SkCanvas.h" 12 #include "SkCanvas.h"
13 #include "SkDrawPictureCallback.h" 13 #include "SkDrawPictureCallback.h"
14 #include "SkRecord.h"
15
16 // Fill a BBH to be used by SkRecordDraw to accelerate playback.
17 void SkRecordFillBounds(const SkRecord&, SkBBoxHierarchy*);
14 18
15 // Draw an SkRecord into an SkCanvas. A convenience wrapper around SkRecords::D raw. 19 // Draw an SkRecord into an SkCanvas. A convenience wrapper around SkRecords::D raw.
16 void SkRecordDraw(const SkRecord&, SkCanvas*, SkDrawPictureCallback* = NULL); 20 void SkRecordDraw(const SkRecord&, SkCanvas*, const SkBBoxHierarchy*, SkDrawPict ureCallback*);
17 21
18 namespace SkRecords { 22 namespace SkRecords {
19 23
20 // This is an SkRecord visitor that will draw that SkRecord to an SkCanvas. 24 // This is an SkRecord visitor that will draw that SkRecord to an SkCanvas.
21 class Draw : SkNoncopyable { 25 class Draw : SkNoncopyable {
22 public: 26 public:
23 explicit Draw(SkCanvas* canvas) 27 explicit Draw(SkCanvas* canvas)
24 : fInitialCTM(canvas->getTotalMatrix()), fCanvas(canvas), fIndex(0) {} 28 : fInitialCTM(canvas->getTotalMatrix()), fCanvas(canvas), fIndex(0) {}
25 29
26 unsigned index() const { return fIndex; } 30 unsigned index() const { return fIndex; }
27 void next() { ++fIndex; } 31 void next() { ++fIndex; }
28 32
29 template <typename T> void operator()(const T& r) { 33 template <typename T> void operator()(const T& r) {
30 this->draw(r); 34 this->draw(r);
31 } 35 }
32 36
33 private: 37 private:
34 // No base case, so we'll be compile-time checked that we implement all poss ibilities. 38 // No base case, so we'll be compile-time checked that we implement all poss ibilities.
35 template <typename T> void draw(const T&); 39 template <typename T> void draw(const T&);
36 40
37 const SkMatrix fInitialCTM; 41 const SkMatrix fInitialCTM;
38 SkCanvas* fCanvas; 42 SkCanvas* fCanvas;
39 unsigned fIndex; 43 unsigned fIndex;
40 }; 44 };
41 45
42 } // namespace SkRecords 46 } // namespace SkRecords
43 47
44 #endif//SkRecordDraw_DEFINED 48 #endif//SkRecordDraw_DEFINED
OLDNEW
« no previous file with comments | « src/core/SkPictureRecorder.cpp ('k') | src/core/SkRecordDraw.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698