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

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

Issue 12387092: Initialize bounds even if the text length is zero. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: fix test Created 7 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | tests/PaintTest.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 /* 2 /*
3 * Copyright 2006 The Android Open Source Project 3 * Copyright 2006 The Android Open Source Project
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 #include "SkPaint.h" 9 #include "SkPaint.h"
10 #include "SkAnnotation.h" 10 #include "SkAnnotation.h"
(...skipping 1053 matching lines...) Expand 10 before | Expand all | Expand 10 after
1064 width = this->measure_text(cache, text, length, &tempCount, bounds); 1064 width = this->measure_text(cache, text, length, &tempCount, bounds);
1065 if (scale) { 1065 if (scale) {
1066 width = SkScalarMul(width, scale); 1066 width = SkScalarMul(width, scale);
1067 if (bounds) { 1067 if (bounds) {
1068 bounds->fLeft = SkScalarMul(bounds->fLeft, scale); 1068 bounds->fLeft = SkScalarMul(bounds->fLeft, scale);
1069 bounds->fTop = SkScalarMul(bounds->fTop, scale); 1069 bounds->fTop = SkScalarMul(bounds->fTop, scale);
1070 bounds->fRight = SkScalarMul(bounds->fRight, scale); 1070 bounds->fRight = SkScalarMul(bounds->fRight, scale);
1071 bounds->fBottom = SkScalarMul(bounds->fBottom, scale); 1071 bounds->fBottom = SkScalarMul(bounds->fBottom, scale);
1072 } 1072 }
1073 } 1073 }
1074 } else if (bounds) {
1075 // ensure that even if we don't measure_text we still update the bounds
1076 bounds->setEmpty();
1074 } 1077 }
1075 return width; 1078 return width;
1076 } 1079 }
1077 1080
1078 typedef bool (*SkTextBufferPred)(const char* text, const char* stop); 1081 typedef bool (*SkTextBufferPred)(const char* text, const char* stop);
1079 1082
1080 static bool forward_textBufferPred(const char* text, const char* stop) { 1083 static bool forward_textBufferPred(const char* text, const char* stop) {
1081 return text < stop; 1084 return text < stop;
1082 } 1085 }
1083 1086
(...skipping 1461 matching lines...) Expand 10 before | Expand all | Expand 10 after
2545 if (firstTime) { 2548 if (firstTime) {
2546 *dst = r; 2549 *dst = r;
2547 } else { 2550 } else {
2548 dst->join(r); 2551 dst->join(r);
2549 } 2552 }
2550 } else { 2553 } else {
2551 break; 2554 break;
2552 } 2555 }
2553 } 2556 }
2554 } 2557 }
OLDNEW
« no previous file with comments | « no previous file | tests/PaintTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698