| OLD | NEW |
| 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 "SkFont.h" | 8 #include "SkFont.h" |
| 9 #include "SkTypeface.h" | 9 #include "SkTypeface.h" |
| 10 #include "SkUtils.h" | 10 #include "SkUtils.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 if (size <= 0 || !SkScalarIsFinite(size)) { | 33 if (size <= 0 || !SkScalarIsFinite(size)) { |
| 34 return NULL; | 34 return NULL; |
| 35 } | 35 } |
| 36 if (scaleX <= 0 || !SkScalarIsFinite(scaleX)) { | 36 if (scaleX <= 0 || !SkScalarIsFinite(scaleX)) { |
| 37 return NULL; | 37 return NULL; |
| 38 } | 38 } |
| 39 if (!SkScalarIsFinite(skewX)) { | 39 if (!SkScalarIsFinite(skewX)) { |
| 40 return NULL; | 40 return NULL; |
| 41 } | 41 } |
| 42 flags &= kAllFlags; | 42 flags &= kAllFlags; |
| 43 return SkNEW_ARGS(SkFont, (face, size, scaleX, skewX, mt, flags)); | 43 return new SkFont(face, size, scaleX, skewX, mt, flags); |
| 44 } | 44 } |
| 45 | 45 |
| 46 SkFont* SkFont::Create(SkTypeface* face, SkScalar size, MaskType mt, uint32_t fl
ags) { | 46 SkFont* SkFont::Create(SkTypeface* face, SkScalar size, MaskType mt, uint32_t fl
ags) { |
| 47 return SkFont::Create(face, size, 1, 0, mt, flags); | 47 return SkFont::Create(face, size, 1, 0, mt, flags); |
| 48 } | 48 } |
| 49 | 49 |
| 50 SkFont* SkFont::cloneWithSize(SkScalar newSize) const { | 50 SkFont* SkFont::cloneWithSize(SkScalar newSize) const { |
| 51 return SkFont::Create(this->getTypeface(), newSize, this->getScaleX(), this-
>getSkewX(), | 51 return SkFont::Create(this->getTypeface(), newSize, this->getScaleX(), this-
>getSkewX(), |
| 52 this->getMaskType(), this->getFlags()); | 52 this->getMaskType(), this->getFlags()); |
| 53 } | 53 } |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 | 147 |
| 148 MaskType maskType = SkFont::kBW_MaskType; | 148 MaskType maskType = SkFont::kBW_MaskType; |
| 149 if (paint.isAntiAlias()) { | 149 if (paint.isAntiAlias()) { |
| 150 maskType = paint.isLCDRenderText() ? kLCD_MaskType : kA8_MaskType; | 150 maskType = paint.isLCDRenderText() ? kLCD_MaskType : kA8_MaskType; |
| 151 } | 151 } |
| 152 | 152 |
| 153 return Create(paint.getTypeface(), | 153 return Create(paint.getTypeface(), |
| 154 paint.getTextSize(), paint.getTextScaleX(), paint.getTextSkewX
(), | 154 paint.getTextSize(), paint.getTextScaleX(), paint.getTextSkewX
(), |
| 155 maskType, flags); | 155 maskType, flags); |
| 156 } | 156 } |
| OLD | NEW |