| 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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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(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)); |
| 115 DRAW(DrawTextBlob, drawTextBlob(r.blob, r.x, r.y, r.paint)); | 115 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)); | 116 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)); | 117 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, | 118 DRAW(DrawVertices, drawVertices(r.vmode, r.vertexCount, r.vertices, r.texs, r.co
lors, |
| 119 r.xmode, r.indices, r.indexCount, r.paint)); | 119 r.xmode, r.indices, r.indexCount, r.paint)); |
| 120 DRAW(DrawAnnotation, drawAnnotation(r.rect, r.key.c_str(), r.value)); | |
| 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); |
| 125 SkASSERT(r.index < fDrawableCount); | 124 SkASSERT(r.index < fDrawableCount); |
| 126 if (fDrawables) { | 125 if (fDrawables) { |
| 127 SkASSERT(nullptr == fDrawablePicts); | 126 SkASSERT(nullptr == fDrawablePicts); |
| 128 fCanvas->drawDrawable(fDrawables[r.index], r.matrix); | 127 fCanvas->drawDrawable(fDrawables[r.index], r.matrix); |
| 129 } else { | 128 } else { |
| 130 fCanvas->drawPicture(fDrawablePicts[r.index], r.matrix, nullptr); | 129 fCanvas->drawPicture(fDrawablePicts[r.index], r.matrix, nullptr); |
| (...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 511 Bounds bounds(const DrawTextBlob& op) const { | 510 Bounds bounds(const DrawTextBlob& op) const { |
| 512 SkRect dst = op.blob->bounds(); | 511 SkRect dst = op.blob->bounds(); |
| 513 dst.offset(op.x, op.y); | 512 dst.offset(op.x, op.y); |
| 514 return this->adjustAndMap(dst, &op.paint); | 513 return this->adjustAndMap(dst, &op.paint); |
| 515 } | 514 } |
| 516 | 515 |
| 517 Bounds bounds(const DrawDrawable& op) const { | 516 Bounds bounds(const DrawDrawable& op) const { |
| 518 return this->adjustAndMap(op.worstCaseBounds, nullptr); | 517 return this->adjustAndMap(op.worstCaseBounds, nullptr); |
| 519 } | 518 } |
| 520 | 519 |
| 521 Bounds bounds(const DrawAnnotation& op) const { | |
| 522 return this->adjustAndMap(op.rect, nullptr); | |
| 523 } | |
| 524 | |
| 525 static void AdjustTextForFontMetrics(SkRect* rect, const SkPaint& paint) { | 520 static void AdjustTextForFontMetrics(SkRect* rect, const SkPaint& paint) { |
| 526 #ifdef SK_DEBUG | 521 #ifdef SK_DEBUG |
| 527 SkRect correct = *rect; | 522 SkRect correct = *rect; |
| 528 #endif | 523 #endif |
| 529 // crbug.com/373785 ~~> xPad = 4x yPad | 524 // crbug.com/373785 ~~> xPad = 4x yPad |
| 530 // crbug.com/424824 ~~> bump yPad from 2x text size to 2.5x | 525 // crbug.com/424824 ~~> bump yPad from 2x text size to 2.5x |
| 531 const SkScalar yPad = 2.5f * paint.getTextSize(), | 526 const SkScalar yPad = 2.5f * paint.getTextSize(), |
| 532 xPad = 4.0f * yPad; | 527 xPad = 4.0f * yPad; |
| 533 rect->outset(xPad, yPad); | 528 rect->outset(xPad, yPad); |
| 534 #ifdef SK_DEBUG | 529 #ifdef SK_DEBUG |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 805 void SkRecordComputeLayers(const SkRect& cullRect, const SkRecord& record, SkRec
t bounds[], | 800 void SkRecordComputeLayers(const SkRect& cullRect, const SkRecord& record, SkRec
t bounds[], |
| 806 const SkBigPicture::SnapshotArray* pictList, SkLayerI
nfo* data) { | 801 const SkBigPicture::SnapshotArray* pictList, SkLayerI
nfo* data) { |
| 807 SkRecords::CollectLayers visitor(cullRect, record, bounds, pictList, data); | 802 SkRecords::CollectLayers visitor(cullRect, record, bounds, pictList, data); |
| 808 for (int curOp = 0; curOp < record.count(); curOp++) { | 803 for (int curOp = 0; curOp < record.count(); curOp++) { |
| 809 visitor.setCurrentOp(curOp); | 804 visitor.setCurrentOp(curOp); |
| 810 record.visit<void>(curOp, visitor); | 805 record.visit<void>(curOp, visitor); |
| 811 } | 806 } |
| 812 visitor.cleanUp(); | 807 visitor.cleanUp(); |
| 813 } | 808 } |
| 814 | 809 |
| OLD | NEW |