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 "SkRecordDraw.h" | 8 #include "SkRecordDraw.h" |
9 #include "SkPatchUtils.h" | 9 #include "SkPatchUtils.h" |
10 #include "SkTLogic.h" | 10 #include "SkTLogic.h" |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 DRAW(BeginCommentGroup, beginCommentGroup(r.description)); | 87 DRAW(BeginCommentGroup, beginCommentGroup(r.description)); |
88 DRAW(AddComment, addComment(r.key, r.value)); | 88 DRAW(AddComment, addComment(r.key, r.value)); |
89 DRAW(EndCommentGroup, endCommentGroup()); | 89 DRAW(EndCommentGroup, endCommentGroup()); |
90 | 90 |
91 DRAW(DrawBitmap, drawBitmap(shallow_copy(r.bitmap), r.left, r.top, r.paint)); | 91 DRAW(DrawBitmap, drawBitmap(shallow_copy(r.bitmap), r.left, r.top, r.paint)); |
92 DRAW(DrawBitmapMatrix, drawBitmapMatrix(shallow_copy(r.bitmap), r.matrix, r.pain
t)); | 92 DRAW(DrawBitmapMatrix, drawBitmapMatrix(shallow_copy(r.bitmap), r.matrix, r.pain
t)); |
93 DRAW(DrawBitmapNine, drawBitmapNine(shallow_copy(r.bitmap), r.center, r.dst, r.p
aint)); | 93 DRAW(DrawBitmapNine, drawBitmapNine(shallow_copy(r.bitmap), r.center, r.dst, r.p
aint)); |
94 DRAW(DrawBitmapRectToRect, | 94 DRAW(DrawBitmapRectToRect, |
95 drawBitmapRectToRect(shallow_copy(r.bitmap), r.src, r.dst, r.paint, r.fl
ags)); | 95 drawBitmapRectToRect(shallow_copy(r.bitmap), r.src, r.dst, r.paint, r.fl
ags)); |
96 DRAW(DrawDRRect, drawDRRect(r.outer, r.inner, r.paint)); | 96 DRAW(DrawDRRect, drawDRRect(r.outer, r.inner, r.paint)); |
| 97 DRAW(DrawImage, drawImage(r.image, r.left, r.top, r.paint)); |
| 98 DRAW(DrawImageRect, drawImageRect(r.image, r.src, r.dst, r.paint)); |
97 DRAW(DrawOval, drawOval(r.oval, r.paint)); | 99 DRAW(DrawOval, drawOval(r.oval, r.paint)); |
98 DRAW(DrawPaint, drawPaint(r.paint)); | 100 DRAW(DrawPaint, drawPaint(r.paint)); |
99 DRAW(DrawPath, drawPath(r.path, r.paint)); | 101 DRAW(DrawPath, drawPath(r.path, r.paint)); |
100 DRAW(DrawPatch, drawPatch(r.cubics, r.colors, r.texCoords, r.xmode, r.paint)); | 102 DRAW(DrawPatch, drawPatch(r.cubics, r.colors, r.texCoords, r.xmode, r.paint)); |
101 DRAW(DrawPicture, drawPicture(r.picture, r.matrix, r.paint)); | 103 DRAW(DrawPicture, drawPicture(r.picture, r.matrix, r.paint)); |
102 DRAW(DrawPoints, drawPoints(r.mode, r.count, r.pts, r.paint)); | 104 DRAW(DrawPoints, drawPoints(r.mode, r.count, r.pts, r.paint)); |
103 DRAW(DrawPosText, drawPosText(r.text, r.byteLength, r.pos, r.paint)); | 105 DRAW(DrawPosText, drawPosText(r.text, r.byteLength, r.pos, r.paint)); |
104 DRAW(DrawPosTextH, drawPosTextH(r.text, r.byteLength, r.xpos, r.y, r.paint)); | 106 DRAW(DrawPosTextH, drawPosTextH(r.text, r.byteLength, r.xpos, r.y, r.paint)); |
105 DRAW(DrawRRect, drawRRect(r.rrect, r.paint)); | 107 DRAW(DrawRRect, drawRRect(r.rrect, r.paint)); |
106 DRAW(DrawRect, drawRect(r.rect, r.paint)); | 108 DRAW(DrawRect, drawRect(r.rect, r.paint)); |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 } | 334 } |
333 | 335 |
334 Bounds bounds(const DrawRect& op) const { return this->adjustAndMap(op.rect,
&op.paint); } | 336 Bounds bounds(const DrawRect& op) const { return this->adjustAndMap(op.rect,
&op.paint); } |
335 Bounds bounds(const DrawOval& op) const { return this->adjustAndMap(op.oval,
&op.paint); } | 337 Bounds bounds(const DrawOval& op) const { return this->adjustAndMap(op.oval,
&op.paint); } |
336 Bounds bounds(const DrawRRect& op) const { | 338 Bounds bounds(const DrawRRect& op) const { |
337 return this->adjustAndMap(op.rrect.rect(), &op.paint); | 339 return this->adjustAndMap(op.rrect.rect(), &op.paint); |
338 } | 340 } |
339 Bounds bounds(const DrawDRRect& op) const { | 341 Bounds bounds(const DrawDRRect& op) const { |
340 return this->adjustAndMap(op.outer.rect(), &op.paint); | 342 return this->adjustAndMap(op.outer.rect(), &op.paint); |
341 } | 343 } |
| 344 Bounds bounds(const DrawImage& op) const { |
| 345 const SkImage* image = op.image; |
| 346 SkRect rect = SkRect::MakeXYWH(op.left, op.top, image->width(), image->h
eight()); |
342 | 347 |
| 348 return this->adjustAndMap(rect, op.paint); |
| 349 } |
| 350 Bounds bounds(const DrawImageRect& op) const { |
| 351 return this->adjustAndMap(op.dst, op.paint); |
| 352 } |
343 Bounds bounds(const DrawBitmapRectToRect& op) const { | 353 Bounds bounds(const DrawBitmapRectToRect& op) const { |
344 return this->adjustAndMap(op.dst, op.paint); | 354 return this->adjustAndMap(op.dst, op.paint); |
345 } | 355 } |
346 Bounds bounds(const DrawBitmapNine& op) const { | 356 Bounds bounds(const DrawBitmapNine& op) const { |
347 return this->adjustAndMap(op.dst, op.paint); | 357 return this->adjustAndMap(op.dst, op.paint); |
348 } | 358 } |
349 Bounds bounds(const DrawBitmap& op) const { | 359 Bounds bounds(const DrawBitmap& op) const { |
350 const SkBitmap& bm = op.bitmap; | 360 const SkBitmap& bm = op.bitmap; |
351 return this->adjustAndMap(SkRect::MakeXYWH(op.left, op.top, bm.width(),
bm.height()), | 361 return this->adjustAndMap(SkRect::MakeXYWH(op.left, op.top, bm.width(),
bm.height()), |
352 op.paint); | 362 op.paint); |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
526 // Used to track the bounds of Save/Restore blocks and the control ops insid
e them. | 536 // Used to track the bounds of Save/Restore blocks and the control ops insid
e them. |
527 SkTDArray<SaveBounds> fSaveStack; | 537 SkTDArray<SaveBounds> fSaveStack; |
528 SkTDArray<unsigned> fControlIndices; | 538 SkTDArray<unsigned> fControlIndices; |
529 }; | 539 }; |
530 | 540 |
531 } // namespace SkRecords | 541 } // namespace SkRecords |
532 | 542 |
533 void SkRecordFillBounds(const SkRecord& record, SkBBoxHierarchy* bbh) { | 543 void SkRecordFillBounds(const SkRecord& record, SkBBoxHierarchy* bbh) { |
534 SkRecords::FillBounds(record, bbh); | 544 SkRecords::FillBounds(record, bbh); |
535 } | 545 } |
OLD | NEW |