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

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

Issue 2203453002: Sketch SkPictureRecorder::optimizeFor(GrContext*). (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: enough for demo Created 4 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 | « no previous file | include/private/SkRecords.h » ('j') | src/core/SkPictureRecorder.cpp » ('J')
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 SkPictureRecorder_DEFINED 8 #ifndef SkPictureRecorder_DEFINED
9 #define SkPictureRecorder_DEFINED 9 #define SkPictureRecorder_DEFINED
10 10
11 #include "../private/SkMiniRecorder.h" 11 #include "../private/SkMiniRecorder.h"
12 #include "SkBBHFactory.h" 12 #include "SkBBHFactory.h"
13 #include "SkPicture.h" 13 #include "SkPicture.h"
14 #include "SkRefCnt.h" 14 #include "SkRefCnt.h"
15 15
16 #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK 16 #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK
17 namespace android { 17 namespace android {
18 class Picture; 18 class Picture;
19 }; 19 };
20 #endif 20 #endif
21 21
22 class GrContext;
22 class SkCanvas; 23 class SkCanvas;
23 class SkDrawable; 24 class SkDrawable;
24 class SkPictureRecord; 25 class SkPictureRecord;
25 class SkRecord; 26 class SkRecord;
26 class SkRecorder; 27 class SkRecorder;
27 28
28 class SK_API SkPictureRecorder : SkNoncopyable { 29 class SK_API SkPictureRecorder : SkNoncopyable {
29 public: 30 public:
30 SkPictureRecorder(); 31 SkPictureRecorder();
31 ~SkPictureRecorder(); 32 ~SkPictureRecorder();
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 } 105 }
105 SkPicture* SK_WARN_UNUSED_RESULT endRecordingAsPicture(const SkRect& cullRec t) { 106 SkPicture* SK_WARN_UNUSED_RESULT endRecordingAsPicture(const SkRect& cullRec t) {
106 return this->finishRecordingAsPictureWithCull(cullRect).release(); 107 return this->finishRecordingAsPictureWithCull(cullRect).release();
107 } 108 }
108 SkDrawable* SK_WARN_UNUSED_RESULT endRecordingAsDrawable() { 109 SkDrawable* SK_WARN_UNUSED_RESULT endRecordingAsDrawable() {
109 return this->finishRecordingAsDrawable().release(); 110 return this->finishRecordingAsDrawable().release();
110 } 111 }
111 SkPicture* SK_WARN_UNUSED_RESULT endRecording() { return this->endRecordingA sPicture(); } 112 SkPicture* SK_WARN_UNUSED_RESULT endRecording() { return this->endRecordingA sPicture(); }
112 #endif 113 #endif
113 114
115 // Strawman API.
116 void optimizeFor(GrContext* ctx) { fGrContextToOptimizeFor = ctx; }
117
114 private: 118 private:
115 void reset(); 119 void reset();
116 120
117 /** Replay the current (partially recorded) operation stream into 121 /** Replay the current (partially recorded) operation stream into
118 canvas. This call doesn't close the current recording. 122 canvas. This call doesn't close the current recording.
119 */ 123 */
120 #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK 124 #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK
121 friend class android::Picture; 125 friend class android::Picture;
122 #endif 126 #endif
123 friend class SkPictureRecorderReplayTester; // for unit testing 127 friend class SkPictureRecorderReplayTester; // for unit testing
124 void partialReplay(SkCanvas* canvas) const; 128 void partialReplay(SkCanvas* canvas) const;
125 129
126 bool fActivelyRecording; 130 bool fActivelyRecording;
127 uint32_t fFlags; 131 uint32_t fFlags;
128 SkRect fCullRect; 132 SkRect fCullRect;
129 SkAutoTUnref<SkBBoxHierarchy> fBBH; 133 SkAutoTUnref<SkBBoxHierarchy> fBBH;
130 SkAutoTUnref<SkRecorder> fRecorder; 134 SkAutoTUnref<SkRecorder> fRecorder;
131 SkAutoTUnref<SkRecord> fRecord; 135 SkAutoTUnref<SkRecord> fRecord;
132 SkMiniRecorder fMiniRecorder; 136 SkMiniRecorder fMiniRecorder;
133 137
138 GrContext* fGrContextToOptimizeFor = nullptr;
139
134 typedef SkNoncopyable INHERITED; 140 typedef SkNoncopyable INHERITED;
135 }; 141 };
136 142
137 #endif 143 #endif
OLDNEW
« no previous file with comments | « no previous file | include/private/SkRecords.h » ('j') | src/core/SkPictureRecorder.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698