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

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

Issue 654873003: Implicit SkTextBlob bounds (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: we don't need glyph widths Created 6 years, 2 months 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/SkCanvas.cpp ('k') | src/core/SkTextBlob.cpp » ('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 "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
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
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 }
OLDNEW
« no previous file with comments | « src/core/SkCanvas.cpp ('k') | src/core/SkTextBlob.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698