Chromium Code Reviews| Index: src/core/SkTextMapStateProc.h |
| diff --git a/src/core/SkTextMapStateProc.h b/src/core/SkTextMapStateProc.h |
| index 8ef9389b3ab5f07d3ae76654ef922cf33f04e5d4..489025d8e8f4e5bcfede3834e9da1df17dc89def 100644 |
| --- a/src/core/SkTextMapStateProc.h |
| +++ b/src/core/SkTextMapStateProc.h |
| @@ -55,6 +55,10 @@ private: |
| SkScalar fScaleX; // This is only used by kOnly... cases. |
| }; |
| +static inline SkScalar SkClampScalarToFixed(SkScalar a) { |
| + return SkScalarPin(a, SkIntToScalar(-16384), SkIntToScalar(16384)); |
|
mtklein
2015/03/04 21:45:30
What fixed format are we clamping to? Signed 1.14
bungeman-skia
2015/03/04 21:57:35
This is SkFixed we're clamping to. SkFixed is symm
mtklein
2015/03/04 22:11:00
Oh, duh, we're clamping SkScalars, not SkFixed. O
reed1
2015/03/05 18:27:35
Lets modify its name to make it more obvious that
|
| +} |
| + |
| inline void SkTextMapStateProc::operator()(const SkScalar pos[], SkPoint* loc) const { |
| switch(fMapCase) { |
| case kXY: |
| @@ -72,6 +76,7 @@ inline void SkTextMapStateProc::operator()(const SkScalar pos[], SkPoint* loc) c |
| fProc(fMatrix, *pos + fOffset.x(), fOffset.y(), loc); |
| break; |
| } |
| + loc->set(SkClampScalarToFixed(loc->x()), SkClampScalarToFixed(loc->y())); |
| } |
| #endif |