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 531933002: Fix drawPosText() bounds bug. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: get rid of line feed Created 6 years, 3 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 | tests/RecordDrawTest.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 331 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 return this->adjustAndMap(dst, op.paint); 342 return this->adjustAndMap(dst, op.paint);
343 } 343 }
344 344
345 Bounds bounds(const DrawPosText& op) const { 345 Bounds bounds(const DrawPosText& op) const {
346 const int N = op.paint.countText(op.text, op.byteLength); 346 const int N = op.paint.countText(op.text, op.byteLength);
347 if (N == 0) { 347 if (N == 0) {
348 return Bounds::MakeEmpty(); 348 return Bounds::MakeEmpty();
349 } 349 }
350 350
351 SkRect dst; 351 SkRect dst;
352 dst.set(op.pos, op.paint.countText(op.text, N)); 352 dst.set(op.pos, N);
353 AdjustTextForFontMetrics(&dst, op.paint); 353 AdjustTextForFontMetrics(&dst, op.paint);
354 return this->adjustAndMap(dst, &op.paint); 354 return this->adjustAndMap(dst, &op.paint);
355 } 355 }
356 Bounds bounds(const DrawPosTextH& op) const { 356 Bounds bounds(const DrawPosTextH& op) const {
357 const int N = op.paint.countText(op.text, op.byteLength); 357 const int N = op.paint.countText(op.text, op.byteLength);
358 if (N == 0) { 358 if (N == 0) {
359 return Bounds::MakeEmpty(); 359 return Bounds::MakeEmpty();
360 } 360 }
361 361
362 SkScalar left = op.xpos[0], right = op.xpos[0]; 362 SkScalar left = op.xpos[0], right = op.xpos[0];
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
470 // Used to track the bounds of Save/Restore blocks and the control ops insid e them. 470 // Used to track the bounds of Save/Restore blocks and the control ops insid e them.
471 SkTDArray<SaveBounds> fSaveStack; 471 SkTDArray<SaveBounds> fSaveStack;
472 SkTDArray<unsigned> fControlIndices; 472 SkTDArray<unsigned> fControlIndices;
473 }; 473 };
474 474
475 } // namespace SkRecords 475 } // namespace SkRecords
476 476
477 void SkRecordFillBounds(const SkRecord& record, SkBBoxHierarchy* bbh) { 477 void SkRecordFillBounds(const SkRecord& record, SkBBoxHierarchy* bbh) {
478 SkRecords::FillBounds(record, bbh); 478 SkRecords::FillBounds(record, bbh);
479 } 479 }
OLDNEW
« no previous file with comments | « no previous file | tests/RecordDrawTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698