Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(20)

Side by Side Diff: third_party/WebKit/Source/platform/geometry/FloatPoint.cpp

Issue 2867693004: Snapshot of all changes to get jumbo in blink and content.
Patch Set: Rebased again Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved. 2 * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved.
3 * Copyright (C) 2005 Nokia. All rights reserved. 3 * Copyright (C) 2005 Nokia. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 19 matching lines...) Expand all
30 #include <limits> 30 #include <limits>
31 #include "SkPoint.h" 31 #include "SkPoint.h"
32 #include "platform/geometry/DoublePoint.h" 32 #include "platform/geometry/DoublePoint.h"
33 #include "platform/geometry/LayoutPoint.h" 33 #include "platform/geometry/LayoutPoint.h"
34 #include "platform/geometry/LayoutSize.h" 34 #include "platform/geometry/LayoutSize.h"
35 #include "platform/wtf/MathExtras.h" 35 #include "platform/wtf/MathExtras.h"
36 #include "platform/wtf/text/WTFString.h" 36 #include "platform/wtf/text/WTFString.h"
37 37
38 namespace blink { 38 namespace blink {
39 39
40 // Already exists in platform/graphics/skia/SkiaUtils so renamed here to not c ollide.
40 // Skia has problems when passed infinite, etc floats, filter them to 0. 41 // Skia has problems when passed infinite, etc floats, filter them to 0.
41 static inline SkScalar WebCoreFloatToSkScalar(float f) { 42 static inline SkScalar WebCoreFloatToSkScalar2(float f) {
42 return SkFloatToScalar(std::isfinite(f) ? f : 0); 43 return SkFloatToScalar(std::isfinite(f) ? f : 0);
43 } 44 }
44 45
45 FloatPoint::FloatPoint(const IntPoint& p) : x_(p.X()), y_(p.Y()) {} 46 FloatPoint::FloatPoint(const IntPoint& p) : x_(p.X()), y_(p.Y()) {}
46 47
47 FloatPoint::FloatPoint(const DoublePoint& p) : x_(p.X()), y_(p.Y()) {} 48 FloatPoint::FloatPoint(const DoublePoint& p) : x_(p.X()), y_(p.Y()) {}
48 49
49 FloatPoint::FloatPoint(const LayoutPoint& p) 50 FloatPoint::FloatPoint(const LayoutPoint& p)
50 : x_(p.X().ToFloat()), y_(p.Y().ToFloat()) {} 51 : x_(p.X().ToFloat()), y_(p.Y().ToFloat()) {}
51 52
(...skipping 12 matching lines...) Expand all
64 x_ += size.Width(); 65 x_ += size.Width();
65 y_ += size.Height(); 66 y_ += size.Height();
66 } 67 }
67 68
68 void FloatPoint::MoveBy(const LayoutPoint& point) { 69 void FloatPoint::MoveBy(const LayoutPoint& point) {
69 x_ += point.X(); 70 x_ += point.X();
70 y_ += point.Y(); 71 y_ += point.Y();
71 } 72 }
72 73
73 SkPoint FloatPoint::Data() const { 74 SkPoint FloatPoint::Data() const {
74 SkPoint p = {WebCoreFloatToSkScalar(x_), WebCoreFloatToSkScalar(y_)}; 75 SkPoint p = {WebCoreFloatToSkScalar2(x_), WebCoreFloatToSkScalar2(y_)};
75 return p; 76 return p;
76 } 77 }
77 78
78 FloatPoint FloatPoint::NarrowPrecision(double x, double y) { 79 FloatPoint FloatPoint::NarrowPrecision(double x, double y) {
79 return FloatPoint(clampTo<float>(x), clampTo<float>(y)); 80 return FloatPoint(clampTo<float>(x), clampTo<float>(y));
80 } 81 }
81 82
82 bool FindIntersection(const FloatPoint& p1, 83 bool FindIntersection(const FloatPoint& p1,
83 const FloatPoint& p2, 84 const FloatPoint& p2,
84 const FloatPoint& d1, 85 const FloatPoint& d1,
(...skipping 15 matching lines...) Expand all
100 intersection.SetX(p1.X() + param * px_length); 101 intersection.SetX(p1.X() + param * px_length);
101 intersection.SetY(p1.Y() + param * py_length); 102 intersection.SetY(p1.Y() + param * py_length);
102 return true; 103 return true;
103 } 104 }
104 105
105 String FloatPoint::ToString() const { 106 String FloatPoint::ToString() const {
106 return String::Format("%lg,%lg", X(), Y()); 107 return String::Format("%lg,%lg", X(), Y());
107 } 108 }
108 109
109 } // namespace blink 110 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/audio/SincResampler.cpp ('k') | third_party/WebKit/Source/platform/geometry/FloatQuad.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698