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

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

Issue 903993002: rename SkCanvasDrawable to SkDrawable, and make public (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: add dox for drawDrawable Created 5 years, 10 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"
11 11
12 SkCanvasDrawableList::~SkCanvasDrawableList() { 12 SkDrawableList::~SkDrawableList() {
13 fArray.unrefAll(); 13 fArray.unrefAll();
14 } 14 }
15 15
16 SkPicture::SnapshotArray* SkCanvasDrawableList::newDrawableSnapshot() { 16 SkPicture::SnapshotArray* SkDrawableList::newDrawableSnapshot() {
17 const int count = fArray.count(); 17 const int count = fArray.count();
18 if (0 == count) { 18 if (0 == count) {
19 return NULL; 19 return NULL;
20 } 20 }
21 SkAutoTMalloc<const SkPicture*> pics(count); 21 SkAutoTMalloc<const SkPicture*> pics(count);
22 for (int i = 0; i < count; ++i) { 22 for (int i = 0; i < count; ++i) {
23 pics[i] = fArray[i]->newPictureSnapshot(); 23 pics[i] = fArray[i]->newPictureSnapshot();
24 } 24 }
25 return SkNEW_ARGS(SkPicture::SnapshotArray, (pics.detach(), count)); 25 return SkNEW_ARGS(SkPicture::SnapshotArray, (pics.detach(), count));
26 } 26 }
27 27
28 void SkCanvasDrawableList::append(SkCanvasDrawable* drawable) { 28 void SkDrawableList::append(SkDrawable* drawable) {
29 *fArray.append() = SkRef(drawable); 29 *fArray.append() = SkRef(drawable);
30 } 30 }
31 31
32 //////////////////////////////////////////////////////////////////////////////// /////////////// 32 //////////////////////////////////////////////////////////////////////////////// ///////////////
33 33
34 SkRecorder::SkRecorder(SkRecord* record, int width, int height) 34 SkRecorder::SkRecorder(SkRecord* record, int width, int height)
35 : SkCanvas(SkIRect::MakeWH(width, height), SkCanvas::kConservativeRasterClip _InitFlag) 35 : SkCanvas(SkIRect::MakeWH(width, height), SkCanvas::kConservativeRasterClip _InitFlag)
36 , fRecord(record) {} 36 , fRecord(record) {}
37 37
38 SkRecorder::SkRecorder(SkRecord* record, const SkRect& bounds) 38 SkRecorder::SkRecorder(SkRecord* record, const SkRect& bounds)
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 } 136 }
137 137
138 void SkRecorder::onDrawRRect(const SkRRect& rrect, const SkPaint& paint) { 138 void SkRecorder::onDrawRRect(const SkRRect& rrect, const SkPaint& paint) {
139 APPEND(DrawRRect, delay_copy(paint), rrect); 139 APPEND(DrawRRect, delay_copy(paint), rrect);
140 } 140 }
141 141
142 void SkRecorder::onDrawDRRect(const SkRRect& outer, const SkRRect& inner, const SkPaint& paint) { 142 void SkRecorder::onDrawDRRect(const SkRRect& outer, const SkRRect& inner, const SkPaint& paint) {
143 APPEND(DrawDRRect, delay_copy(paint), outer, inner); 143 APPEND(DrawDRRect, delay_copy(paint), outer, inner);
144 } 144 }
145 145
146 void SkRecorder::onDrawDrawable(SkCanvasDrawable* drawable) { 146 void SkRecorder::onDrawDrawable(SkDrawable* drawable) {
147 if (!fDrawableList) { 147 if (!fDrawableList) {
148 fDrawableList.reset(SkNEW(SkCanvasDrawableList)); 148 fDrawableList.reset(SkNEW(SkDrawableList));
149 } 149 }
150 fDrawableList->append(drawable); 150 fDrawableList->append(drawable);
151 APPEND(DrawDrawable, drawable->getBounds(), fDrawableList->count() - 1); 151 APPEND(DrawDrawable, drawable->getBounds(), fDrawableList->count() - 1);
152 } 152 }
153 153
154 void SkRecorder::onDrawPath(const SkPath& path, const SkPaint& paint) { 154 void SkRecorder::onDrawPath(const SkPath& path, const SkPaint& paint) {
155 APPEND(DrawPath, delay_copy(paint), delay_copy(path)); 155 APPEND(DrawPath, delay_copy(paint), delay_copy(path));
156 } 156 }
157 157
158 void SkRecorder::onDrawBitmap(const SkBitmap& bitmap, 158 void SkRecorder::onDrawBitmap(const SkBitmap& bitmap,
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 } 326 }
327 327
328 void SkRecorder::addComment(const char* key, const char* value) { 328 void SkRecorder::addComment(const char* key, const char* value) {
329 APPEND(AddComment, this->copy(key), this->copy(value)); 329 APPEND(AddComment, this->copy(key), this->copy(value));
330 } 330 }
331 331
332 void SkRecorder::endCommentGroup() { 332 void SkRecorder::endCommentGroup() {
333 APPEND(EndCommentGroup); 333 APPEND(EndCommentGroup);
334 } 334 }
335 335
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