| 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 | 10 |
| (...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 449 SkASSERT(pad.fTop == -pad.fBottom); | 449 SkASSERT(pad.fTop == -pad.fBottom); |
| 450 SkASSERT(pad.fRight > pad.fBottom); | 450 SkASSERT(pad.fRight > pad.fBottom); |
| 451 dst.outset(pad.fRight, pad.fRight); | 451 dst.outset(pad.fRight, pad.fRight); |
| 452 | 452 |
| 453 return this->adjustAndMap(dst, &op.paint); | 453 return this->adjustAndMap(dst, &op.paint); |
| 454 } | 454 } |
| 455 | 455 |
| 456 Bounds bounds(const DrawTextBlob& op) const { | 456 Bounds bounds(const DrawTextBlob& op) const { |
| 457 SkRect dst = op.blob->bounds(); | 457 SkRect dst = op.blob->bounds(); |
| 458 dst.offset(op.x, op.y); | 458 dst.offset(op.x, op.y); |
| 459 // TODO: remove when implicit bounds are plumbed through | |
| 460 if (dst.isEmpty()) { | |
| 461 return fCurrentClipBounds; | |
| 462 } | |
| 463 return this->adjustAndMap(dst, &op.paint); | 459 return this->adjustAndMap(dst, &op.paint); |
| 464 } | 460 } |
| 465 | 461 |
| 466 static void AdjustTextForFontMetrics(SkRect* rect, const SkPaint& paint) { | 462 static void AdjustTextForFontMetrics(SkRect* rect, const SkPaint& paint) { |
| 467 #ifdef SK_DEBUG | 463 #ifdef SK_DEBUG |
| 468 SkRect correct = *rect; | 464 SkRect correct = *rect; |
| 469 #endif | 465 #endif |
| 470 const SkScalar yPad = 2.0f * paint.getTextSize(), // In practice, this
seems to be enough. | 466 const SkScalar yPad = 2.0f * paint.getTextSize(), // In practice, this
seems to be enough. |
| 471 xPad = 4.0f * yPad; // Hack for very wide
Github logo font. | 467 xPad = 4.0f * yPad; // Hack for very wide
Github logo font. |
| 472 rect->outset(xPad, yPad); | 468 rect->outset(xPad, yPad); |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 546 // Used to track the bounds of Save/Restore blocks and the control ops insid
e them. | 542 // Used to track the bounds of Save/Restore blocks and the control ops insid
e them. |
| 547 SkTDArray<SaveBounds> fSaveStack; | 543 SkTDArray<SaveBounds> fSaveStack; |
| 548 SkTDArray<unsigned> fControlIndices; | 544 SkTDArray<unsigned> fControlIndices; |
| 549 }; | 545 }; |
| 550 | 546 |
| 551 } // namespace SkRecords | 547 } // namespace SkRecords |
| 552 | 548 |
| 553 void SkRecordFillBounds(const SkRecord& record, SkBBoxHierarchy* bbh) { | 549 void SkRecordFillBounds(const SkRecord& record, SkBBoxHierarchy* bbh) { |
| 554 SkRecords::FillBounds(record, bbh); | 550 SkRecords::FillBounds(record, bbh); |
| 555 } | 551 } |
| OLD | NEW |