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

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

Issue 617953002: Strip old backend recording down to essentials (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: debug-only Created 6 years, 2 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/SkPictureData.cpp ('k') | src/core/SkPicturePlayback.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 SkPicturePlayback_DEFINED 8 #ifndef SkPicturePlayback_DEFINED
9 #define SkPicturePlayback_DEFINED 9 #define SkPicturePlayback_DEFINED
10 10
11 #include "SkPictureFlat.h" // for DrawType 11 #include "SkPictureFlat.h" // for DrawType
12 #include "SkPictureStateTree.h"
13 12
14 class SkBitmap; 13 class SkBitmap;
15 class SkCanvas; 14 class SkCanvas;
16 class SkDrawPictureCallback; 15 class SkDrawPictureCallback;
17 class SkPaint; 16 class SkPaint;
18 class SkPictureData; 17 class SkPictureData;
19 18
20 // The basic picture playback class replays the provided picture into a canvas. 19 // The basic picture playback class replays the provided picture into a canvas.
21 // If the picture was generated with a BBH it is used to accelerate drawing
22 // unless disabled via setUseBBH.
23 class SkPicturePlayback : SkNoncopyable { 20 class SkPicturePlayback : SkNoncopyable {
24 public: 21 public:
25 SkPicturePlayback(const SkPicture* picture) 22 SkPicturePlayback(const SkPicture* picture)
26 : fPictureData(picture->fData.get()) 23 : fPictureData(picture->fData.get())
27 , fCurOffset(0) 24 , fCurOffset(0) {
28 , fUseBBH(true) {
29 } 25 }
30 virtual ~SkPicturePlayback() { } 26 virtual ~SkPicturePlayback() { }
31 27
32 virtual void draw(SkCanvas* canvas, SkDrawPictureCallback*); 28 virtual void draw(SkCanvas* canvas, SkDrawPictureCallback*);
33 29
34 // TODO: remove the curOp calls after cleaning up GrGatherDevice 30 // TODO: remove the curOp calls after cleaning up GrGatherDevice
35 // Return the ID of the operation currently being executed when playing 31 // Return the ID of the operation currently being executed when playing
36 // back. 0 indicates no call is active. 32 // back. 0 indicates no call is active.
37 size_t curOpID() const { return fCurOffset; } 33 size_t curOpID() const { return fCurOffset; }
38 void resetOpID() { fCurOffset = 0; } 34 void resetOpID() { fCurOffset = 0; }
39 35
40 // TODO: remove setUseBBH after cleaning up GrGatherCanvas
41 void setUseBBH(bool useBBH) { fUseBBH = useBBH; }
42
43 protected: 36 protected:
44 const SkPictureData* fPictureData; 37 const SkPictureData* fPictureData;
45 38
46 // The offset of the current operation when within the draw method 39 // The offset of the current operation when within the draw method
47 size_t fCurOffset; 40 size_t fCurOffset;
48 41
49 bool fUseBBH; 42 void handleOp(SkReader32* reader,
50 43 DrawType op,
51 void handleOp(SkReader32* reader, 44 uint32_t size,
52 DrawType op,
53 uint32_t size,
54 SkCanvas* canvas, 45 SkCanvas* canvas,
55 const SkMatrix& initialMatrix); 46 const SkMatrix& initialMatrix);
56 47
57 const SkPicture::OperationList* getActiveOps(const SkCanvas* canvas);
58 bool initIterator(SkPictureStateTree::Iterator* iter,
59 SkCanvas* canvas,
60 const SkPicture::OperationList *activeOpsList);
61 static void StepIterator(SkPictureStateTree::Iterator* iter, SkReader32* rea der);
62 static void SkipIterTo(SkPictureStateTree::Iterator* iter,
63 SkReader32* reader, uint32_t skipTo);
64
65 static DrawType ReadOpAndSize(SkReader32* reader, uint32_t* size); 48 static DrawType ReadOpAndSize(SkReader32* reader, uint32_t* size);
66 49
67 class AutoResetOpID { 50 class AutoResetOpID {
68 public: 51 public:
69 AutoResetOpID(SkPicturePlayback* playback) : fPlayback(playback) { } 52 AutoResetOpID(SkPicturePlayback* playback) : fPlayback(playback) { }
70 ~AutoResetOpID() { 53 ~AutoResetOpID() {
71 if (fPlayback) { 54 if (fPlayback) {
72 fPlayback->resetOpID(); 55 fPlayback->resetOpID();
73 } 56 }
74 } 57 }
75 58
76 private: 59 private:
77 SkPicturePlayback* fPlayback; 60 SkPicturePlayback* fPlayback;
78 }; 61 };
79 62
80 private: 63 private:
81 typedef SkNoncopyable INHERITED; 64 typedef SkNoncopyable INHERITED;
82 }; 65 };
83 66
84 #endif 67 #endif
OLDNEW
« no previous file with comments | « src/core/SkPictureData.cpp ('k') | src/core/SkPicturePlayback.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698