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

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

Issue 1360943003: simplify code in SkRecords.h (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: another SaveLayer Created 5 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/SkRecordPattern.h ('k') | tests/RecordTest.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 "SkBigPicture.h" 8 #include "SkBigPicture.h"
9 #include "SkCanvasPriv.h" 9 #include "SkCanvasPriv.h"
10 #include "SkPatchUtils.h" 10 #include "SkPatchUtils.h"
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 fDrawableList.reset(nullptr); 63 fDrawableList.reset(nullptr);
64 fApproxBytesUsedBySubPictures = 0; 64 fApproxBytesUsedBySubPictures = 0;
65 fRecord = nullptr; 65 fRecord = nullptr;
66 } 66 }
67 67
68 // To make appending to fRecord a little less verbose. 68 // To make appending to fRecord a little less verbose.
69 #define APPEND(T, ...) \ 69 #define APPEND(T, ...) \
70 if (fMiniRecorder) { \ 70 if (fMiniRecorder) { \
71 this->flushMiniRecorder(); \ 71 this->flushMiniRecorder(); \
72 } \ 72 } \
73 new (fRecord->append<SkRecords::T>()) SkRecords::T(__VA_ARGS__) 73 new (fRecord->append<SkRecords::T>()) SkRecords::T{__VA_ARGS__}
74 74
75 #define TRY_MINIRECORDER(method, ...) \ 75 #define TRY_MINIRECORDER(method, ...) \
76 if (fMiniRecorder && fMiniRecorder->method(__VA_ARGS__)) { return; } 76 if (fMiniRecorder && fMiniRecorder->method(__VA_ARGS__)) { return; }
77 77
78 // For methods which must call back into SkCanvas. 78 // For methods which must call back into SkCanvas.
79 #define INHERITED(method, ...) this->SkCanvas::method(__VA_ARGS__) 79 #define INHERITED(method, ...) this->SkCanvas::method(__VA_ARGS__)
80 80
81 // Use copy() only for optional arguments, to be copied if present or skipped if not. 81 // Use copy() only for optional arguments, to be copied if present or skipped if not.
82 // (For most types we just pass by value and let copy constructors do their thin g.) 82 // (For most types we just pass by value and let copy constructors do their thin g.)
83 template <typename T> 83 template <typename T>
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 INHERITED(onClipPath, path, op, edgeStyle); 375 INHERITED(onClipPath, path, op, edgeStyle);
376 SkRecords::RegionOpAndAA opAA(op, kSoft_ClipEdgeStyle == edgeStyle); 376 SkRecords::RegionOpAndAA opAA(op, kSoft_ClipEdgeStyle == edgeStyle);
377 APPEND(ClipPath, this->devBounds(), path, opAA); 377 APPEND(ClipPath, this->devBounds(), path, opAA);
378 } 378 }
379 379
380 void SkRecorder::onClipRegion(const SkRegion& deviceRgn, SkRegion::Op op) { 380 void SkRecorder::onClipRegion(const SkRegion& deviceRgn, SkRegion::Op op) {
381 INHERITED(onClipRegion, deviceRgn, op); 381 INHERITED(onClipRegion, deviceRgn, op);
382 APPEND(ClipRegion, this->devBounds(), deviceRgn, op); 382 APPEND(ClipRegion, this->devBounds(), deviceRgn, op);
383 } 383 }
384 384
OLDNEW
« no previous file with comments | « src/core/SkRecordPattern.h ('k') | tests/RecordTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698