/frameworks/base/libs/ui/ |
H A D | Region.cpp | 24 #include <ui/Rect.h> 43 op_nand = region_operator<Rect>::op_nand, 44 op_and = region_operator<Rect>::op_and, 45 op_or = region_operator<Rect>::op_or, 46 op_xor = region_operator<Rect>::op_xor 61 Region::Region(const Rect& rhs) 104 void Region::set(const Rect& r) 112 mBounds = Rect(int(w), int(h)); 120 mStorage.add(Rect(l,t,r,b)); 128 Region& Region::orSelf(const Rect 69 LOGE_IF(err<0, Ó, strerror(err)); } Region::Region(const void* buffer) { status_t err = read(buffer); LOGE_IF(err<0, Ó, strerror(err)); } Region::~Region() { } Region& Region::operator = (const Region& rhs) { validate(rhs, Ó); mBounds = rhs.mBounds; mStorage = rhs.mStorage; return *this; } Region& Region::makeBoundsSelf() { mStorage.clear(); return *this; } void Region::clear() { mBounds.clear(); mStorage.clear(); } void Region::set(const Rect& r) { mBounds = r; mStorage.clear(); } void Region::set(uint32_t w, uint32_t h) { mBounds = Rect(int(w), int(h)); mStorage.clear(); } void Region::addRectUnchecked(int l, int t, int r, int b) { mStorage.add(Rect(l,t,r,b)); validate(*this, Ó); } Region& Region::orSelf(const Rect& r) { return operationSelf(r, op_or); } Region& Region::andSelf(const Rect& r) { return operationSelf(r, op_and); } Region& Region::subtractSelf(const Rect& r) { return operationSelf(r, op_nand); } Region& Region::operationSelf(const Rect& r, int op) { Region lhs(*this); boolean_operation(op, *this, lhs, r); return *this; } Region& Region::orSelf(const Region& rhs) { return operationSelf(rhs, op_or); } Region& Region::andSelf(const Region& rhs) { return operationSelf(rhs, op_and); } Region& Region::subtractSelf(const Region& rhs) { return operationSelf(rhs, op_nand); } Region& Region::operationSelf(const Region& rhs, int op) { Region lhs(*this); boolean_operation(op, *this, lhs, rhs); return *this; } Region& Region::translateSelf(int x, int y) { if (x|y) translate(*this, x, y); return *this; } const Region Region::merge(const Rect& rhs) const { return operation(rhs, op_or); } const Region Region::intersect(const Rect& rhs) const { return operation(rhs, op_and); } const Region Region::subtract(const Rect& rhs) const { return operation(rhs, op_nand); } const Region Region::operation(const Rect& rhs, int op) const { Region result; boolean_operation(op, result, *this, rhs); return result; } const Region Region::merge(const Region& rhs) const { return operation(rhs, op_or); } const Region Region::intersect(const Region& rhs) const { return operation(rhs, op_and); } const Region Region::subtract(const Region& rhs) const { return operation(rhs, op_nand); } const Region Region::operation(const Region& rhs, int op) const { Region result; boolean_operation(op, result, *this, rhs); return result; } const Region Region::translate(int x, int y) const { Region result; translate(result, *this, x, y); return result; } Region& Region::orSelf(const Region& rhs, int dx, int dy) { return operationSelf(rhs, dx, dy, op_or); } Region& Region::andSelf(const Region& rhs, int dx, int dy) { return operationSelf(rhs, dx, dy, op_and); } Region& Region::subtractSelf(const Region& rhs, int dx, int dy) { return operationSelf(rhs, dx, dy, op_nand); } Region& Region::operationSelf(const Region& rhs, int dx, int dy, int op) { Region lhs(*this); boolean_operation(op, *this, lhs, rhs, dx, dy); return *this; } const Region Region::merge(const Region& rhs, int dx, int dy) const { return operation(rhs, dx, dy, op_or); } const Region Region::intersect(const Region& rhs, int dx, int dy) const { return operation(rhs, dx, dy, op_and); } const Region Region::subtract(const Region& rhs, int dx, int dy) const { return operation(rhs, dx, dy, op_nand); } const Region Region::operation(const Region& rhs, int dx, int dy, int op) const { Region result; boolean_operation(op, result, *this, rhs, dx, dy); return result; } class Region::rasterizer : public region_operator<Rect>::region_rasterizer { Rect& bounds; Vector<Rect>& storage; Rect* head; Rect* tail; Vector<Rect> span; Rect* cur; public: rasterizer(Region& reg) : bounds(reg.mBounds), storage(reg.mStorage), head(), tail(), cur() { bounds.top = bounds.bottom = 0; bounds.left = INT_MAX; bounds.right = INT_MIN; storage.clear(); } ~rasterizer() { if (span.size()) { flushSpan(); } if (storage.size()) { bounds.top = storage.itemAt(0).top; bounds.bottom = storage.top().bottom; if (storage.size() == 1) { storage.clear(); } } else { bounds.left = 0; bounds.right = 0; } } virtual void operator()(const Rect& rect) { if (span.size()) { if (cur->top != rect.top) { flushSpan(); } else if (cur->right == rect.left) argument [all...] |
/frameworks/base/graphics/java/android/graphics/ |
H A D | Rect.java | 27 * Rect holds four integer coordinates for a rectangle. The rectangle is 33 public final class Rect implements Parcelable { class in inherits:Parcelable 43 * Create a new empty Rect. All coordinates are initialized to 0. 45 public Rect() {} method in class:Rect 57 public Rect(int left, int top, int right, int bottom) { method in class:Rect 71 public Rect(Rect r) { method in class:Rect 79 Rect r = (Rect) obj; 89 sb.append("Rect("); s [all...] |
/frameworks/base/include/ui/ |
H A D | Rect.h | 25 class Rect class in namespace:android 38 inline Rect() { function in class:android::Rect 40 inline Rect(int w, int h) function in class:android::Rect 43 inline Rect(int l, int t, int r, int b) function in class:android::Rect 46 inline Rect(const Point& lt, const Point& rb) function in class:android::Rect 66 inline void set(const Rect& rhs) { 105 inline bool operator == (const Rect& rhs) const { 110 inline bool operator != (const Rect& rhs) const { 116 bool operator < (const Rect& rhs) const; 118 Rect [all...] |
/frameworks/base/opengl/libagl/ |
H A D | egl.cpp | 248 struct Rect { struct in struct:android::egl_window_surface_v2_t 249 inline Rect() { }; function in struct:android::egl_window_surface_v2_t::Rect 250 inline Rect(int32_t w, int32_t h) function in struct:android::egl_window_surface_v2_t::Rect 252 inline Rect(int32_t l, int32_t t, int32_t r, int32_t b) function in struct:android::egl_window_surface_v2_t::Rect 254 Rect& andSelf(const Rect& r) { 277 typedef Rect const* const_iterator; 280 static Region subtract(const Rect& lhs, const Rect& rhs) { 282 Rect* storag [all...] |