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

Side by Side Diff: third_party/WebKit/Source/platform/geometry/IntRect.h

Issue 1393083003: Implement interest rects for synchronized paint. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2003, 2006, 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2003, 2006, 2009 Apple 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution. 11 * documentation and/or other materials provided with the distribution.
12 * 12 *
13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' 13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
14 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 14 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 15 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
17 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 17 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 18 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 19 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 20 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 21 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 22 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23 * THE POSSIBILITY OF SUCH DAMAGE. 23 * THE POSSIBILITY OF SUCH DAMAGE.
24 */ 24 */
25 25
26 #ifndef IntRect_h 26 #ifndef IntRect_h
27 #define IntRect_h 27 #define IntRect_h
28 28
29 #include "platform/geometry/IntPoint.h" 29 #include "platform/geometry/IntPoint.h"
30 #include "platform/geometry/IntRectOutsets.h"
30 #include "wtf/FastAllocBase.h" 31 #include "wtf/FastAllocBase.h"
31 #include "wtf/Vector.h" 32 #include "wtf/Vector.h"
32 #include "wtf/VectorTraits.h" 33 #include "wtf/VectorTraits.h"
33 34
34 #if OS(MACOSX) 35 #if OS(MACOSX)
35 typedef struct CGRect CGRect; 36 typedef struct CGRect CGRect;
36 37
37 #ifdef __OBJC__ 38 #ifdef __OBJC__
38 #import <Foundation/Foundation.h> 39 #import <Foundation/Foundation.h>
39 #endif 40 #endif
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 // NOTE: The result is rounded to integer values, and thus may be not the ex act 83 // NOTE: The result is rounded to integer values, and thus may be not the ex act
83 // center point. 84 // center point.
84 IntPoint center() const { return IntPoint(x() + width() / 2, y() + height() / 2); } 85 IntPoint center() const { return IntPoint(x() + width() / 2, y() + height() / 2); }
85 86
86 void move(const IntSize& size) { m_location += size; } 87 void move(const IntSize& size) { m_location += size; }
87 void moveBy(const IntPoint& offset) { m_location.move(offset.x(), offset.y() ); } 88 void moveBy(const IntPoint& offset) { m_location.move(offset.x(), offset.y() ); }
88 void move(int dx, int dy) { m_location.move(dx, dy); } 89 void move(int dx, int dy) { m_location.move(dx, dy); }
89 90
90 void expand(const IntSize& size) { m_size += size; } 91 void expand(const IntSize& size) { m_size += size; }
91 void expand(int dw, int dh) { m_size.expand(dw, dh); } 92 void expand(int dw, int dh) { m_size.expand(dw, dh); }
93 void expand(const IntRectOutsets& outsets)
94 {
95 m_location.move(-outsets.left(), -outsets.top());
96 m_size.expand(outsets.left() + outsets.right(), outsets.top() + outsets. bottom());
97 }
98
92 void contract(const IntSize& size) { m_size -= size; } 99 void contract(const IntSize& size) { m_size -= size; }
93 void contract(int dw, int dh) { m_size.expand(-dw, -dh); } 100 void contract(int dw, int dh) { m_size.expand(-dw, -dh); }
94 101
95 void shiftXEdgeTo(int edge) 102 void shiftXEdgeTo(int edge)
96 { 103 {
97 int delta = edge - x(); 104 int delta = edge - x();
98 setX(edge); 105 setX(edge);
99 setWidth(std::max(0, width() - delta)); 106 setWidth(std::max(0, width() - delta));
100 } 107 }
101 void shiftMaxXEdgeTo(int edge) 108 void shiftMaxXEdgeTo(int edge)
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 #if defined(__OBJC__) && !defined(NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES) 222 #if defined(__OBJC__) && !defined(NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES)
216 PLATFORM_EXPORT IntRect enclosingIntRect(const NSRect&); 223 PLATFORM_EXPORT IntRect enclosingIntRect(const NSRect&);
217 #endif 224 #endif
218 #endif 225 #endif
219 226
220 } // namespace blink 227 } // namespace blink
221 228
222 WTF_ALLOW_MOVE_INIT_AND_COMPARE_WITH_MEM_FUNCTIONS(blink::IntRect); 229 WTF_ALLOW_MOVE_INIT_AND_COMPARE_WITH_MEM_FUNCTIONS(blink::IntRect);
223 230
224 #endif // IntRect_h 231 #endif // IntRect_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698