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

Side by Side Diff: src/core/SkMiniRecorder.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 | « include/private/SkTLogic.h ('k') | src/core/SkPictureCommon.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 2015 Google Inc. 2 * Copyright 2015 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 "SkCanvas.h" 8 #include "SkCanvas.h"
9 #include "SkTLazy.h" 9 #include "SkTLazy.h"
10 #include "SkMiniRecorder.h" 10 #include "SkMiniRecorder.h"
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 // We have internal state pending. 63 // We have internal state pending.
64 // Detaching then deleting a picture is an easy way to clean up. 64 // Detaching then deleting a picture is an easy way to clean up.
65 delete this->detachAsPicture(SkRect::MakeEmpty()); 65 delete this->detachAsPicture(SkRect::MakeEmpty());
66 } 66 }
67 SkASSERT(fState == State::kEmpty); 67 SkASSERT(fState == State::kEmpty);
68 } 68 }
69 69
70 #define TRY_TO_STORE(Type, ...) \ 70 #define TRY_TO_STORE(Type, ...) \
71 if (fState != State::kEmpty) { return false; } \ 71 if (fState != State::kEmpty) { return false; } \
72 fState = State::k##Type; \ 72 fState = State::k##Type; \
73 new (fBuffer.get()) Type(__VA_ARGS__); \ 73 new (fBuffer.get()) Type{__VA_ARGS__}; \
74 return true 74 return true
75 75
76 bool SkMiniRecorder::drawBitmapRect(const SkBitmap& bm, const SkRect* src, const SkRect& dst, 76 bool SkMiniRecorder::drawBitmapRect(const SkBitmap& bm, const SkRect* src, const SkRect& dst,
77 const SkPaint* p, SkCanvas::SrcRectConstrain t constraint) { 77 const SkPaint* p, SkCanvas::SrcRectConstrain t constraint) {
78 SkRect bounds; 78 SkRect bounds;
79 if (!src) { 79 if (!src) {
80 bm.getBounds(&bounds); 80 bm.getBounds(&bounds);
81 src = &bounds; 81 src = &bounds;
82 } 82 }
83 SkTLazy<SkPaint> defaultPaint; 83 SkTLazy<SkPaint> defaultPaint;
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 switch (fState) { 131 switch (fState) {
132 case State::kEmpty: return; 132 case State::kEmpty: return;
133 CASE(DrawBitmapRectFixedSize); 133 CASE(DrawBitmapRectFixedSize);
134 CASE(DrawPath); 134 CASE(DrawPath);
135 CASE(DrawRect); 135 CASE(DrawRect);
136 CASE(DrawTextBlob); 136 CASE(DrawTextBlob);
137 } 137 }
138 SkASSERT(false); 138 SkASSERT(false);
139 #undef CASE 139 #undef CASE
140 } 140 }
OLDNEW
« no previous file with comments | « include/private/SkTLogic.h ('k') | src/core/SkPictureCommon.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698