diff options
Diffstat (limited to 'src/3rdparty/webkit/WebCore/platform/graphics/IntRect.h')
-rw-r--r-- | src/3rdparty/webkit/WebCore/platform/graphics/IntRect.h | 38 |
1 files changed, 22 insertions, 16 deletions
diff --git a/src/3rdparty/webkit/WebCore/platform/graphics/IntRect.h b/src/3rdparty/webkit/WebCore/platform/graphics/IntRect.h index 97b21bc80b..ad90dd9636 100644 --- a/src/3rdparty/webkit/WebCore/platform/graphics/IntRect.h +++ b/src/3rdparty/webkit/WebCore/platform/graphics/IntRect.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003, 2006 Apple Computer, Inc. All rights reserved. + * Copyright (C) 2003, 2006, 2009 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -10,30 +10,30 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef IntRect_h #define IntRect_h #include "IntPoint.h" -#include <wtf/Platform.h> +#include <wtf/Vector.h> #if PLATFORM(CG) typedef struct CGRect CGRect; #endif -#if PLATFORM(MAC) || (PLATFORM(CHROMIUM) && PLATFORM(DARWIN)) +#if PLATFORM(MAC) || (PLATFORM(CHROMIUM) && OS(DARWIN)) #ifdef NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES typedef struct CGRect NSRect; #else @@ -104,6 +104,10 @@ public: int right() const { return x() + width(); } int bottom() const { return y() + height(); } + // NOTE: The result is rounded to integer values, and thus may be not the exact + // center point. + IntPoint center() const { return IntPoint(x() + width() / 2, y() + height() / 2); } + void move(const IntSize& s) { m_location += s; } void move(int dx, int dy) { m_location.move(dx, dy); } @@ -162,7 +166,7 @@ public: #endif #if (PLATFORM(MAC) && !defined(NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES)) \ - || (PLATFORM(CHROMIUM) && PLATFORM(DARWIN)) + || (PLATFORM(CHROMIUM) && OS(DARWIN)) operator NSRect() const; #endif @@ -185,6 +189,8 @@ inline IntRect unionRect(const IntRect& a, const IntRect& b) return c; } +IntRect unionRect(const Vector<IntRect>&); + inline bool operator==(const IntRect& a, const IntRect& b) { return a.location() == b.location() && a.size() == b.size(); @@ -200,7 +206,7 @@ IntRect enclosingIntRect(const CGRect&); #endif #if (PLATFORM(MAC) && !defined(NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES)) \ - || (PLATFORM(CHROMIUM) && PLATFORM(DARWIN)) + || (PLATFORM(CHROMIUM) && OS(DARWIN)) IntRect enclosingIntRect(const NSRect&); #endif |