| 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 16 matching lines...) Expand all Loading... |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 // All of the functions in this file should move to new homes and this file shou
ld be deleted. | 31 // All of the functions in this file should move to new homes and this file shou
ld be deleted. |
| 32 | 32 |
| 33 #ifndef SkiaUtils_h | 33 #ifndef SkiaUtils_h |
| 34 #define SkiaUtils_h | 34 #define SkiaUtils_h |
| 35 | 35 |
| 36 #include "SkMatrix.h" | 36 #include "SkMatrix.h" |
| 37 #include "SkPaint.h" |
| 37 #include "SkPath.h" | 38 #include "SkPath.h" |
| 38 #include "SkXfermode.h" | 39 #include "SkXfermode.h" |
| 39 #include "platform/PlatformExport.h" | 40 #include "platform/PlatformExport.h" |
| 40 #include "platform/geometry/FloatRect.h" | 41 #include "platform/geometry/FloatRect.h" |
| 41 #include "platform/graphics/Color.h" | 42 #include "platform/graphics/Color.h" |
| 42 #include "platform/graphics/GraphicsTypes.h" | 43 #include "platform/graphics/GraphicsTypes.h" |
| 43 #include "platform/transforms/AffineTransform.h" | 44 #include "platform/transforms/AffineTransform.h" |
| 44 #include "wtf/MathExtras.h" | 45 #include "wtf/MathExtras.h" |
| 45 #include "wtf/PassRefPtr.h" | 46 #include "wtf/PassRefPtr.h" |
| 46 | 47 |
| 47 class SkCanvas; | 48 class SkCanvas; |
| 48 class SkRegion; | 49 class SkRegion; |
| 49 | 50 |
| 50 namespace WebCore { | 51 namespace WebCore { |
| 51 | 52 |
| 52 class GraphicsContext; | 53 class GraphicsContext; |
| 53 | 54 |
| 54 PassRefPtr<SkXfermode> WebCoreCompositeToSkiaComposite(CompositeOperator, blink:
:WebBlendMode = blink::WebBlendModeNormal); | 55 PassRefPtr<SkXfermode> WebCoreCompositeToSkiaComposite(CompositeOperator, blink:
:WebBlendMode = blink::WebBlendModeNormal); |
| 55 | 56 |
| 56 // move this guy into SkColor.h | 57 // move this guy into SkColor.h |
| 57 SkColor SkPMColorToColor(SkPMColor); | 58 SkColor SkPMColorToColor(SkPMColor); |
| 58 | 59 |
| 60 inline SkPaint::FilterLevel WebCoreInterpolationQualityToSkFilterLevel(Interpola
tionQuality quality) |
| 61 { |
| 62 // FIXME: this reflects existing client mappings, but should probably |
| 63 // be expanded to map higher level interpolations more accurately. |
| 64 return quality != InterpolationNone ? SkPaint::kLow_FilterLevel : SkPaint::k
None_FilterLevel; |
| 65 } |
| 66 |
| 59 // Skia has problems when passed infinite, etc floats, filter them to 0. | 67 // Skia has problems when passed infinite, etc floats, filter them to 0. |
| 60 inline SkScalar WebCoreFloatToSkScalar(float f) | 68 inline SkScalar WebCoreFloatToSkScalar(float f) |
| 61 { | 69 { |
| 62 return SkFloatToScalar(std::isfinite(f) ? f : 0); | 70 return SkFloatToScalar(std::isfinite(f) ? f : 0); |
| 63 } | 71 } |
| 64 | 72 |
| 65 inline SkScalar WebCoreDoubleToSkScalar(double d) | 73 inline SkScalar WebCoreDoubleToSkScalar(double d) |
| 66 { | 74 { |
| 67 return SkDoubleToScalar(std::isfinite(d) ? d : 0); | 75 return SkDoubleToScalar(std::isfinite(d) ? d : 0); |
| 68 } | 76 } |
| (...skipping 10 matching lines...) Expand all Loading... |
| 79 } | 87 } |
| 80 | 88 |
| 81 // Determine if a given WebKit point is contained in a path | 89 // Determine if a given WebKit point is contained in a path |
| 82 bool PLATFORM_EXPORT SkPathContainsPoint(const SkPath&, const FloatPoint&, SkPat
h::FillType); | 90 bool PLATFORM_EXPORT SkPathContainsPoint(const SkPath&, const FloatPoint&, SkPat
h::FillType); |
| 83 | 91 |
| 84 SkMatrix PLATFORM_EXPORT affineTransformToSkMatrix(const AffineTransform&); | 92 SkMatrix PLATFORM_EXPORT affineTransformToSkMatrix(const AffineTransform&); |
| 85 | 93 |
| 86 } // namespace WebCore | 94 } // namespace WebCore |
| 87 | 95 |
| 88 #endif // SkiaUtils_h | 96 #endif // SkiaUtils_h |
| OLD | NEW |