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

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

Issue 618303002: Remove DEPRECATED_beginRecording(). (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix up benches 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') | tests/CanvasTest.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 #include "SkPictureRecord.h"
9 #include "SkPictureRecorder.h" 8 #include "SkPictureRecorder.h"
10 #include "SkRecord.h" 9 #include "SkRecord.h"
11 #include "SkRecordDraw.h" 10 #include "SkRecordDraw.h"
12 #include "SkRecorder.h" 11 #include "SkRecorder.h"
13 #include "SkTypes.h" 12 #include "SkTypes.h"
14 13
15 SkPictureRecorder::SkPictureRecorder() {} 14 SkPictureRecorder::SkPictureRecorder() {}
16 15
17 SkPictureRecorder::~SkPictureRecorder() {} 16 SkPictureRecorder::~SkPictureRecorder() {}
18 17
19 SkCanvas* SkPictureRecorder::beginRecording(SkScalar width, SkScalar height, 18 SkCanvas* SkPictureRecorder::beginRecording(SkScalar width, SkScalar height,
20 SkBBHFactory* bbhFactory /* = NULL * /, 19 SkBBHFactory* bbhFactory /* = NULL * /,
21 uint32_t recordFlags /* = 0 */) { 20 uint32_t recordFlags /* = 0 */) {
22 return EXPERIMENTAL_beginRecording(width, height, bbhFactory);
23 }
24
25 SkCanvas* SkPictureRecorder::DEPRECATED_beginRecording(SkScalar width, SkScalar height,
26 SkBBHFactory* bbhFactory /* = NULL */,
27 uint32_t recordFlags /* = 0 */) {
28 SkASSERT(!bbhFactory); // No longer suppported with this backend.
29
30 fCullWidth = width;
31 fCullHeight = height;
32 fPictureRecord.reset(SkNEW_ARGS(SkPictureRecord, (SkISize::Make(width, heigh t), recordFlags)));
33
34 fPictureRecord->beginRecording();
35 return this->getRecordingCanvas();
36 }
37
38 SkCanvas* SkPictureRecorder::EXPERIMENTAL_beginRecording(SkScalar width, SkScala r height,
39 SkBBHFactory* bbhFactor y /* = NULL */) {
40 fCullWidth = width; 21 fCullWidth = width;
41 fCullHeight = height; 22 fCullHeight = height;
42 23
43 if (bbhFactory) { 24 if (bbhFactory) {
44 fBBH.reset((*bbhFactory)(width, height)); 25 fBBH.reset((*bbhFactory)(width, height));
45 SkASSERT(fBBH.get()); 26 SkASSERT(fBBH.get());
46 } 27 }
47 28
48 fRecord.reset(SkNEW(SkRecord)); 29 fRecord.reset(SkNEW(SkRecord));
49 fRecorder.reset(SkNEW_ARGS(SkRecorder, (fRecord.get(), width, height))); 30 fRecorder.reset(SkNEW_ARGS(SkRecorder, (fRecord.get(), width, height)));
50 return this->getRecordingCanvas(); 31 return this->getRecordingCanvas();
51 } 32 }
52 33
53 SkCanvas* SkPictureRecorder::getRecordingCanvas() { 34 SkCanvas* SkPictureRecorder::getRecordingCanvas() {
54 if (fRecorder.get()) { 35 return fRecorder.get();
55 return fRecorder.get();
56 }
57 return fPictureRecord.get();
58 } 36 }
59 37
60 SkPicture* SkPictureRecorder::endRecording() { 38 SkPicture* SkPictureRecorder::endRecording() {
61 SkPicture* picture = NULL; 39 return SkNEW_ARGS(SkPicture, (fCullWidth, fCullHeight, fRecord.detach(), fBB H.get()));
62
63 if (fRecord.get()) {
64 picture = SkNEW_ARGS(SkPicture, (fCullWidth, fCullHeight,
65 fRecord.detach(), fBBH.get()));
66 }
67
68 if (fPictureRecord.get()) {
69 fPictureRecord->endRecording();
70 const bool deepCopyOps = false;
71 picture = SkNEW_ARGS(SkPicture, (fCullWidth, fCullHeight,
72 *fPictureRecord.get(), deepCopyOps));
73 }
74
75 return picture;
76 } 40 }
77 41
78 void SkPictureRecorder::partialReplay(SkCanvas* canvas) const { 42 void SkPictureRecorder::partialReplay(SkCanvas* canvas) const {
79 if (NULL == canvas) { 43 if (NULL == canvas) {
80 return; 44 return;
81 } 45 }
82 46 SkRecordDraw(*fRecord, canvas, NULL/*bbh*/, NULL/*callback*/);
83 if (fRecord.get()) {
84 SkRecordDraw(*fRecord, canvas, NULL/*bbh*/, NULL/*callback*/);
85 }
86
87 if (fPictureRecord.get()) {
88 const bool deepCopyOps = true;
89 SkPicture picture(fCullWidth, fCullHeight,
90 *fPictureRecord.get(), deepCopyOps);
91 picture.playback(canvas);
92 }
93 } 47 }
OLDNEW
« no previous file with comments | « src/core/SkPictureRecord.cpp ('k') | tests/CanvasTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698