diff options
Diffstat (limited to 'cc/stubs')
-rw-r--r-- | cc/stubs/float_point_3d.h | 6 | ||||
-rw-r--r-- | cc/stubs/float_size.h | 5 | ||||
-rw-r--r-- | cc/stubs/int_point.h | 4 | ||||
-rw-r--r-- | cc/stubs/skia_utils.h | 14 |
4 files changed, 28 insertions, 1 deletions
diff --git a/cc/stubs/float_point_3d.h b/cc/stubs/float_point_3d.h index 02ff076..92e036f 100644 --- a/cc/stubs/float_point_3d.h +++ b/cc/stubs/float_point_3d.h @@ -39,10 +39,16 @@ public: { } + FloatPoint3D(WebCore::FloatPoint point) : WebCore::FloatPoint3D(point) { } + + explicit FloatPoint3D(gfx::PointF point) + : WebCore::FloatPoint3D(point.x(), point.y(), 0) + { + } }; } diff --git a/cc/stubs/float_size.h b/cc/stubs/float_size.h index acbd5da..d58fb42 100644 --- a/cc/stubs/float_size.h +++ b/cc/stubs/float_size.h @@ -38,6 +38,11 @@ public: { } + explicit FloatSize(gfx::SizeF size) + : WebCore::FloatSize(size.width(), size.height()) + { + } + operator gfx::SizeF() const { return gfx::SizeF(width(), height()); } }; diff --git a/cc/stubs/int_point.h b/cc/stubs/int_point.h index 2e39da6..068c662 100644 --- a/cc/stubs/int_point.h +++ b/cc/stubs/int_point.h @@ -32,7 +32,11 @@ public: IntPoint(WebCore::IntPoint point) : WebCore::IntPoint(point.x(), point.y()) { + } + explicit IntPoint(gfx::Point point) + : WebCore::IntPoint(point.x(), point.y()) + { } operator gfx::Point() const { return gfx::Point(x(), y()); } diff --git a/cc/stubs/skia_utils.h b/cc/stubs/skia_utils.h index d7b1fbf..8404fa3 100644 --- a/cc/stubs/skia_utils.h +++ b/cc/stubs/skia_utils.h @@ -5,11 +5,23 @@ #ifndef CC_STUBS_SKIAUTILS_H_ #define CC_STUBS_SKIAUTILS_H_ +#include <limits> + +#include "third_party/skia/include/core/SkScalar.h" + namespace cc { +// Skia has problems when passed infinite, etc floats, filter them to 0. inline SkScalar FloatToSkScalar(float f) { - return SkFloatToScalar(isfinite(f) ? f : 0); + // This checks if |f| is NaN. + if (f != f) + return 0; + if (f == std::numeric_limits<double>::infinity()) + return 0; + if (f == -std::numeric_limits<double>::infinity()) + return 0; + return SkFloatToScalar(f); } } |