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

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

Issue 1530203002: Reland of move drawSprite from canvas (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years 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/SkPictureRecord.cpp ('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"
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 DRAW(DrawOval, drawOval(r.oval, r.paint)); 104 DRAW(DrawOval, drawOval(r.oval, r.paint));
105 DRAW(DrawPaint, drawPaint(r.paint)); 105 DRAW(DrawPaint, drawPaint(r.paint));
106 DRAW(DrawPath, drawPath(r.path, r.paint)); 106 DRAW(DrawPath, drawPath(r.path, r.paint));
107 DRAW(DrawPatch, drawPatch(r.cubics, r.colors, r.texCoords, r.xmode, r.paint)); 107 DRAW(DrawPatch, drawPatch(r.cubics, r.colors, r.texCoords, r.xmode, r.paint));
108 DRAW(DrawPicture, drawPicture(r.picture, &r.matrix, r.paint)); 108 DRAW(DrawPicture, drawPicture(r.picture, &r.matrix, r.paint));
109 DRAW(DrawPoints, drawPoints(r.mode, r.count, r.pts, r.paint)); 109 DRAW(DrawPoints, drawPoints(r.mode, r.count, r.pts, r.paint));
110 DRAW(DrawPosText, drawPosText(r.text, r.byteLength, r.pos, r.paint)); 110 DRAW(DrawPosText, drawPosText(r.text, r.byteLength, r.pos, r.paint));
111 DRAW(DrawPosTextH, drawPosTextH(r.text, r.byteLength, r.xpos, r.y, r.paint)); 111 DRAW(DrawPosTextH, drawPosTextH(r.text, r.byteLength, r.xpos, r.y, r.paint));
112 DRAW(DrawRRect, drawRRect(r.rrect, r.paint)); 112 DRAW(DrawRRect, drawRRect(r.rrect, r.paint));
113 DRAW(DrawRect, drawRect(r.rect, r.paint)); 113 DRAW(DrawRect, drawRect(r.rect, r.paint));
114 DRAW(DrawSprite, drawSprite(r.bitmap.shallowCopy(), r.left, r.top, r.paint));
115 DRAW(DrawText, drawText(r.text, r.byteLength, r.x, r.y, r.paint)); 114 DRAW(DrawText, drawText(r.text, r.byteLength, r.x, r.y, r.paint));
116 DRAW(DrawTextBlob, drawTextBlob(r.blob, r.x, r.y, r.paint)); 115 DRAW(DrawTextBlob, drawTextBlob(r.blob, r.x, r.y, r.paint));
117 DRAW(DrawTextOnPath, drawTextOnPath(r.text, r.byteLength, r.path, &r.matrix, r.p aint)); 116 DRAW(DrawTextOnPath, drawTextOnPath(r.text, r.byteLength, r.path, &r.matrix, r.p aint));
118 DRAW(DrawAtlas, drawAtlas(r.atlas, r.xforms, r.texs, r.colors, r.count, r.mode, r.cull, r.paint)); 117 DRAW(DrawAtlas, drawAtlas(r.atlas, r.xforms, r.texs, r.colors, r.count, r.mode, r.cull, r.paint));
119 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,
120 r.xmode, r.indices, r.indexCount, r.paint)); 119 r.xmode, r.indices, r.indexCount, r.paint));
121 #undef DRAW 120 #undef DRAW
122 121
123 template <> void Draw::draw(const DrawDrawable& r) { 122 template <> void Draw::draw(const DrawDrawable& r) {
124 SkASSERT(r.index >= 0); 123 SkASSERT(r.index >= 0);
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 fSaveStack.top().bounds.join(bounds); 381 fSaveStack.top().bounds.join(bounds);
383 } 382 }
384 } 383 }
385 384
386 // FIXME: this method could use better bounds 385 // FIXME: this method could use better bounds
387 Bounds bounds(const DrawText&) const { return fCurrentClipBounds; } 386 Bounds bounds(const DrawText&) const { return fCurrentClipBounds; }
388 387
389 Bounds bounds(const DrawPaint&) const { return fCurrentClipBounds; } 388 Bounds bounds(const DrawPaint&) const { return fCurrentClipBounds; }
390 Bounds bounds(const NoOp&) const { return Bounds::MakeEmpty(); } // NoOp s don't draw. 389 Bounds bounds(const NoOp&) const { return Bounds::MakeEmpty(); } // NoOp s don't draw.
391 390
392 Bounds bounds(const DrawSprite& op) const { // Ignores the matrix, but resp ects the clip.
393 SkRect rect = Bounds::MakeXYWH(op.left, op.top, op.bitmap.width(), op.bi tmap.height());
394 if (!rect.intersect(fCurrentClipBounds)) {
395 return Bounds::MakeEmpty();
396 }
397 return rect;
398 }
399
400 Bounds bounds(const DrawRect& op) const { return this->adjustAndMap(op.rect, &op.paint); } 391 Bounds bounds(const DrawRect& op) const { return this->adjustAndMap(op.rect, &op.paint); }
401 Bounds bounds(const DrawOval& op) const { return this->adjustAndMap(op.oval, &op.paint); } 392 Bounds bounds(const DrawOval& op) const { return this->adjustAndMap(op.oval, &op.paint); }
402 Bounds bounds(const DrawRRect& op) const { 393 Bounds bounds(const DrawRRect& op) const {
403 return this->adjustAndMap(op.rrect.rect(), &op.paint); 394 return this->adjustAndMap(op.rrect.rect(), &op.paint);
404 } 395 }
405 Bounds bounds(const DrawDRRect& op) const { 396 Bounds bounds(const DrawDRRect& op) const {
406 return this->adjustAndMap(op.outer.rect(), &op.paint); 397 return this->adjustAndMap(op.outer.rect(), &op.paint);
407 } 398 }
408 Bounds bounds(const DrawImage& op) const { 399 Bounds bounds(const DrawImage& op) const {
409 const SkImage* image = op.image; 400 const SkImage* image = op.image;
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after
809 void SkRecordComputeLayers(const SkRect& cullRect, const SkRecord& record, SkRec t bounds[], 800 void SkRecordComputeLayers(const SkRect& cullRect, const SkRecord& record, SkRec t bounds[],
810 const SkBigPicture::SnapshotArray* pictList, SkLayerI nfo* data) { 801 const SkBigPicture::SnapshotArray* pictList, SkLayerI nfo* data) {
811 SkRecords::CollectLayers visitor(cullRect, record, bounds, pictList, data); 802 SkRecords::CollectLayers visitor(cullRect, record, bounds, pictList, data);
812 for (int curOp = 0; curOp < record.count(); curOp++) { 803 for (int curOp = 0; curOp < record.count(); curOp++) {
813 visitor.setCurrentOp(curOp); 804 visitor.setCurrentOp(curOp);
814 record.visit<void>(curOp, visitor); 805 record.visit<void>(curOp, visitor);
815 } 806 }
816 visitor.cleanUp(); 807 visitor.cleanUp();
817 } 808 }
818 809
OLDNEW
« no previous file with comments | « src/core/SkPictureRecord.cpp ('k') | src/core/SkRecorder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698