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

Side by Side Diff: src/core/SkPictureRecorder.cpp

Issue 616033002: Clean up SK_PICTURE_USE_SK_RECORD and SK_PICTURE_OPTIMIZE_SK_RECORD. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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/SkPicture.cpp ('k') | no next file » | 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 #include "SkBBoxHierarchyRecord.h" 8 #include "SkBBoxHierarchyRecord.h"
9 #include "SkPictureRecord.h" 9 #include "SkPictureRecord.h"
10 #include "SkPictureRecorder.h" 10 #include "SkPictureRecorder.h"
11 #include "SkRecord.h" 11 #include "SkRecord.h"
12 #include "SkRecordDraw.h" 12 #include "SkRecordDraw.h"
13 #include "SkRecorder.h" 13 #include "SkRecorder.h"
14 #include "SkTypes.h" 14 #include "SkTypes.h"
15 15
16 SkPictureRecorder::SkPictureRecorder() {} 16 SkPictureRecorder::SkPictureRecorder() {}
17 17
18 SkPictureRecorder::~SkPictureRecorder() {} 18 SkPictureRecorder::~SkPictureRecorder() {}
19 19
20 SkCanvas* SkPictureRecorder::beginRecording(SkScalar width, SkScalar height, 20 SkCanvas* SkPictureRecorder::beginRecording(SkScalar width, SkScalar height,
21 SkBBHFactory* bbhFactory /* = NULL * /, 21 SkBBHFactory* bbhFactory /* = NULL * /,
22 uint32_t recordFlags /* = 0 */) { 22 uint32_t recordFlags /* = 0 */) {
23 #ifdef SK_PICTURE_USE_SK_RECORD
24 return EXPERIMENTAL_beginRecording(width, height, bbhFactory); 23 return EXPERIMENTAL_beginRecording(width, height, bbhFactory);
25 #else
26 return DEPRECATED_beginRecording(width, height, bbhFactory, recordFlags);
27 #endif
28 } 24 }
29 25
30 SkCanvas* SkPictureRecorder::DEPRECATED_beginRecording(SkScalar width, SkScalar height, 26 SkCanvas* SkPictureRecorder::DEPRECATED_beginRecording(SkScalar width, SkScalar height,
31 SkBBHFactory* bbhFactory /* = NULL */, 27 SkBBHFactory* bbhFactory /* = NULL */,
32 uint32_t recordFlags /* = 0 */) { 28 uint32_t recordFlags /* = 0 */) {
33 fCullWidth = width; 29 fCullWidth = width;
34 fCullHeight = height; 30 fCullHeight = height;
35 31
36 const SkISize size = SkISize::Make(width, height); 32 const SkISize size = SkISize::Make(width, height);
37 33
(...skipping 30 matching lines...) Expand all
68 if (fRecorder.get()) { 64 if (fRecorder.get()) {
69 return fRecorder.get(); 65 return fRecorder.get();
70 } 66 }
71 return fPictureRecord.get(); 67 return fPictureRecord.get();
72 } 68 }
73 69
74 SkPicture* SkPictureRecorder::endRecording() { 70 SkPicture* SkPictureRecorder::endRecording() {
75 SkPicture* picture = NULL; 71 SkPicture* picture = NULL;
76 72
77 if (fRecord.get()) { 73 if (fRecord.get()) {
78 picture = SkNEW_ARGS(SkPicture, (fCullWidth, fCullHeight, 74 picture = SkNEW_ARGS(SkPicture, (fCullWidth, fCullHeight,
79 fRecord.detach(), fBBH.get())); 75 fRecord.detach(), fBBH.get()));
80 } 76 }
81 77
82 if (fPictureRecord.get()) { 78 if (fPictureRecord.get()) {
83 fPictureRecord->endRecording(); 79 fPictureRecord->endRecording();
84 const bool deepCopyOps = false; 80 const bool deepCopyOps = false;
85 picture = SkNEW_ARGS(SkPicture, (fCullWidth, fCullHeight, 81 picture = SkNEW_ARGS(SkPicture, (fCullWidth, fCullHeight,
86 *fPictureRecord.get(), deepCopyOps)); 82 *fPictureRecord.get(), deepCopyOps));
87 } 83 }
88 84
89 return picture; 85 return picture;
90 } 86 }
91 87
92 void SkPictureRecorder::internalOnly_EnableOpts(bool enableOpts) { 88 void SkPictureRecorder::internalOnly_EnableOpts(bool enableOpts) {
93 if (fPictureRecord.get()) { 89 if (fPictureRecord.get()) {
94 fPictureRecord->internalOnly_EnableOpts(enableOpts); 90 fPictureRecord->internalOnly_EnableOpts(enableOpts);
95 } 91 }
96 } 92 }
97 93
98 void SkPictureRecorder::partialReplay(SkCanvas* canvas) const { 94 void SkPictureRecorder::partialReplay(SkCanvas* canvas) const {
99 if (NULL == canvas) { 95 if (NULL == canvas) {
100 return; 96 return;
101 } 97 }
102 98
103 if (fRecord.get()) { 99 if (fRecord.get()) {
104 SkRecordDraw(*fRecord, canvas, NULL/*bbh*/, NULL/*callback*/); 100 SkRecordDraw(*fRecord, canvas, NULL/*bbh*/, NULL/*callback*/);
105 } 101 }
106 102
107 if (fPictureRecord.get()) { 103 if (fPictureRecord.get()) {
108 const bool deepCopyOps = true; 104 const bool deepCopyOps = true;
109 SkPicture picture(fCullWidth, fCullHeight, 105 SkPicture picture(fCullWidth, fCullHeight,
110 *fPictureRecord.get(), deepCopyOps); 106 *fPictureRecord.get(), deepCopyOps);
111 picture.playback(canvas); 107 picture.playback(canvas);
112 } 108 }
113 } 109 }
OLDNEW
« no previous file with comments | « src/core/SkPicture.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698