aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar djsollen@google.com <djsollen@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-01-04 18:43:43 +0000
committerGravatar djsollen@google.com <djsollen@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-01-04 18:43:43 +0000
commitc6f2e7da31d60e48a420b6de520361d966ea278d (patch)
tree440f8b4d10c11773f6580476dc1fcb7c8de8508c
parent998343a134252872e91c70bd7c837f66ca03cd61 (diff)
Allow 0 as a valid text size in SkPaint.
Review URL: http://codereview.appspot.com/5514043 git-svn-id: http://skia.googlecode.com/svn/trunk@2961 2bbb7eff-a529-9590-31e7-b0007b416f81
-rw-r--r--src/core/SkPaint.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/core/SkPaint.cpp b/src/core/SkPaint.cpp
index b3cad4318e..eeb8669ea2 100644
--- a/src/core/SkPaint.cpp
+++ b/src/core/SkPaint.cpp
@@ -321,7 +321,7 @@ void SkPaint::setTextAlign(Align align) {
}
void SkPaint::setTextSize(SkScalar ts) {
- if (ts > 0) {
+ if (ts >= 0) {
GEN_ID_INC_EVAL(ts != fTextSize);
fTextSize = ts;
} else {
@@ -980,6 +980,13 @@ size_t SkPaint::breakText(const void* textD, size_t length, SkScalar maxWidth,
return 0;
}
+ if (0 == fTextSize) {
+ if (measuredWidth) {
+ *measuredWidth = 0;
+ }
+ return length;
+ }
+
SkASSERT(textD != NULL);
const char* text = (const char*)textD;