OLD | NEW |
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 Loading... |
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 Loading... |
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 } |
OLD | NEW |