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

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

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/SkPictureRecord.cpp ('k') | src/core/SkPictureStateTree.h » ('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 #include "SkBBoxHierarchyRecord.h"
9 #include "SkPictureRecord.h" 8 #include "SkPictureRecord.h"
10 #include "SkPictureRecorder.h" 9 #include "SkPictureRecorder.h"
11 #include "SkRecord.h" 10 #include "SkRecord.h"
12 #include "SkRecordDraw.h" 11 #include "SkRecordDraw.h"
13 #include "SkRecorder.h" 12 #include "SkRecorder.h"
14 #include "SkTypes.h" 13 #include "SkTypes.h"
15 14
16 SkPictureRecorder::SkPictureRecorder() {} 15 SkPictureRecorder::SkPictureRecorder() {}
17 16
18 SkPictureRecorder::~SkPictureRecorder() {} 17 SkPictureRecorder::~SkPictureRecorder() {}
19 18
20 SkCanvas* SkPictureRecorder::beginRecording(SkScalar width, SkScalar height, 19 SkCanvas* SkPictureRecorder::beginRecording(SkScalar width, SkScalar height,
21 SkBBHFactory* bbhFactory /* = NULL * /, 20 SkBBHFactory* bbhFactory /* = NULL * /,
22 uint32_t recordFlags /* = 0 */) { 21 uint32_t recordFlags /* = 0 */) {
23 return EXPERIMENTAL_beginRecording(width, height, bbhFactory); 22 return EXPERIMENTAL_beginRecording(width, height, bbhFactory);
24 } 23 }
25 24
26 SkCanvas* SkPictureRecorder::DEPRECATED_beginRecording(SkScalar width, SkScalar height, 25 SkCanvas* SkPictureRecorder::DEPRECATED_beginRecording(SkScalar width, SkScalar height,
27 SkBBHFactory* bbhFactory /* = NULL */, 26 SkBBHFactory* bbhFactory /* = NULL */,
28 uint32_t recordFlags /* = 0 */) { 27 uint32_t recordFlags /* = 0 */) {
28 SkASSERT(!bbhFactory); // No longer suppported with this backend.
29
29 fCullWidth = width; 30 fCullWidth = width;
30 fCullHeight = height; 31 fCullHeight = height;
31 32 fPictureRecord.reset(SkNEW_ARGS(SkPictureRecord, (SkISize::Make(width, heigh t), recordFlags)));
32 const SkISize size = SkISize::Make(width, height);
33
34 if (bbhFactory) {
35 // We don't need to hold a ref on the BBH ourselves, but might as well f or
36 // consistency with EXPERIMENTAL_beginRecording(), which does need to.
37 fBBH.reset((*bbhFactory)(width, height));
38 SkASSERT(fBBH.get());
39 fPictureRecord.reset(SkNEW_ARGS(SkBBoxHierarchyRecord, (size, recordFlag s, fBBH.get())));
40 } else {
41 fPictureRecord.reset(SkNEW_ARGS(SkPictureRecord, (size, recordFlags)));
42 }
43 33
44 fPictureRecord->beginRecording(); 34 fPictureRecord->beginRecording();
45 return this->getRecordingCanvas(); 35 return this->getRecordingCanvas();
46 } 36 }
47 37
48 SkCanvas* SkPictureRecorder::EXPERIMENTAL_beginRecording(SkScalar width, SkScala r height, 38 SkCanvas* SkPictureRecorder::EXPERIMENTAL_beginRecording(SkScalar width, SkScala r height,
49 SkBBHFactory* bbhFactor y /* = NULL */) { 39 SkBBHFactory* bbhFactor y /* = NULL */) {
50 fCullWidth = width; 40 fCullWidth = width;
51 fCullHeight = height; 41 fCullHeight = height;
52 42
(...skipping 25 matching lines...) Expand all
78 if (fPictureRecord.get()) { 68 if (fPictureRecord.get()) {
79 fPictureRecord->endRecording(); 69 fPictureRecord->endRecording();
80 const bool deepCopyOps = false; 70 const bool deepCopyOps = false;
81 picture = SkNEW_ARGS(SkPicture, (fCullWidth, fCullHeight, 71 picture = SkNEW_ARGS(SkPicture, (fCullWidth, fCullHeight,
82 *fPictureRecord.get(), deepCopyOps)); 72 *fPictureRecord.get(), deepCopyOps));
83 } 73 }
84 74
85 return picture; 75 return picture;
86 } 76 }
87 77
88 void SkPictureRecorder::internalOnly_EnableOpts(bool enableOpts) {
89 if (fPictureRecord.get()) {
90 fPictureRecord->internalOnly_EnableOpts(enableOpts);
91 }
92 }
93
94 void SkPictureRecorder::partialReplay(SkCanvas* canvas) const { 78 void SkPictureRecorder::partialReplay(SkCanvas* canvas) const {
95 if (NULL == canvas) { 79 if (NULL == canvas) {
96 return; 80 return;
97 } 81 }
98 82
99 if (fRecord.get()) { 83 if (fRecord.get()) {
100 SkRecordDraw(*fRecord, canvas, NULL/*bbh*/, NULL/*callback*/); 84 SkRecordDraw(*fRecord, canvas, NULL/*bbh*/, NULL/*callback*/);
101 } 85 }
102 86
103 if (fPictureRecord.get()) { 87 if (fPictureRecord.get()) {
104 const bool deepCopyOps = true; 88 const bool deepCopyOps = true;
105 SkPicture picture(fCullWidth, fCullHeight, 89 SkPicture picture(fCullWidth, fCullHeight,
106 *fPictureRecord.get(), deepCopyOps); 90 *fPictureRecord.get(), deepCopyOps);
107 picture.playback(canvas); 91 picture.playback(canvas);
108 } 92 }
109 } 93 }
OLDNEW
« no previous file with comments | « src/core/SkPictureRecord.cpp ('k') | src/core/SkPictureStateTree.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698