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

Side by Side Diff: Source/platform/geometry/FloatSize.h

Issue 25494003: Move geometry classes from core/platform/graphics to platform/geometry (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « Source/platform/geometry/FloatRect.cpp ('k') | Source/platform/geometry/FloatSize.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2003, 2006 Apple Computer, Inc. All rights reserved. 2 * Copyright (C) 2003, 2006 Apple Computer, Inc. All rights reserved.
3 * Copyright (C) 2005 Nokia. All rights reserved. 3 * Copyright (C) 2005 Nokia. All rights reserved.
4 * 2008 Eric Seidel <eric@webkit.org> 4 * 2008 Eric Seidel <eric@webkit.org>
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 10 matching lines...) Expand all
21 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 21 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
22 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 22 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
23 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28 #ifndef FloatSize_h 28 #ifndef FloatSize_h
29 #define FloatSize_h 29 #define FloatSize_h
30 30
31 #include "core/platform/graphics/IntPoint.h" 31 #include "platform/geometry/IntPoint.h"
32 #include "wtf/MathExtras.h" 32 #include "wtf/MathExtras.h"
33 33
34 34
35 #if OS(MACOSX) 35 #if OS(MACOSX)
36 typedef struct CGSize CGSize; 36 typedef struct CGSize CGSize;
37 37
38 #ifdef NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES 38 #ifdef NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES
39 typedef struct CGSize NSSize; 39 typedef struct CGSize NSSize;
40 #else 40 #else
41 typedef struct _NSSize NSSize; 41 typedef struct _NSSize NSSize;
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 } 83 }
84 84
85 FloatSize expandedTo(const FloatSize& other) const 85 FloatSize expandedTo(const FloatSize& other) const
86 { 86 {
87 return FloatSize(m_width > other.m_width ? m_width : other.m_width, 87 return FloatSize(m_width > other.m_width ? m_width : other.m_width,
88 m_height > other.m_height ? m_height : other.m_height); 88 m_height > other.m_height ? m_height : other.m_height);
89 } 89 }
90 90
91 FloatSize shrunkTo(const FloatSize& other) const 91 FloatSize shrunkTo(const FloatSize& other) const
92 { 92 {
93 return FloatSize(m_width < other.m_width ? m_width : other.m_width, 93 return FloatSize(m_width < other.m_width ? m_width : other.m_width,
94 m_height < other.m_height ? m_height : other.m_height); 94 m_height < other.m_height ? m_height : other.m_height);
95 } 95 }
96 96
97 float diagonalLength() const; 97 float diagonalLength() const;
98 float diagonalLengthSquared() const 98 float diagonalLengthSquared() const
99 { 99 {
100 return m_width * m_width + m_height * m_height; 100 return m_width * m_width + m_height * m_height;
101 } 101 }
102 102
103 FloatSize transposedSize() const 103 FloatSize transposedSize() const
104 { 104 {
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 } 183 }
184 184
185 inline IntPoint flooredIntPoint(const FloatSize& p) 185 inline IntPoint flooredIntPoint(const FloatSize& p)
186 { 186 {
187 return IntPoint(clampToInteger(floorf(p.width())), clampToInteger(floorf(p.h eight()))); 187 return IntPoint(clampToInteger(floorf(p.width())), clampToInteger(floorf(p.h eight())));
188 } 188 }
189 189
190 } // namespace WebCore 190 } // namespace WebCore
191 191
192 #endif // FloatSize_h 192 #endif // FloatSize_h
OLDNEW
« no previous file with comments | « Source/platform/geometry/FloatRect.cpp ('k') | Source/platform/geometry/FloatSize.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698