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

Side by Side Diff: src/core/SkRecordDraw.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/SkRecordDraw.h ('k') | src/core/SkRecorder.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 "SkLayerInfo.h" 8 #include "SkLayerInfo.h"
9 #include "SkRecordDraw.h" 9 #include "SkRecordDraw.h"
10 #include "SkPatchUtils.h" 10 #include "SkPatchUtils.h"
11 11
12 void SkRecordDraw(const SkRecord& record, 12 void SkRecordDraw(const SkRecord& record,
13 SkCanvas* canvas, 13 SkCanvas* canvas,
14 SkPicture const* const drawablePicts[], 14 SkPicture const* const drawablePicts[],
15 SkCanvasDrawable* const drawables[], 15 SkDrawable* const drawables[],
16 int drawableCount, 16 int drawableCount,
17 const SkBBoxHierarchy* bbh, 17 const SkBBoxHierarchy* bbh,
18 SkPicture::AbortCallback* callback) { 18 SkPicture::AbortCallback* callback) {
19 SkAutoCanvasRestore saveRestore(canvas, true /*save now, restore at exit*/); 19 SkAutoCanvasRestore saveRestore(canvas, true /*save now, restore at exit*/);
20 20
21 if (bbh) { 21 if (bbh) {
22 // Draw only ops that affect pixels in the canvas's current clip. 22 // Draw only ops that affect pixels in the canvas's current clip.
23 // The SkRecord and BBH were recorded in identity space. This canvas 23 // The SkRecord and BBH were recorded in identity space. This canvas
24 // is not necessarily in that same space. getClipBounds() returns us 24 // is not necessarily in that same space. getClipBounds() returns us
25 // this canvas' clip bounds transformed back into identity space, which 25 // this canvas' clip bounds transformed back into identity space, which
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 DRAW(DrawTextOnPath, drawTextOnPath(r.text, r.byteLength, r.path, &r.matrix, r.p aint)); 117 DRAW(DrawTextOnPath, drawTextOnPath(r.text, r.byteLength, r.path, &r.matrix, r.p aint));
118 DRAW(DrawVertices, drawVertices(r.vmode, r.vertexCount, r.vertices, r.texs, r.co lors, 118 DRAW(DrawVertices, drawVertices(r.vmode, r.vertexCount, r.vertices, r.texs, r.co lors,
119 r.xmode.get(), r.indices, r.indexCount, r.paint) ); 119 r.xmode.get(), r.indices, r.indexCount, r.paint) );
120 #undef DRAW 120 #undef DRAW
121 121
122 template <> void Draw::draw(const DrawDrawable& r) { 122 template <> void Draw::draw(const DrawDrawable& r) {
123 SkASSERT(r.index >= 0); 123 SkASSERT(r.index >= 0);
124 SkASSERT(r.index < fDrawableCount); 124 SkASSERT(r.index < fDrawableCount);
125 if (fDrawables) { 125 if (fDrawables) {
126 SkASSERT(NULL == fDrawablePicts); 126 SkASSERT(NULL == fDrawablePicts);
127 fCanvas->EXPERIMENTAL_drawDrawable(fDrawables[r.index]); 127 fCanvas->drawDrawable(fDrawables[r.index]);
128 } else { 128 } else {
129 fCanvas->drawPicture(fDrawablePicts[r.index]); 129 fCanvas->drawPicture(fDrawablePicts[r.index]);
130 } 130 }
131 } 131 }
132 132
133 // This is an SkRecord visitor that fills an SkBBoxHierarchy. 133 // This is an SkRecord visitor that fills an SkBBoxHierarchy.
134 // 134 //
135 // The interesting part here is how to calculate bounds for ops which don't 135 // The interesting part here is how to calculate bounds for ops which don't
136 // have intrinsic bounds. What is the bounds of a Save or a Translate? 136 // have intrinsic bounds. What is the bounds of a Save or a Translate?
137 // 137 //
(...skipping 649 matching lines...) Expand 10 before | Expand all | Expand 10 after
787 SkRecords::CollectLayers visitor(cullRect, record, pictList, data); 787 SkRecords::CollectLayers visitor(cullRect, record, pictList, data);
788 788
789 for (unsigned curOp = 0; curOp < record.count(); curOp++) { 789 for (unsigned curOp = 0; curOp < record.count(); curOp++) {
790 visitor.setCurrentOp(curOp); 790 visitor.setCurrentOp(curOp);
791 record.visit<void>(curOp, visitor); 791 record.visit<void>(curOp, visitor);
792 } 792 }
793 793
794 visitor.cleanUp(bbh); 794 visitor.cleanUp(bbh);
795 } 795 }
796 796
OLDNEW
« no previous file with comments | « src/core/SkRecordDraw.h ('k') | src/core/SkRecorder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698