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

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

Issue 496153002: 1.5x -> 2x text size for y pad. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 4 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 | « no previous file | no next file » | 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 "SkTSort.h" 9 #include "SkTSort.h"
10 10
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 } 309 }
310 SkRect dst = { left, op.y, right, op.y }; 310 SkRect dst = { left, op.y, right, op.y };
311 AdjustTextForFontMetrics(&dst, op.paint); 311 AdjustTextForFontMetrics(&dst, op.paint);
312 return this->adjustAndMap(dst, &op.paint); 312 return this->adjustAndMap(dst, &op.paint);
313 } 313 }
314 314
315 static void AdjustTextForFontMetrics(SkRect* rect, const SkPaint& paint) { 315 static void AdjustTextForFontMetrics(SkRect* rect, const SkPaint& paint) {
316 #ifdef SK_DEBUG 316 #ifdef SK_DEBUG
317 SkRect correct = *rect; 317 SkRect correct = *rect;
318 #endif 318 #endif
319 const SkScalar yPad = 1.5f * paint.getTextSize(), // In practice, this seems to be enough. 319 const SkScalar yPad = 2.0f * paint.getTextSize(), // In practice, this seems to be enough.
320 xPad = 4.0f * yPad; // Hack for very wide Github logo font. 320 xPad = 4.0f * yPad; // Hack for very wide Github logo font.
321 rect->outset(xPad, yPad); 321 rect->outset(xPad, yPad);
322 #ifdef SK_DEBUG 322 #ifdef SK_DEBUG
323 SkPaint::FontMetrics metrics; 323 SkPaint::FontMetrics metrics;
324 paint.getFontMetrics(&metrics); 324 paint.getFontMetrics(&metrics);
325 correct.fLeft += metrics.fXMin; 325 correct.fLeft += metrics.fXMin;
326 correct.fTop += metrics.fTop; 326 correct.fTop += metrics.fTop;
327 correct.fRight += metrics.fXMax; 327 correct.fRight += metrics.fXMax;
328 correct.fBottom += metrics.fBottom; 328 correct.fBottom += metrics.fBottom;
329 // See skia:2862 for why we ignore small text sizes. 329 // See skia:2862 for why we ignore small text sizes.
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 // Used to track the bounds of Save/Restore blocks and the control ops insid e them. 390 // Used to track the bounds of Save/Restore blocks and the control ops insid e them.
391 SkTDArray<SaveBounds> fSaveStack; 391 SkTDArray<SaveBounds> fSaveStack;
392 SkTDArray<unsigned> fControlIndices; 392 SkTDArray<unsigned> fControlIndices;
393 }; 393 };
394 394
395 } // namespace SkRecords 395 } // namespace SkRecords
396 396
397 void SkRecordFillBounds(const SkRecord& record, SkBBoxHierarchy* bbh) { 397 void SkRecordFillBounds(const SkRecord& record, SkBBoxHierarchy* bbh) {
398 SkRecords::FillBounds(record, bbh); 398 SkRecords::FillBounds(record, bbh);
399 } 399 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698