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

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

Issue 248033002: Rearrange SkRecord public API to fit better with cc/resources/picture (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: add forgetRecord() Created 6 years, 8 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
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(SkRecorder::Mode mode, SkRecord* record, int width, int h eight)
13 : SkCanvas(width, height), fMode(mode), fRecord(record) {} 13 : SkCanvas(width, height), fMode(mode), fRecord(record) {}
14 14
15 void SkRecorder::forgetRecord() {
16 fRecord = NULL;
17 }
18
15 // To make appending to fRecord a little less verbose. 19 // To make appending to fRecord a little less verbose.
16 #define APPEND(T, ...) \ 20 #define APPEND(T, ...) \
17 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__))
18 22
19 // For methods which must call back into SkCanvas in kReadWrite_Mode. 23 // For methods which must call back into SkCanvas in kReadWrite_Mode.
20 #define INHERITED(method, ...) if (fMode == kReadWrite_Mode) this->SkCanvas::met hod(__VA_ARGS__) 24 #define INHERITED(method, ...) if (fMode == kReadWrite_Mode) this->SkCanvas::met hod(__VA_ARGS__)
21 25
22 // 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
23 // 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
24 // 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
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 246
243 void SkRecorder::onClipPath(const SkPath& path, SkRegion::Op op, ClipEdgeStyle e dgeStyle) { 247 void SkRecorder::onClipPath(const SkPath& path, SkRegion::Op op, ClipEdgeStyle e dgeStyle) {
244 APPEND(ClipPath, delay_copy(path), op, edgeStyle == kSoft_ClipEdgeStyle); 248 APPEND(ClipPath, delay_copy(path), op, edgeStyle == kSoft_ClipEdgeStyle);
245 INHERITED(updateClipConservativelyUsingBounds, path.getBounds(), op, path.is InverseFillType()); 249 INHERITED(updateClipConservativelyUsingBounds, path.getBounds(), op, path.is InverseFillType());
246 } 250 }
247 251
248 void SkRecorder::onClipRegion(const SkRegion& deviceRgn, SkRegion::Op op) { 252 void SkRecorder::onClipRegion(const SkRegion& deviceRgn, SkRegion::Op op) {
249 APPEND(ClipRegion, delay_copy(deviceRgn), op); 253 APPEND(ClipRegion, delay_copy(deviceRgn), op);
250 INHERITED(onClipRegion, deviceRgn, op); 254 INHERITED(onClipRegion, deviceRgn, op);
251 } 255 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698