1edbf3b6af777b721cd2a1ef461947e51e88241e1The Android Open Source Project/*
2edbf3b6af777b721cd2a1ef461947e51e88241e1The Android Open Source Project * Copyright (C) 2007 The Android Open Source Project
3edbf3b6af777b721cd2a1ef461947e51e88241e1The Android Open Source Project *
4edbf3b6af777b721cd2a1ef461947e51e88241e1The Android Open Source Project * Licensed under the Apache License, Version 2.0 (the "License");
5edbf3b6af777b721cd2a1ef461947e51e88241e1The Android Open Source Project * you may not use this file except in compliance with the License.
6edbf3b6af777b721cd2a1ef461947e51e88241e1The Android Open Source Project * You may obtain a copy of the License at
7edbf3b6af777b721cd2a1ef461947e51e88241e1The Android Open Source Project *
8edbf3b6af777b721cd2a1ef461947e51e88241e1The Android Open Source Project *      http://www.apache.org/licenses/LICENSE-2.0
9edbf3b6af777b721cd2a1ef461947e51e88241e1The Android Open Source Project *
10edbf3b6af777b721cd2a1ef461947e51e88241e1The Android Open Source Project * Unless required by applicable law or agreed to in writing, software
11edbf3b6af777b721cd2a1ef461947e51e88241e1The Android Open Source Project * distributed under the License is distributed on an "AS IS" BASIS,
12edbf3b6af777b721cd2a1ef461947e51e88241e1The Android Open Source Project * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13edbf3b6af777b721cd2a1ef461947e51e88241e1The Android Open Source Project * See the License for the specific language governing permissions and
14edbf3b6af777b721cd2a1ef461947e51e88241e1The Android Open Source Project * limitations under the License.
15edbf3b6af777b721cd2a1ef461947e51e88241e1The Android Open Source Project */
16edbf3b6af777b721cd2a1ef461947e51e88241e1The Android Open Source Project
17edbf3b6af777b721cd2a1ef461947e51e88241e1The Android Open Source Project#ifndef ANDROID_UI_REGION_H
18edbf3b6af777b721cd2a1ef461947e51e88241e1The Android Open Source Project#define ANDROID_UI_REGION_H
19edbf3b6af777b721cd2a1ef461947e51e88241e1The Android Open Source Project
20edbf3b6af777b721cd2a1ef461947e51e88241e1The Android Open Source Project#include <stdint.h>
21edbf3b6af777b721cd2a1ef461947e51e88241e1The Android Open Source Project#include <sys/types.h>
22edbf3b6af777b721cd2a1ef461947e51e88241e1The Android Open Source Project
23edbf3b6af777b721cd2a1ef461947e51e88241e1The Android Open Source Project#include <utils/Vector.h>
24edbf3b6af777b721cd2a1ef461947e51e88241e1The Android Open Source Project
25edbf3b6af777b721cd2a1ef461947e51e88241e1The Android Open Source Project#include <ui/Rect.h>
268683fca395d01734ec7946e9f0595ec5d7b754c6Mathias Agopian#include <utils/Flattenable.h>
27edbf3b6af777b721cd2a1ef461947e51e88241e1The Android Open Source Project
28edbf3b6af777b721cd2a1ef461947e51e88241e1The Android Open Source Projectnamespace android {
29edbf3b6af777b721cd2a1ef461947e51e88241e1The Android Open Source Project// ---------------------------------------------------------------------------
30edbf3b6af777b721cd2a1ef461947e51e88241e1The Android Open Source Project
312401ead70099c982796ecc3ec63ec8a5570948fcMathias Agopianclass SharedBuffer;
32edbf3b6af777b721cd2a1ef461947e51e88241e1The Android Open Source Projectclass String8;
33edbf3b6af777b721cd2a1ef461947e51e88241e1The Android Open Source Project
34edbf3b6af777b721cd2a1ef461947e51e88241e1The Android Open Source Project// ---------------------------------------------------------------------------
358683fca395d01734ec7946e9f0595ec5d7b754c6Mathias Agopianclass Region : public LightFlattenable<Region>
36edbf3b6af777b721cd2a1ef461947e51e88241e1The Android Open Source Project{
37edbf3b6af777b721cd2a1ef461947e51e88241e1The Android Open Source Projectpublic:
38edbf3b6af777b721cd2a1ef461947e51e88241e1The Android Open Source Project                        Region();
39edbf3b6af777b721cd2a1ef461947e51e88241e1The Android Open Source Project                        Region(const Region& rhs);
40edbf3b6af777b721cd2a1ef461947e51e88241e1The Android Open Source Project    explicit            Region(const Rect& rhs);
41edbf3b6af777b721cd2a1ef461947e51e88241e1The Android Open Source Project                        ~Region();
423e010f3138593cc6953039ee0e3db8ee31881296Chris Craik
433e010f3138593cc6953039ee0e3db8ee31881296Chris Craik    static  Region      createTJunctionFreeRegion(const Region& r);
443e010f3138593cc6953039ee0e3db8ee31881296Chris Craik
45edbf3b6af777b721cd2a1ef461947e51e88241e1The Android Open Source Project        Region& operator = (const Region& rhs);
46edbf3b6af777b721cd2a1ef461947e51e88241e1The Android Open Source Project
473ab68558fa5a4b8f792a54965a010f03385bd271Mathias Agopian    inline  bool        isEmpty() const     { return getBounds().isEmpty(); }
483ab68558fa5a4b8f792a54965a010f03385bd271Mathias Agopian    inline  bool        isRect() const      { return mStorage.size() == 1; }
49edbf3b6af777b721cd2a1ef461947e51e88241e1The Android Open Source Project
503ab68558fa5a4b8f792a54965a010f03385bd271Mathias Agopian    inline  Rect        getBounds() const   { return mStorage[mStorage.size() - 1]; }
5117b2ad027b4b72b96dfb663c0ea001972da7ef58Mathias Agopian    inline  Rect        bounds() const      { return getBounds(); }
52edbf3b6af777b721cd2a1ef461947e51e88241e1The Android Open Source Project
531c284a9431f98bbefd27a30c3368bbf7366dff3aMichael Wright            bool        contains(const Point& point) const;
541c284a9431f98bbefd27a30c3368bbf7366dff3aMichael Wright            bool        contains(int x, int y) const;
551c284a9431f98bbefd27a30c3368bbf7366dff3aMichael Wright
569f96145725ff3f265712d607d19078fb91a5c8ecMathias Agopian            // the region becomes its bounds
579f96145725ff3f265712d607d19078fb91a5c8ecMathias Agopian            Region&     makeBoundsSelf();
589f96145725ff3f265712d607d19078fb91a5c8ecMathias Agopian
59edbf3b6af777b721cd2a1ef461947e51e88241e1The Android Open Source Project            void        clear();
60edbf3b6af777b721cd2a1ef461947e51e88241e1The Android Open Source Project            void        set(const Rect& r);
610926f50664c739eaee60341f8e8c694dc9a4f3ebMathias Agopian            void        set(uint32_t w, uint32_t h);
62edbf3b6af777b721cd2a1ef461947e51e88241e1The Android Open Source Project
63edbf3b6af777b721cd2a1ef461947e51e88241e1The Android Open Source Project            Region&     orSelf(const Rect& rhs);
64b8a2e98cd7edbe7513543670c94f6b5efa74462fRomain Guy            Region&     xorSelf(const Rect& rhs);
65edbf3b6af777b721cd2a1ef461947e51e88241e1The Android Open Source Project            Region&     andSelf(const Rect& rhs);
6620f68782a4ea71c6a977d7f87d8288d3daa265ecMathias Agopian            Region&     subtractSelf(const Rect& rhs);
67edbf3b6af777b721cd2a1ef461947e51e88241e1The Android Open Source Project
68edbf3b6af777b721cd2a1ef461947e51e88241e1The Android Open Source Project            // boolean operators, applied on this
69edbf3b6af777b721cd2a1ef461947e51e88241e1The Android Open Source Project            Region&     orSelf(const Region& rhs);
70b8a2e98cd7edbe7513543670c94f6b5efa74462fRomain Guy            Region&     xorSelf(const Region& rhs);
71edbf3b6af777b721cd2a1ef461947e51e88241e1The Android Open Source Project            Region&     andSelf(const Region& rhs);
72edbf3b6af777b721cd2a1ef461947e51e88241e1The Android Open Source Project            Region&     subtractSelf(const Region& rhs);
73edbf3b6af777b721cd2a1ef461947e51e88241e1The Android Open Source Project
7420f68782a4ea71c6a977d7f87d8288d3daa265ecMathias Agopian            // boolean operators
75bed9dd128dfbdc7d9dbca005078536dadc0b9359Mathias Agopian    const   Region      merge(const Rect& rhs) const;
76b8a2e98cd7edbe7513543670c94f6b5efa74462fRomain Guy    const   Region      mergeExclusive(const Rect& rhs) const;
77bed9dd128dfbdc7d9dbca005078536dadc0b9359Mathias Agopian    const   Region      intersect(const Rect& rhs) const;
78bed9dd128dfbdc7d9dbca005078536dadc0b9359Mathias Agopian    const   Region      subtract(const Rect& rhs) const;
79edbf3b6af777b721cd2a1ef461947e51e88241e1The Android Open Source Project
80edbf3b6af777b721cd2a1ef461947e51e88241e1The Android Open Source Project            // boolean operators
81bed9dd128dfbdc7d9dbca005078536dadc0b9359Mathias Agopian    const   Region      merge(const Region& rhs) const;
82b8a2e98cd7edbe7513543670c94f6b5efa74462fRomain Guy    const   Region      mergeExclusive(const Region& rhs) const;
83bed9dd128dfbdc7d9dbca005078536dadc0b9359Mathias Agopian    const   Region      intersect(const Region& rhs) const;
84bed9dd128dfbdc7d9dbca005078536dadc0b9359Mathias Agopian    const   Region      subtract(const Region& rhs) const;
85edbf3b6af777b721cd2a1ef461947e51e88241e1The Android Open Source Project
86edbf3b6af777b721cd2a1ef461947e51e88241e1The Android Open Source Project            // these translate rhs first
8720f68782a4ea71c6a977d7f87d8288d3daa265ecMathias Agopian            Region&     translateSelf(int dx, int dy);
8820f68782a4ea71c6a977d7f87d8288d3daa265ecMathias Agopian            Region&     orSelf(const Region& rhs, int dx, int dy);
89b8a2e98cd7edbe7513543670c94f6b5efa74462fRomain Guy            Region&     xorSelf(const Region& rhs, int dx, int dy);
9020f68782a4ea71c6a977d7f87d8288d3daa265ecMathias Agopian            Region&     andSelf(const Region& rhs, int dx, int dy);
9120f68782a4ea71c6a977d7f87d8288d3daa265ecMathias Agopian            Region&     subtractSelf(const Region& rhs, int dx, int dy);
9220f68782a4ea71c6a977d7f87d8288d3daa265ecMathias Agopian
9320f68782a4ea71c6a977d7f87d8288d3daa265ecMathias Agopian            // these translate rhs first
94bed9dd128dfbdc7d9dbca005078536dadc0b9359Mathias Agopian    const   Region      translate(int dx, int dy) const;
95bed9dd128dfbdc7d9dbca005078536dadc0b9359Mathias Agopian    const   Region      merge(const Region& rhs, int dx, int dy) const;
96b8a2e98cd7edbe7513543670c94f6b5efa74462fRomain Guy    const   Region      mergeExclusive(const Region& rhs, int dx, int dy) const;
97bed9dd128dfbdc7d9dbca005078536dadc0b9359Mathias Agopian    const   Region      intersect(const Region& rhs, int dx, int dy) const;
98bed9dd128dfbdc7d9dbca005078536dadc0b9359Mathias Agopian    const   Region      subtract(const Region& rhs, int dx, int dy) const;
99edbf3b6af777b721cd2a1ef461947e51e88241e1The Android Open Source Project
100edbf3b6af777b721cd2a1ef461947e51e88241e1The Android Open Source Project    // convenience operators overloads
101bed9dd128dfbdc7d9dbca005078536dadc0b9359Mathias Agopian    inline  const Region      operator | (const Region& rhs) const;
102b8a2e98cd7edbe7513543670c94f6b5efa74462fRomain Guy    inline  const Region      operator ^ (const Region& rhs) const;
103bed9dd128dfbdc7d9dbca005078536dadc0b9359Mathias Agopian    inline  const Region      operator & (const Region& rhs) const;
104bed9dd128dfbdc7d9dbca005078536dadc0b9359Mathias Agopian    inline  const Region      operator - (const Region& rhs) const;
105bed9dd128dfbdc7d9dbca005078536dadc0b9359Mathias Agopian    inline  const Region      operator + (const Point& pt) const;
106edbf3b6af777b721cd2a1ef461947e51e88241e1The Android Open Source Project
107edbf3b6af777b721cd2a1ef461947e51e88241e1The Android Open Source Project    inline  Region&     operator |= (const Region& rhs);
108b8a2e98cd7edbe7513543670c94f6b5efa74462fRomain Guy    inline  Region&     operator ^= (const Region& rhs);
109edbf3b6af777b721cd2a1ef461947e51e88241e1The Android Open Source Project    inline  Region&     operator &= (const Region& rhs);
110edbf3b6af777b721cd2a1ef461947e51e88241e1The Android Open Source Project    inline  Region&     operator -= (const Region& rhs);
111edbf3b6af777b721cd2a1ef461947e51e88241e1The Android Open Source Project    inline  Region&     operator += (const Point& pt);
112edbf3b6af777b721cd2a1ef461947e51e88241e1The Android Open Source Project
11320f68782a4ea71c6a977d7f87d8288d3daa265ecMathias Agopian
1142ca79399b933935eb1b6c0ec1f746f8c4475369cMathias Agopian    // returns true if the regions share the same underlying storage
1152ca79399b933935eb1b6c0ec1f746f8c4475369cMathias Agopian    bool isTriviallyEqual(const Region& region) const;
1162ca79399b933935eb1b6c0ec1f746f8c4475369cMathias Agopian
1172ca79399b933935eb1b6c0ec1f746f8c4475369cMathias Agopian
11820f68782a4ea71c6a977d7f87d8288d3daa265ecMathias Agopian    /* various ways to access the rectangle list */
1192401ead70099c982796ecc3ec63ec8a5570948fcMathias Agopian
12020f68782a4ea71c6a977d7f87d8288d3daa265ecMathias Agopian
1212401ead70099c982796ecc3ec63ec8a5570948fcMathias Agopian    // STL-like iterators
12220f68782a4ea71c6a977d7f87d8288d3daa265ecMathias Agopian    typedef Rect const* const_iterator;
1232401ead70099c982796ecc3ec63ec8a5570948fcMathias Agopian    const_iterator begin() const;
1242401ead70099c982796ecc3ec63ec8a5570948fcMathias Agopian    const_iterator end() const;
12520f68782a4ea71c6a977d7f87d8288d3daa265ecMathias Agopian
1262401ead70099c982796ecc3ec63ec8a5570948fcMathias Agopian    // returns an array of rect which has the same life-time has this
1272401ead70099c982796ecc3ec63ec8a5570948fcMathias Agopian    // Region object.
1282401ead70099c982796ecc3ec63ec8a5570948fcMathias Agopian    Rect const* getArray(size_t* count) const;
1292401ead70099c982796ecc3ec63ec8a5570948fcMathias Agopian
1302401ead70099c982796ecc3ec63ec8a5570948fcMathias Agopian    // returns a SharedBuffer as well as the number of rects.
1312401ead70099c982796ecc3ec63ec8a5570948fcMathias Agopian    // ownership is transfered to the caller.
1322401ead70099c982796ecc3ec63ec8a5570948fcMathias Agopian    // the caller must call SharedBuffer::release() to free the memory.
1332401ead70099c982796ecc3ec63ec8a5570948fcMathias Agopian    SharedBuffer const* getSharedBuffer(size_t* count) const;
134edbf3b6af777b721cd2a1ef461947e51e88241e1The Android Open Source Project
1352401ead70099c982796ecc3ec63ec8a5570948fcMathias Agopian    /* no user serviceable parts here... */
13620f68782a4ea71c6a977d7f87d8288d3daa265ecMathias Agopian
13720f68782a4ea71c6a977d7f87d8288d3daa265ecMathias Agopian            // add a rectangle to the internal list. This rectangle must
13820f68782a4ea71c6a977d7f87d8288d3daa265ecMathias Agopian            // be sorted in Y and X and must not make the region invalid.
13920f68782a4ea71c6a977d7f87d8288d3daa265ecMathias Agopian            void        addRectUnchecked(int l, int t, int r, int b);
140edbf3b6af777b721cd2a1ef461947e51e88241e1The Android Open Source Project
1418683fca395d01734ec7946e9f0595ec5d7b754c6Mathias Agopian    inline  bool        isFixedSize() const { return false; }
142e142428a9c8b9d2380032cd4d7b55ee440fe8770Mathias Agopian            size_t      getFlattenedSize() const;
143e142428a9c8b9d2380032cd4d7b55ee440fe8770Mathias Agopian            status_t    flatten(void* buffer, size_t size) const;
1448683fca395d01734ec7946e9f0595ec5d7b754c6Mathias Agopian            status_t    unflatten(void const* buffer, size_t size);
145edbf3b6af777b721cd2a1ef461947e51e88241e1The Android Open Source Project
146edbf3b6af777b721cd2a1ef461947e51e88241e1The Android Open Source Project    void        dump(String8& out, const char* what, uint32_t flags=0) const;
147edbf3b6af777b721cd2a1ef461947e51e88241e1The Android Open Source Project    void        dump(const char* what, uint32_t flags=0) const;
148edbf3b6af777b721cd2a1ef461947e51e88241e1The Android Open Source Project
149edbf3b6af777b721cd2a1ef461947e51e88241e1The Android Open Source Projectprivate:
15020f68782a4ea71c6a977d7f87d8288d3daa265ecMathias Agopian    class rasterizer;
15120f68782a4ea71c6a977d7f87d8288d3daa265ecMathias Agopian    friend class rasterizer;
15220f68782a4ea71c6a977d7f87d8288d3daa265ecMathias Agopian
15320f68782a4ea71c6a977d7f87d8288d3daa265ecMathias Agopian    Region& operationSelf(const Rect& r, int op);
15420f68782a4ea71c6a977d7f87d8288d3daa265ecMathias Agopian    Region& operationSelf(const Region& r, int op);
15520f68782a4ea71c6a977d7f87d8288d3daa265ecMathias Agopian    Region& operationSelf(const Region& r, int dx, int dy, int op);
156bed9dd128dfbdc7d9dbca005078536dadc0b9359Mathias Agopian    const Region operation(const Rect& rhs, int op) const;
157bed9dd128dfbdc7d9dbca005078536dadc0b9359Mathias Agopian    const Region operation(const Region& rhs, int op) const;
158bed9dd128dfbdc7d9dbca005078536dadc0b9359Mathias Agopian    const Region operation(const Region& rhs, int dx, int dy, int op) const;
15920f68782a4ea71c6a977d7f87d8288d3daa265ecMathias Agopian
16020f68782a4ea71c6a977d7f87d8288d3daa265ecMathias Agopian    static void boolean_operation(int op, Region& dst,
16120f68782a4ea71c6a977d7f87d8288d3daa265ecMathias Agopian            const Region& lhs, const Region& rhs, int dx, int dy);
16220f68782a4ea71c6a977d7f87d8288d3daa265ecMathias Agopian    static void boolean_operation(int op, Region& dst,
16320f68782a4ea71c6a977d7f87d8288d3daa265ecMathias Agopian            const Region& lhs, const Rect& rhs, int dx, int dy);
16420f68782a4ea71c6a977d7f87d8288d3daa265ecMathias Agopian
16520f68782a4ea71c6a977d7f87d8288d3daa265ecMathias Agopian    static void boolean_operation(int op, Region& dst,
16620f68782a4ea71c6a977d7f87d8288d3daa265ecMathias Agopian            const Region& lhs, const Region& rhs);
16720f68782a4ea71c6a977d7f87d8288d3daa265ecMathias Agopian    static void boolean_operation(int op, Region& dst,
16820f68782a4ea71c6a977d7f87d8288d3daa265ecMathias Agopian            const Region& lhs, const Rect& rhs);
16920f68782a4ea71c6a977d7f87d8288d3daa265ecMathias Agopian
17020f68782a4ea71c6a977d7f87d8288d3daa265ecMathias Agopian    static void translate(Region& reg, int dx, int dy);
17120f68782a4ea71c6a977d7f87d8288d3daa265ecMathias Agopian    static void translate(Region& dst, const Region& reg, int dx, int dy);
17220f68782a4ea71c6a977d7f87d8288d3daa265ecMathias Agopian
173068d47f29dfead847999a7b33b4217ee9514152bMathias Agopian    static bool validate(const Region& reg,
174068d47f29dfead847999a7b33b4217ee9514152bMathias Agopian            const char* name, bool silent = false);
17520f68782a4ea71c6a977d7f87d8288d3daa265ecMathias Agopian
1763ab68558fa5a4b8f792a54965a010f03385bd271Mathias Agopian    // mStorage is a (manually) sorted array of Rects describing the region
1773ab68558fa5a4b8f792a54965a010f03385bd271Mathias Agopian    // with an extra Rect as the last element which is set to the
1783ab68558fa5a4b8f792a54965a010f03385bd271Mathias Agopian    // bounds of the region. However, if the region is
1793ab68558fa5a4b8f792a54965a010f03385bd271Mathias Agopian    // a simple Rect then mStorage contains only that rect.
1803ab68558fa5a4b8f792a54965a010f03385bd271Mathias Agopian    Vector<Rect> mStorage;
181edbf3b6af777b721cd2a1ef461947e51e88241e1The Android Open Source Project};
182edbf3b6af777b721cd2a1ef461947e51e88241e1The Android Open Source Project
183edbf3b6af777b721cd2a1ef461947e51e88241e1The Android Open Source Project
184bed9dd128dfbdc7d9dbca005078536dadc0b9359Mathias Agopianconst Region Region::operator | (const Region& rhs) const {
185edbf3b6af777b721cd2a1ef461947e51e88241e1The Android Open Source Project    return merge(rhs);
186edbf3b6af777b721cd2a1ef461947e51e88241e1The Android Open Source Project}
187b8a2e98cd7edbe7513543670c94f6b5efa74462fRomain Guyconst Region Region::operator ^ (const Region& rhs) const {
188b8a2e98cd7edbe7513543670c94f6b5efa74462fRomain Guy    return mergeExclusive(rhs);
189b8a2e98cd7edbe7513543670c94f6b5efa74462fRomain Guy}
190bed9dd128dfbdc7d9dbca005078536dadc0b9359Mathias Agopianconst Region Region::operator & (const Region& rhs) const {
191edbf3b6af777b721cd2a1ef461947e51e88241e1The Android Open Source Project    return intersect(rhs);
192edbf3b6af777b721cd2a1ef461947e51e88241e1The Android Open Source Project}
193bed9dd128dfbdc7d9dbca005078536dadc0b9359Mathias Agopianconst Region Region::operator - (const Region& rhs) const {
194edbf3b6af777b721cd2a1ef461947e51e88241e1The Android Open Source Project    return subtract(rhs);
195edbf3b6af777b721cd2a1ef461947e51e88241e1The Android Open Source Project}
196bed9dd128dfbdc7d9dbca005078536dadc0b9359Mathias Agopianconst Region Region::operator + (const Point& pt) const {
197edbf3b6af777b721cd2a1ef461947e51e88241e1The Android Open Source Project    return translate(pt.x, pt.y);
198edbf3b6af777b721cd2a1ef461947e51e88241e1The Android Open Source Project}
199edbf3b6af777b721cd2a1ef461947e51e88241e1The Android Open Source Project
200edbf3b6af777b721cd2a1ef461947e51e88241e1The Android Open Source Project
201edbf3b6af777b721cd2a1ef461947e51e88241e1The Android Open Source ProjectRegion& Region::operator |= (const Region& rhs) {
202edbf3b6af777b721cd2a1ef461947e51e88241e1The Android Open Source Project    return orSelf(rhs);
203edbf3b6af777b721cd2a1ef461947e51e88241e1The Android Open Source Project}
204b8a2e98cd7edbe7513543670c94f6b5efa74462fRomain GuyRegion& Region::operator ^= (const Region& rhs) {
205b8a2e98cd7edbe7513543670c94f6b5efa74462fRomain Guy    return xorSelf(rhs);
206b8a2e98cd7edbe7513543670c94f6b5efa74462fRomain Guy}
207edbf3b6af777b721cd2a1ef461947e51e88241e1The Android Open Source ProjectRegion& Region::operator &= (const Region& rhs) {
208edbf3b6af777b721cd2a1ef461947e51e88241e1The Android Open Source Project    return andSelf(rhs);
209edbf3b6af777b721cd2a1ef461947e51e88241e1The Android Open Source Project}
210edbf3b6af777b721cd2a1ef461947e51e88241e1The Android Open Source ProjectRegion& Region::operator -= (const Region& rhs) {
211edbf3b6af777b721cd2a1ef461947e51e88241e1The Android Open Source Project    return subtractSelf(rhs);
212edbf3b6af777b721cd2a1ef461947e51e88241e1The Android Open Source Project}
213edbf3b6af777b721cd2a1ef461947e51e88241e1The Android Open Source ProjectRegion& Region::operator += (const Point& pt) {
214edbf3b6af777b721cd2a1ef461947e51e88241e1The Android Open Source Project    return translateSelf(pt.x, pt.y);
215edbf3b6af777b721cd2a1ef461947e51e88241e1The Android Open Source Project}
216edbf3b6af777b721cd2a1ef461947e51e88241e1The Android Open Source Project// ---------------------------------------------------------------------------
217edbf3b6af777b721cd2a1ef461947e51e88241e1The Android Open Source Project}; // namespace android
218edbf3b6af777b721cd2a1ef461947e51e88241e1The Android Open Source Project
219edbf3b6af777b721cd2a1ef461947e51e88241e1The Android Open Source Project#endif // ANDROID_UI_REGION_H
220edbf3b6af777b721cd2a1ef461947e51e88241e1The Android Open Source Project
221