| 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 | 72 |
| 73 bool SkMiniRecorder::drawRect(const SkRect& rect, const SkPaint& paint) { | 73 bool SkMiniRecorder::drawRect(const SkRect& rect, const SkPaint& paint) { |
| 74 TRY_TO_STORE(DrawRect, paint, rect); | 74 TRY_TO_STORE(DrawRect, paint, rect); |
| 75 } | 75 } |
| 76 | 76 |
| 77 bool SkMiniRecorder::drawPath(const SkPath& path, const SkPaint& paint) { | 77 bool SkMiniRecorder::drawPath(const SkPath& path, const SkPaint& paint) { |
| 78 TRY_TO_STORE(DrawPath, paint, path); | 78 TRY_TO_STORE(DrawPath, paint, path); |
| 79 } | 79 } |
| 80 | 80 |
| 81 bool SkMiniRecorder::drawTextBlob(const SkTextBlob* b, SkScalar x, SkScalar y, c
onst SkPaint& p) { | 81 bool SkMiniRecorder::drawTextBlob(const SkTextBlob* b, SkScalar x, SkScalar y, c
onst SkPaint& p) { |
| 82 TRY_TO_STORE(DrawTextBlob, p, b, x, y); | 82 TRY_TO_STORE(DrawTextBlob, p, sk_ref_sp(b), x, y); |
| 83 } | 83 } |
| 84 #undef TRY_TO_STORE | 84 #undef TRY_TO_STORE |
| 85 | 85 |
| 86 | 86 |
| 87 sk_sp<SkPicture> SkMiniRecorder::detachAsPicture(const SkRect& cull) { | 87 sk_sp<SkPicture> SkMiniRecorder::detachAsPicture(const SkRect& cull) { |
| 88 #define CASE(Type) \ | 88 #define CASE(Type) \ |
| 89 case State::k##Type: \ | 89 case State::k##Type: \ |
| 90 fState = State::kEmpty; \ | 90 fState = State::kEmpty; \ |
| 91 return sk_make_sp<SkMiniPicture<Type>>(cull, reinterpret_cast<Type*>(fBu
ffer.get())) | 91 return sk_make_sp<SkMiniPicture<Type>>(cull, reinterpret_cast<Type*>(fBu
ffer.get())) |
| 92 | 92 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 117 | 117 |
| 118 switch (fState) { | 118 switch (fState) { |
| 119 case State::kEmpty: return; | 119 case State::kEmpty: return; |
| 120 CASE(DrawPath); | 120 CASE(DrawPath); |
| 121 CASE(DrawRect); | 121 CASE(DrawRect); |
| 122 CASE(DrawTextBlob); | 122 CASE(DrawTextBlob); |
| 123 } | 123 } |
| 124 SkASSERT(false); | 124 SkASSERT(false); |
| 125 #undef CASE | 125 #undef CASE |
| 126 } | 126 } |
| OLD | NEW |