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

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

Issue 501533003: Support comment groups in SkRecord. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: add unit test Created 6 years, 4 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/SkRecorder.h ('k') | src/core/SkRecords.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 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 "SkRecorder.h" 8 #include "SkRecorder.h"
9 #include "SkPatchUtils.h" 9 #include "SkPatchUtils.h"
10 #include "SkPicture.h" 10 #include "SkPicture.h"
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 template <> 75 template <>
76 char* SkRecorder::copy(const char src[], size_t count) { 76 char* SkRecorder::copy(const char src[], size_t count) {
77 if (NULL == src) { 77 if (NULL == src) {
78 return NULL; 78 return NULL;
79 } 79 }
80 char* dst = fRecord->alloc<char>(count); 80 char* dst = fRecord->alloc<char>(count);
81 memcpy(dst, src, count); 81 memcpy(dst, src, count);
82 return dst; 82 return dst;
83 } 83 }
84 84
85 // As above, assuming and copying a terminating \0.
86 template <>
87 char* SkRecorder::copy(const char* src) {
88 return this->copy(src, strlen(src)+1);
89 }
90
91
85 void SkRecorder::clear(SkColor color) { 92 void SkRecorder::clear(SkColor color) {
86 APPEND(Clear, color); 93 APPEND(Clear, color);
87 } 94 }
88 95
89 void SkRecorder::drawPaint(const SkPaint& paint) { 96 void SkRecorder::drawPaint(const SkPaint& paint) {
90 APPEND(DrawPaint, delay_copy(paint)); 97 APPEND(DrawPaint, delay_copy(paint));
91 } 98 }
92 99
93 void SkRecorder::drawPoints(PointMode mode, 100 void SkRecorder::drawPoints(PointMode mode,
94 size_t count, 101 size_t count,
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 276
270 void SkRecorder::onClipPath(const SkPath& path, SkRegion::Op op, ClipEdgeStyle e dgeStyle) { 277 void SkRecorder::onClipPath(const SkPath& path, SkRegion::Op op, ClipEdgeStyle e dgeStyle) {
271 INHERITED(updateClipConservativelyUsingBounds, path.getBounds(), op, path.is InverseFillType()); 278 INHERITED(updateClipConservativelyUsingBounds, path.getBounds(), op, path.is InverseFillType());
272 APPEND(ClipPath, this->devBounds(), delay_copy(path), op, edgeStyle == kSoft _ClipEdgeStyle); 279 APPEND(ClipPath, this->devBounds(), delay_copy(path), op, edgeStyle == kSoft _ClipEdgeStyle);
273 } 280 }
274 281
275 void SkRecorder::onClipRegion(const SkRegion& deviceRgn, SkRegion::Op op) { 282 void SkRecorder::onClipRegion(const SkRegion& deviceRgn, SkRegion::Op op) {
276 INHERITED(onClipRegion, deviceRgn, op); 283 INHERITED(onClipRegion, deviceRgn, op);
277 APPEND(ClipRegion, this->devBounds(), delay_copy(deviceRgn), op); 284 APPEND(ClipRegion, this->devBounds(), delay_copy(deviceRgn), op);
278 } 285 }
286
287 void SkRecorder::beginCommentGroup(const char* description) {
288 APPEND(BeginCommentGroup, this->copy(description));
289 }
290
291 void SkRecorder::addComment(const char* key, const char* value) {
292 APPEND(AddComment, this->copy(key), this->copy(value));
293 }
294
295 void SkRecorder::endCommentGroup() {
296 APPEND(EndCommentGroup);
297 }
OLDNEW
« no previous file with comments | « src/core/SkRecorder.h ('k') | src/core/SkRecords.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698