OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2006,2007,2008, Google Inc. All rights reserved. | 2 * Copyright (c) 2006,2007,2008, Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 int PLATFORM_EXPORT clampedAlphaForBlending(float); | 54 int PLATFORM_EXPORT clampedAlphaForBlending(float); |
55 | 55 |
56 // Multiply a color's alpha channel by an additional alpha factor where | 56 // Multiply a color's alpha channel by an additional alpha factor where |
57 // alpha is in the range [0, 1]. | 57 // alpha is in the range [0, 1]. |
58 SkColor PLATFORM_EXPORT scaleAlpha(SkColor, float); | 58 SkColor PLATFORM_EXPORT scaleAlpha(SkColor, float); |
59 | 59 |
60 // Multiply a color's alpha channel by an additional alpha factor where | 60 // Multiply a color's alpha channel by an additional alpha factor where |
61 // alpha is in the range [0, 256]. | 61 // alpha is in the range [0, 256]. |
62 SkColor PLATFORM_EXPORT scaleAlpha(SkColor, int); | 62 SkColor PLATFORM_EXPORT scaleAlpha(SkColor, int); |
63 | 63 |
64 inline SkFilterQuality WebCoreInterpolationQualityToSkFilterQuality(Interpolatio
nQuality quality) | |
65 { | |
66 // FIXME: this reflects existing client mappings, but should probably | |
67 // be expanded to map higher level interpolations more accurately. | |
68 return quality != InterpolationNone ? kLow_SkFilterQuality : kNone_SkFilterQ
uality; | |
69 } | |
70 | |
71 // Skia has problems when passed infinite, etc floats, filter them to 0. | 64 // Skia has problems when passed infinite, etc floats, filter them to 0. |
72 inline SkScalar WebCoreFloatToSkScalar(float f) | 65 inline SkScalar WebCoreFloatToSkScalar(float f) |
73 { | 66 { |
74 return SkFloatToScalar(std::isfinite(f) ? f : 0); | 67 return SkFloatToScalar(std::isfinite(f) ? f : 0); |
75 } | 68 } |
76 | 69 |
77 inline SkScalar WebCoreDoubleToSkScalar(double d) | 70 inline SkScalar WebCoreDoubleToSkScalar(double d) |
78 { | 71 { |
79 return SkDoubleToScalar(std::isfinite(d) ? d : 0); | 72 return SkDoubleToScalar(std::isfinite(d) ? d : 0); |
80 } | 73 } |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 SkASSERT(radius >= 0); | 123 SkASSERT(radius >= 0); |
131 return 0.288675f * radius + 0.5f; | 124 return 0.288675f * radius + 0.5f; |
132 } | 125 } |
133 | 126 |
134 template<typename PrimitiveType> | 127 template<typename PrimitiveType> |
135 void drawPlatformFocusRing(const PrimitiveType&, SkCanvas*, SkColor, int width); | 128 void drawPlatformFocusRing(const PrimitiveType&, SkCanvas*, SkColor, int width); |
136 | 129 |
137 } // namespace blink | 130 } // namespace blink |
138 | 131 |
139 #endif // SkiaUtils_h | 132 #endif // SkiaUtils_h |
OLD | NEW |