OLD | NEW |
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 "SkPatchUtils.h" | 9 #include "SkPatchUtils.h" |
10 #include "SkPicture.h" | 10 #include "SkPicture.h" |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 | 129 |
130 // As above, assuming and copying a terminating \0. | 130 // As above, assuming and copying a terminating \0. |
131 template <> | 131 template <> |
132 char* SkRecorder::copy(const char* src) { | 132 char* SkRecorder::copy(const char* src) { |
133 return this->copy(src, strlen(src)+1); | 133 return this->copy(src, strlen(src)+1); |
134 } | 134 } |
135 | 135 |
136 void SkRecorder::flushMiniRecorder() { | 136 void SkRecorder::flushMiniRecorder() { |
137 if (fMiniRecorder) { | 137 if (fMiniRecorder) { |
138 SkMiniRecorder* mr = fMiniRecorder; | 138 SkMiniRecorder* mr = fMiniRecorder; |
139 fMiniRecorder = nullptr; // Needs to happen before p->playback(this) or
we loop forever. | 139 fMiniRecorder = nullptr; // Needs to happen before flushAndReset() or w
e recurse forever. |
140 // TODO: this can probably be done more efficiently by SkMiniRecorder if
it matters. | 140 mr->flushAndReset(this); |
141 SkAutoTUnref<SkPicture> p(mr->detachAsPicture(SkRect::MakeEmpty())); | |
142 p->playback(this); | |
143 } | 141 } |
144 } | 142 } |
145 | 143 |
146 void SkRecorder::onDrawPaint(const SkPaint& paint) { | 144 void SkRecorder::onDrawPaint(const SkPaint& paint) { |
147 APPEND(DrawPaint, delay_copy(paint)); | 145 APPEND(DrawPaint, delay_copy(paint)); |
148 } | 146 } |
149 | 147 |
150 void SkRecorder::onDrawPoints(PointMode mode, | 148 void SkRecorder::onDrawPoints(PointMode mode, |
151 size_t count, | 149 size_t count, |
152 const SkPoint pts[], | 150 const SkPoint pts[], |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
357 } | 355 } |
358 | 356 |
359 void SkRecorder::addComment(const char* key, const char* value) { | 357 void SkRecorder::addComment(const char* key, const char* value) { |
360 APPEND(AddComment, this->copy(key), this->copy(value)); | 358 APPEND(AddComment, this->copy(key), this->copy(value)); |
361 } | 359 } |
362 | 360 |
363 void SkRecorder::endCommentGroup() { | 361 void SkRecorder::endCommentGroup() { |
364 APPEND(EndCommentGroup); | 362 APPEND(EndCommentGroup); |
365 } | 363 } |
366 | 364 |
OLD | NEW |