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

Side by Side Diff: src/record/SkRecorder.cpp

Issue 290653004: Remove SkRecorder's kWriteOnly mode. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 6 years, 6 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/record/SkRecorder.h ('k') | src/record/SkRecording.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 "SkRecorder.h" 8 #include "SkRecorder.h"
9 #include "SkPicture.h" 9 #include "SkPicture.h"
10 10
11 // SkCanvas will fail in mysterious ways if it doesn't know the real width and h eight. 11 // SkCanvas will fail in mysterious ways if it doesn't know the real width and h eight.
12 SkRecorder::SkRecorder(SkRecorder::Mode mode, SkRecord* record, int width, int h eight) 12 SkRecorder::SkRecorder(SkRecord* record, int width, int height)
13 : SkCanvas(width, height), fMode(mode), fRecord(record) {} 13 : SkCanvas(width, height), fRecord(record) {}
14 14
15 void SkRecorder::forgetRecord() { 15 void SkRecorder::forgetRecord() {
16 fRecord = NULL; 16 fRecord = NULL;
17 } 17 }
18 18
19 // To make appending to fRecord a little less verbose. 19 // To make appending to fRecord a little less verbose.
20 #define APPEND(T, ...) \ 20 #define APPEND(T, ...) \
21 SkNEW_PLACEMENT_ARGS(fRecord->append<SkRecords::T>(), SkRecords::T, (__V A_ARGS__)) 21 SkNEW_PLACEMENT_ARGS(fRecord->append<SkRecords::T>(), SkRecords::T, (__V A_ARGS__))
22 22
23 // For methods which must call back into SkCanvas in kReadWrite_Mode. 23 // For methods which must call back into SkCanvas.
24 #define INHERITED(method, ...) if (fMode == kReadWrite_Mode) this->SkCanvas::met hod(__VA_ARGS__) 24 #define INHERITED(method, ...) this->SkCanvas::method(__VA_ARGS__)
25 25
26 // The structs we're creating all copy their constructor arguments. Given the w ay the SkRecords 26 // The structs we're creating all copy their constructor arguments. Given the w ay the SkRecords
27 // framework works, sometimes they happen to technically be copied twice, which is fine and elided 27 // framework works, sometimes they happen to technically be copied twice, which is fine and elided
28 // into a single copy unless the class has a non-trivial copy constructor. For classes with 28 // into a single copy unless the class has a non-trivial copy constructor. For classes with
29 // non-trivial copy constructors, we skip the first copy (and its destruction) b y wrapping the value 29 // non-trivial copy constructors, we skip the first copy (and its destruction) b y wrapping the value
30 // with delay_copy(), forcing the argument to be passed by const&. 30 // with delay_copy(), forcing the argument to be passed by const&.
31 // 31 //
32 // This is used below for SkBitmap, SkPaint, SkPath, and SkRegion, which all hav e non-trivial copy 32 // This is used below for SkBitmap, SkPaint, SkPath, and SkRegion, which all hav e non-trivial copy
33 // constructors and destructors. You'll know you've got a good candidate T if y ou see ~T() show up 33 // constructors and destructors. You'll know you've got a good candidate T if y ou see ~T() show up
34 // unexpectedly on a profile of record time. Otherwise don't bother. 34 // unexpectedly on a profile of record time. Otherwise don't bother.
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 254
255 void SkRecorder::onClipPath(const SkPath& path, SkRegion::Op op, ClipEdgeStyle e dgeStyle) { 255 void SkRecorder::onClipPath(const SkPath& path, SkRegion::Op op, ClipEdgeStyle e dgeStyle) {
256 APPEND(ClipPath, delay_copy(path), op, edgeStyle == kSoft_ClipEdgeStyle); 256 APPEND(ClipPath, delay_copy(path), op, edgeStyle == kSoft_ClipEdgeStyle);
257 INHERITED(updateClipConservativelyUsingBounds, path.getBounds(), op, path.is InverseFillType()); 257 INHERITED(updateClipConservativelyUsingBounds, path.getBounds(), op, path.is InverseFillType());
258 } 258 }
259 259
260 void SkRecorder::onClipRegion(const SkRegion& deviceRgn, SkRegion::Op op) { 260 void SkRecorder::onClipRegion(const SkRegion& deviceRgn, SkRegion::Op op) {
261 APPEND(ClipRegion, delay_copy(deviceRgn), op); 261 APPEND(ClipRegion, delay_copy(deviceRgn), op);
262 INHERITED(onClipRegion, deviceRgn, op); 262 INHERITED(onClipRegion, deviceRgn, op);
263 } 263 }
OLDNEW
« no previous file with comments | « src/record/SkRecorder.h ('k') | src/record/SkRecording.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698