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 "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 Loading... |
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)); |
114 DRAW(DrawText, drawText(r.text, r.byteLength, r.x, r.y, r.paint)); | 115 DRAW(DrawText, drawText(r.text, r.byteLength, r.x, r.y, r.paint)); |
115 DRAW(DrawTextBlob, drawTextBlob(r.blob, r.x, r.y, r.paint)); | 116 DRAW(DrawTextBlob, drawTextBlob(r.blob, r.x, r.y, r.paint)); |
116 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)); |
117 DRAW(DrawAtlas, drawAtlas(r.atlas, r.xforms, r.texs, r.colors, r.count, r.mode,
r.cull, r.paint)); | 118 DRAW(DrawAtlas, drawAtlas(r.atlas, r.xforms, r.texs, r.colors, r.count, r.mode,
r.cull, r.paint)); |
118 DRAW(DrawVertices, drawVertices(r.vmode, r.vertexCount, r.vertices, r.texs, r.co
lors, | 119 DRAW(DrawVertices, drawVertices(r.vmode, r.vertexCount, r.vertices, r.texs, r.co
lors, |
119 r.xmode, r.indices, r.indexCount, r.paint)); | 120 r.xmode, r.indices, r.indexCount, r.paint)); |
120 #undef DRAW | 121 #undef DRAW |
121 | 122 |
122 template <> void Draw::draw(const DrawDrawable& r) { | 123 template <> void Draw::draw(const DrawDrawable& r) { |
123 SkASSERT(r.index >= 0); | 124 SkASSERT(r.index >= 0); |
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
381 fSaveStack.top().bounds.join(bounds); | 382 fSaveStack.top().bounds.join(bounds); |
382 } | 383 } |
383 } | 384 } |
384 | 385 |
385 // FIXME: this method could use better bounds | 386 // FIXME: this method could use better bounds |
386 Bounds bounds(const DrawText&) const { return fCurrentClipBounds; } | 387 Bounds bounds(const DrawText&) const { return fCurrentClipBounds; } |
387 | 388 |
388 Bounds bounds(const DrawPaint&) const { return fCurrentClipBounds; } | 389 Bounds bounds(const DrawPaint&) const { return fCurrentClipBounds; } |
389 Bounds bounds(const NoOp&) const { return Bounds::MakeEmpty(); } // NoOp
s don't draw. | 390 Bounds bounds(const NoOp&) const { return Bounds::MakeEmpty(); } // NoOp
s don't draw. |
390 | 391 |
| 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 |
391 Bounds bounds(const DrawRect& op) const { return this->adjustAndMap(op.rect,
&op.paint); } | 400 Bounds bounds(const DrawRect& op) const { return this->adjustAndMap(op.rect,
&op.paint); } |
392 Bounds bounds(const DrawOval& op) const { return this->adjustAndMap(op.oval,
&op.paint); } | 401 Bounds bounds(const DrawOval& op) const { return this->adjustAndMap(op.oval,
&op.paint); } |
393 Bounds bounds(const DrawRRect& op) const { | 402 Bounds bounds(const DrawRRect& op) const { |
394 return this->adjustAndMap(op.rrect.rect(), &op.paint); | 403 return this->adjustAndMap(op.rrect.rect(), &op.paint); |
395 } | 404 } |
396 Bounds bounds(const DrawDRRect& op) const { | 405 Bounds bounds(const DrawDRRect& op) const { |
397 return this->adjustAndMap(op.outer.rect(), &op.paint); | 406 return this->adjustAndMap(op.outer.rect(), &op.paint); |
398 } | 407 } |
399 Bounds bounds(const DrawImage& op) const { | 408 Bounds bounds(const DrawImage& op) const { |
400 const SkImage* image = op.image; | 409 const SkImage* image = op.image; |
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
800 void SkRecordComputeLayers(const SkRect& cullRect, const SkRecord& record, SkRec
t bounds[], | 809 void SkRecordComputeLayers(const SkRect& cullRect, const SkRecord& record, SkRec
t bounds[], |
801 const SkBigPicture::SnapshotArray* pictList, SkLayerI
nfo* data) { | 810 const SkBigPicture::SnapshotArray* pictList, SkLayerI
nfo* data) { |
802 SkRecords::CollectLayers visitor(cullRect, record, bounds, pictList, data); | 811 SkRecords::CollectLayers visitor(cullRect, record, bounds, pictList, data); |
803 for (int curOp = 0; curOp < record.count(); curOp++) { | 812 for (int curOp = 0; curOp < record.count(); curOp++) { |
804 visitor.setCurrentOp(curOp); | 813 visitor.setCurrentOp(curOp); |
805 record.visit<void>(curOp, visitor); | 814 record.visit<void>(curOp, visitor); |
806 } | 815 } |
807 visitor.cleanUp(); | 816 visitor.cleanUp(); |
808 } | 817 } |
809 | 818 |
OLD | NEW |