diff options
Diffstat (limited to 'libs/ui')
-rw-r--r-- | libs/ui/Android.mk | 3 | ||||
-rw-r--r-- | libs/ui/Fence.cpp | 63 | ||||
-rw-r--r-- | libs/ui/GraphicBuffer.cpp | 21 | ||||
-rw-r--r-- | libs/ui/GraphicBufferAllocator.cpp | 132 | ||||
-rw-r--r-- | libs/ui/GraphicBufferMapper.cpp | 14 | ||||
-rw-r--r-- | libs/ui/Region.cpp | 140 | ||||
-rw-r--r-- | libs/ui/tests/Android.mk | 24 | ||||
-rw-r--r-- | libs/ui/tests/Region_test.cpp | 156 | ||||
-rw-r--r-- | libs/ui/tests/region/Android.mk | 16 | ||||
-rw-r--r-- | libs/ui/tests/region/region.cpp | 69 |
10 files changed, 424 insertions, 214 deletions
diff --git a/libs/ui/Android.mk b/libs/ui/Android.mk index 0d2e44c..008446b 100644 --- a/libs/ui/Android.mk +++ b/libs/ui/Android.mk @@ -30,7 +30,8 @@ LOCAL_SHARED_LIBRARIES := \ libcutils \ libhardware \ libsync \ - libutils + libutils \ + liblog ifneq ($(BOARD_FRAMEBUFFER_FORCE_FORMAT),) LOCAL_CFLAGS += -DFRAMEBUFFER_FORCE_FORMAT=$(BOARD_FRAMEBUFFER_FORCE_FORMAT) diff --git a/libs/ui/Fence.cpp b/libs/ui/Fence.cpp index d214b97..464ee86 100644 --- a/libs/ui/Fence.cpp +++ b/libs/ui/Fence.cpp @@ -18,6 +18,9 @@ #define ATRACE_TAG ATRACE_TAG_GRAPHICS //#define LOG_NDEBUG 0 + // This is needed for stdint.h to define INT64_MAX in C++ + #define __STDC_LIMIT_MACROS + #include <sync/sync.h> #include <ui/Fence.h> #include <unistd.h> @@ -26,7 +29,7 @@ namespace android { -const sp<Fence> Fence::NO_FENCE = sp<Fence>(); +const sp<Fence> Fence::NO_FENCE = sp<Fence>(new Fence); Fence::Fence() : mFenceFd(-1) { @@ -51,11 +54,12 @@ status_t Fence::wait(unsigned int timeout) { return err < 0 ? -errno : status_t(NO_ERROR); } -status_t Fence::waitForever(unsigned int warningTimeout, const char* logname) { +status_t Fence::waitForever(const char* logname) { ATRACE_CALL(); if (mFenceFd == -1) { return NO_ERROR; } + unsigned int warningTimeout = 3000; int err = sync_wait(mFenceFd, warningTimeout); if (err < 0 && errno == ETIME) { ALOGE("%s: fence %d didn't signal in %u ms", logname, mFenceFd, @@ -68,7 +72,19 @@ status_t Fence::waitForever(unsigned int warningTimeout, const char* logname) { sp<Fence> Fence::merge(const String8& name, const sp<Fence>& f1, const sp<Fence>& f2) { ATRACE_CALL(); - int result = sync_merge(name.string(), f1->mFenceFd, f2->mFenceFd); + int result; + // Merge the two fences. In the case where one of the fences is not a + // valid fence (e.g. NO_FENCE) we merge the one valid fence with itself so + // that a new fence with the given name is created. + if (f1->isValid() && f2->isValid()) { + result = sync_merge(name.string(), f1->mFenceFd, f2->mFenceFd); + } else if (f1->isValid()) { + result = sync_merge(name.string(), f1->mFenceFd, f1->mFenceFd); + } else if (f2->isValid()) { + result = sync_merge(name.string(), f2->mFenceFd, f2->mFenceFd); + } else { + return NO_FENCE; + } if (result == -1) { status_t err = -errno; ALOGE("merge: sync_merge(\"%s\", %d, %d) returned an error: %s (%d)", @@ -80,10 +96,34 @@ sp<Fence> Fence::merge(const String8& name, const sp<Fence>& f1, } int Fence::dup() const { + return ::dup(mFenceFd); +} + +nsecs_t Fence::getSignalTime() const { if (mFenceFd == -1) { return -1; } - return ::dup(mFenceFd); + + struct sync_fence_info_data* finfo = sync_fence_info(mFenceFd); + if (finfo == NULL) { + ALOGE("sync_fence_info returned NULL for fd %d", mFenceFd); + return -1; + } + if (finfo->status != 1) { + sync_fence_info_free(finfo); + return INT64_MAX; + } + + struct sync_pt_info* pinfo = NULL; + uint64_t timestamp = 0; + while ((pinfo = sync_pt_info(finfo, pinfo)) != NULL) { + if (pinfo->timestamp_ns > timestamp) { + timestamp = pinfo->timestamp_ns; + } + } + sync_fence_info_free(finfo); + + return nsecs_t(timestamp); } size_t Fence::getFlattenedSize() const { @@ -91,22 +131,24 @@ size_t Fence::getFlattenedSize() const { } size_t Fence::getFdCount() const { - return 1; + return isValid() ? 1 : 0; } status_t Fence::flatten(void* buffer, size_t size, int fds[], size_t count) const { - if (size != 0 || count != 1) { + if (size != getFlattenedSize() || count != getFdCount()) { return BAD_VALUE; } - fds[0] = mFenceFd; + if (isValid()) { + fds[0] = mFenceFd; + } return NO_ERROR; } status_t Fence::unflatten(void const* buffer, size_t size, int fds[], size_t count) { - if (size != 0 || count != 1) { + if (size != 0 || (count != 0 && count != 1)) { return BAD_VALUE; } if (mFenceFd != -1) { @@ -114,7 +156,10 @@ status_t Fence::unflatten(void const* buffer, size_t size, int fds[], return INVALID_OPERATION; } - mFenceFd = fds[0]; + if (count == 1) { + mFenceFd = fds[0]; + } + return NO_ERROR; } diff --git a/libs/ui/GraphicBuffer.cpp b/libs/ui/GraphicBuffer.cpp index b9cab85..580788d 100644 --- a/libs/ui/GraphicBuffer.cpp +++ b/libs/ui/GraphicBuffer.cpp @@ -174,6 +174,27 @@ status_t GraphicBuffer::lock(uint32_t usage, const Rect& rect, void** vaddr) return res; } +status_t GraphicBuffer::lockYCbCr(uint32_t usage, android_ycbcr *ycbcr) +{ + const Rect lockBounds(width, height); + status_t res = lockYCbCr(usage, lockBounds, ycbcr); + return res; +} + +status_t GraphicBuffer::lockYCbCr(uint32_t usage, const Rect& rect, + android_ycbcr *ycbcr) +{ + if (rect.left < 0 || rect.right > this->width || + rect.top < 0 || rect.bottom > this->height) { + ALOGE("locking pixels (%d,%d,%d,%d) outside of buffer (w=%d, h=%d)", + rect.left, rect.top, rect.right, rect.bottom, + this->width, this->height); + return BAD_VALUE; + } + status_t res = getBufferMapper().lockYCbCr(handle, usage, rect, ycbcr); + return res; +} + status_t GraphicBuffer::unlock() { status_t res = getBufferMapper().unlock(handle); diff --git a/libs/ui/GraphicBufferAllocator.cpp b/libs/ui/GraphicBufferAllocator.cpp index fb43410..ff550d9 100644 --- a/libs/ui/GraphicBufferAllocator.cpp +++ b/libs/ui/GraphicBufferAllocator.cpp @@ -90,105 +90,6 @@ void GraphicBufferAllocator::dumpToSystemLog() ALOGD("%s", s.string()); } -class BufferLiberatorThread : public Thread { -public: - - static void queueCaptiveBuffer(buffer_handle_t handle) { - size_t queueSize; - { - Mutex::Autolock lock(sMutex); - if (sThread == NULL) { - sThread = new BufferLiberatorThread; - sThread->run("BufferLiberator"); - } - - sThread->mQueue.push_back(handle); - sThread->mQueuedCondition.signal(); - queueSize = sThread->mQueue.size(); - } - } - - static void waitForLiberation() { - Mutex::Autolock lock(sMutex); - - waitForLiberationLocked(); - } - - static void maybeWaitForLiberation() { - Mutex::Autolock lock(sMutex); - if (sThread != NULL) { - if (sThread->mQueue.size() > 8) { - waitForLiberationLocked(); - } - } - } - -private: - - BufferLiberatorThread() {} - - virtual bool threadLoop() { - buffer_handle_t handle; - { // Scope for mutex - Mutex::Autolock lock(sMutex); - while (mQueue.isEmpty()) { - mQueuedCondition.wait(sMutex); - } - handle = mQueue[0]; - } - - status_t err; - GraphicBufferAllocator& gba(GraphicBufferAllocator::get()); - { // Scope for tracing - ATRACE_NAME("gralloc::free"); - err = gba.mAllocDev->free(gba.mAllocDev, handle); - } - ALOGW_IF(err, "free(...) failed %d (%s)", err, strerror(-err)); - - if (err == NO_ERROR) { - Mutex::Autolock _l(GraphicBufferAllocator::sLock); - KeyedVector<buffer_handle_t, GraphicBufferAllocator::alloc_rec_t>& - list(GraphicBufferAllocator::sAllocList); - list.removeItem(handle); - } - - { // Scope for mutex - Mutex::Autolock lock(sMutex); - mQueue.removeAt(0); - mFreedCondition.broadcast(); - } - - return true; - } - - static void waitForLiberationLocked() { - if (sThread == NULL) { - return; - } - - const nsecs_t timeout = 500 * 1000 * 1000; - nsecs_t now = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t timeToStop = now + timeout; - while (!sThread->mQueue.isEmpty() && now < timeToStop) { - sThread->mFreedCondition.waitRelative(sMutex, timeToStop - now); - now = systemTime(SYSTEM_TIME_MONOTONIC); - } - - if (!sThread->mQueue.isEmpty()) { - ALOGW("waitForLiberationLocked timed out"); - } - } - - static Mutex sMutex; - static sp<BufferLiberatorThread> sThread; - Vector<buffer_handle_t> mQueue; - Condition mQueuedCondition; - Condition mFreedCondition; -}; - -Mutex BufferLiberatorThread::sMutex; -sp<BufferLiberatorThread> BufferLiberatorThread::sThread; - status_t GraphicBufferAllocator::alloc(uint32_t w, uint32_t h, PixelFormat format, int usage, buffer_handle_t* handle, int32_t* stride) { @@ -199,24 +100,13 @@ status_t GraphicBufferAllocator::alloc(uint32_t w, uint32_t h, PixelFormat forma w = h = 1; // we have a h/w allocator and h/w buffer is requested - status_t err; - - // If too many async frees are queued up then wait for some of them to - // complete before attempting to allocate more memory. This is exercised - // by the android.opengl.cts.GLSurfaceViewTest CTS test. - BufferLiberatorThread::maybeWaitForLiberation(); - + status_t err; + err = mAllocDev->alloc(mAllocDev, w, h, format, usage, handle, stride); - if (err != NO_ERROR) { - ALOGW("WOW! gralloc alloc failed, waiting for pending frees!"); - BufferLiberatorThread::waitForLiberation(); - err = mAllocDev->alloc(mAllocDev, w, h, format, usage, handle, stride); - } - ALOGW_IF(err, "alloc(%u, %u, %d, %08x, ...) failed %d (%s)", w, h, format, usage, err, strerror(-err)); - + if (err == NO_ERROR) { Mutex::Autolock _l(sLock); KeyedVector<buffer_handle_t, alloc_rec_t>& list(sAllocList); @@ -239,11 +129,21 @@ status_t GraphicBufferAllocator::alloc(uint32_t w, uint32_t h, PixelFormat forma return err; } - status_t GraphicBufferAllocator::free(buffer_handle_t handle) { - BufferLiberatorThread::queueCaptiveBuffer(handle); - return NO_ERROR; + ATRACE_CALL(); + status_t err; + + err = mAllocDev->free(mAllocDev, handle); + + ALOGW_IF(err, "free(...) failed %d (%s)", err, strerror(-err)); + if (err == NO_ERROR) { + Mutex::Autolock _l(sLock); + KeyedVector<buffer_handle_t, alloc_rec_t>& list(sAllocList); + list.removeItem(handle); + } + + return err; } // --------------------------------------------------------------------------- diff --git a/libs/ui/GraphicBufferMapper.cpp b/libs/ui/GraphicBufferMapper.cpp index 967da98..a4cfce2 100644 --- a/libs/ui/GraphicBufferMapper.cpp +++ b/libs/ui/GraphicBufferMapper.cpp @@ -84,6 +84,20 @@ status_t GraphicBufferMapper::lock(buffer_handle_t handle, return err; } +status_t GraphicBufferMapper::lockYCbCr(buffer_handle_t handle, + int usage, const Rect& bounds, android_ycbcr *ycbcr) +{ + ATRACE_CALL(); + status_t err; + + err = mAllocMod->lock_ycbcr(mAllocMod, handle, usage, + bounds.left, bounds.top, bounds.width(), bounds.height(), + ycbcr); + + ALOGW_IF(err, "lock(...) failed %d (%s)", err, strerror(-err)); + return err; +} + status_t GraphicBufferMapper::unlock(buffer_handle_t handle) { ATRACE_CALL(); diff --git a/libs/ui/Region.cpp b/libs/ui/Region.cpp index 932ef68..bf01488 100644 --- a/libs/ui/Region.cpp +++ b/libs/ui/Region.cpp @@ -47,6 +47,11 @@ enum { op_xor = region_operator<Rect>::op_xor }; +enum { + direction_LTR, + direction_RTL +}; + // ---------------------------------------------------------------------------- Region::Region() { @@ -69,6 +74,133 @@ Region::~Region() { } +/** + * Copy rects from the src vector into the dst vector, resolving vertical T-Junctions along the way + * + * First pass through, divideSpanRTL will be set because the 'previous span' (indexing into the dst + * vector) will be reversed. Each rectangle in the original list, starting from the bottom, will be + * compared with the span directly below, and subdivided as needed to resolve T-junctions. + * + * The resulting temporary vector will be a completely reversed copy of the original, without any + * bottom-up T-junctions. + * + * Second pass through, divideSpanRTL will be false since the previous span will index into the + * final, correctly ordered region buffer. Each rectangle will be compared with the span directly + * above it, and subdivided to resolve any remaining T-junctions. + */ +static void reverseRectsResolvingJunctions(const Rect* begin, const Rect* end, + Vector<Rect>& dst, int spanDirection) { + dst.clear(); + + const Rect* current = end - 1; + int lastTop = current->top; + + // add first span immediately + do { + dst.add(*current); + current--; + } while (current->top == lastTop && current >= begin); + + unsigned int beginLastSpan = -1; + unsigned int endLastSpan = -1; + int top = -1; + int bottom = -1; + + // for all other spans, split if a t-junction exists in the span directly above + while (current >= begin) { + if (current->top != (current + 1)->top) { + // new span + if ((spanDirection == direction_RTL && current->bottom != (current + 1)->top) || + (spanDirection == direction_LTR && current->top != (current + 1)->bottom)) { + // previous span not directly adjacent, don't check for T junctions + beginLastSpan = INT_MAX; + } else { + beginLastSpan = endLastSpan + 1; + } + endLastSpan = dst.size() - 1; + + top = current->top; + bottom = current->bottom; + } + int left = current->left; + int right = current->right; + + for (unsigned int prevIndex = beginLastSpan; prevIndex <= endLastSpan; prevIndex++) { + const Rect* prev = &dst[prevIndex]; + if (spanDirection == direction_RTL) { + // iterating over previous span RTL, quit if it's too far left + if (prev->right <= left) break; + + if (prev->right > left && prev->right < right) { + dst.add(Rect(prev->right, top, right, bottom)); + right = prev->right; + } + + if (prev->left > left && prev->left < right) { + dst.add(Rect(prev->left, top, right, bottom)); + right = prev->left; + } + + // if an entry in the previous span is too far right, nothing further left in the + // current span will need it + if (prev->left >= right) { + beginLastSpan = prevIndex; + } + } else { + // iterating over previous span LTR, quit if it's too far right + if (prev->left >= right) break; + + if (prev->left > left && prev->left < right) { + dst.add(Rect(left, top, prev->left, bottom)); + left = prev->left; + } + + if (prev->right > left && prev->right < right) { + dst.add(Rect(left, top, prev->right, bottom)); + left = prev->right; + } + // if an entry in the previous span is too far left, nothing further right in the + // current span will need it + if (prev->right <= left) { + beginLastSpan = prevIndex; + } + } + } + + if (left < right) { + dst.add(Rect(left, top, right, bottom)); + } + + current--; + } +} + +/** + * Creates a new region with the same data as the argument, but divides rectangles as necessary to + * remove T-Junctions + * + * Note: the output will not necessarily be a very efficient representation of the region, since it + * may be that a triangle-based approach would generate significantly simpler geometry + */ +Region Region::createTJunctionFreeRegion(const Region& r) { + if (r.isEmpty()) return r; + if (r.isRect()) return r; + + Vector<Rect> reversed; + reverseRectsResolvingJunctions(r.begin(), r.end(), reversed, direction_RTL); + + Region outputRegion; + reverseRectsResolvingJunctions(reversed.begin(), reversed.end(), + outputRegion.mStorage, direction_LTR); + outputRegion.mStorage.add(r.getBounds()); // to make region valid, mStorage must end with bounds + +#if VALIDATE_REGIONS + validate(outputRegion, "T-Junction free region"); +#endif + + return outputRegion; +} + Region& Region::operator = (const Region& rhs) { #if VALIDATE_REGIONS @@ -107,6 +239,10 @@ void Region::set(uint32_t w, uint32_t h) mStorage.add(Rect(w,h)); } +bool Region::isTriviallyEqual(const Region& region) const { + return begin() == region.begin(); +} + // ---------------------------------------------------------------------------- void Region::addRectUnchecked(int l, int t, int r, int b) @@ -398,9 +534,7 @@ bool Region::validate(const Region& reg, const char* name, bool silent) } if (result == false && !silent) { reg.dump(name); - CallStack stack; - stack.update(); - stack.dump(""); + CallStack stack(LOG_TAG); } return result; } diff --git a/libs/ui/tests/Android.mk b/libs/ui/tests/Android.mk index 50cad36..8b8e1d8 100644 --- a/libs/ui/tests/Android.mk +++ b/libs/ui/tests/Android.mk @@ -1,4 +1,28 @@ # Build the unit tests. +LOCAL_PATH := $(call my-dir) +include $(CLEAR_VARS) + +# Build the unit tests. +test_src_files := \ + Region_test.cpp + +shared_libraries := \ + libui + +static_libraries := \ + libgtest \ + libgtest_main + +$(foreach file,$(test_src_files), \ + $(eval include $(CLEAR_VARS)) \ + $(eval LOCAL_SHARED_LIBRARIES := $(shared_libraries)) \ + $(eval LOCAL_STATIC_LIBRARIES := $(static_libraries)) \ + $(eval LOCAL_SRC_FILES := $(file)) \ + $(eval LOCAL_MODULE := $(notdir $(file:%.cpp=%))) \ + $(eval include $(BUILD_NATIVE_TEST)) \ +) + +# Build the unit tests. LOCAL_PATH:= $(call my-dir) include $(CLEAR_VARS) diff --git a/libs/ui/tests/Region_test.cpp b/libs/ui/tests/Region_test.cpp new file mode 100644 index 0000000..b104a46 --- /dev/null +++ b/libs/ui/tests/Region_test.cpp @@ -0,0 +1,156 @@ +/* + * Copyright (C) 2013 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#define LOG_TAG "RegionTest" + +#include <stdlib.h> +#include <ui/Region.h> +#include <ui/Rect.h> +#include <gtest/gtest.h> + +namespace android { + +class RegionTest : public testing::Test { +protected: + void checkVertTJunction(const Rect* lhs, const Rect* rhs) { + EXPECT_FALSE((rhs->right > lhs->left && rhs->right < lhs->right) || + (rhs->left > lhs->left && rhs->left < lhs->right)); + } + + void verifyNoTJunctions(const Region& r) { + for (const Rect* current = r.begin(); current < r.end(); current++) { + for (const Rect* other = current - 1; other >= r.begin(); other--) { + if (other->bottom < current->top) break; + if (other->bottom != current->top) continue; + checkVertTJunction(current, other); + } + for (const Rect* other = current + 1; other < r.end(); other++) { + if (other->top > current->bottom) break; + if (other->top != current->bottom) continue; + checkVertTJunction(current, other); + } + } + } + + void checkTJunctionFreeFromRegion(const Region& original, int expectedCount = -1) { + Region modified = Region::createTJunctionFreeRegion(original); + verifyNoTJunctions(modified); + if (expectedCount != -1) { + EXPECT_EQ(modified.end() - modified.begin(), expectedCount); + } + EXPECT_TRUE((original ^ modified).isEmpty()); + } +}; + +TEST_F(RegionTest, MinimalDivision_TJunction) { + Region r; + // | x | + // |xxx| + r.clear(); + r.orSelf(Rect(1, 0, 2, 1)); + r.orSelf(Rect(0, 1, 3, 2)); + checkTJunctionFreeFromRegion(r, 4); + + // | x | + // | | + // |xxx| + r.clear(); + r.orSelf(Rect(1, 0, 2, 1)); + r.orSelf(Rect(0, 2, 3, 3)); + checkTJunctionFreeFromRegion(r, 2); +} + +TEST_F(RegionTest, Trivial_TJunction) { + Region r; + checkTJunctionFreeFromRegion(r); + + r.orSelf(Rect(100, 100, 500, 500)); + checkTJunctionFreeFromRegion(r); +} + +TEST_F(RegionTest, Simple_TJunction) { + Region r; + // | x | + // |xxxx| + // |xxxx| + // |xxxx| + r.clear(); + r.orSelf(Rect(1, 0, 2, 1)); + r.orSelf(Rect(0, 1, 3, 3)); + checkTJunctionFreeFromRegion(r); + + // | x | + // |xx | + // |xxx| + r.clear(); + r.orSelf(Rect(2,0,4,2)); + r.orSelf(Rect(0,2,4,4)); + r.orSelf(Rect(0,4,6,6)); + checkTJunctionFreeFromRegion(r); + + // |x x| + // |xxx| + // |x x| + r.clear(); + r.orSelf(Rect(0,0,2,6)); + r.orSelf(Rect(4,0,6,6)); + r.orSelf(Rect(0,2,6,4)); + checkTJunctionFreeFromRegion(r); + + // |xxx| + // | x | + // | x | + r.clear(); + r.orSelf(Rect(0,0,6,2)); + r.orSelf(Rect(2,2,4,6)); + checkTJunctionFreeFromRegion(r); +} + +TEST_F(RegionTest, Bigger_TJunction) { + Region r; + // |xxxx | + // | xxxx | + // | xxxx | + // | xxxx| + for (int i = 0; i < 4; i++) { + r.orSelf(Rect(i,i,i+4,i+1)); + } + checkTJunctionFreeFromRegion(r, 16); +} + +#define ITER_MAX 1000 +#define X_MAX 8 +#define Y_MAX 8 + +TEST_F(RegionTest, Random_TJunction) { + Region r; + srandom(12345); + + for (int iter = 0; iter < ITER_MAX; iter++) { + r.clear(); + for (int i = 0; i < X_MAX; i++) { + for (int j = 0; j < Y_MAX; j++) { + if (random() % 2) { + r.orSelf(Rect(i, j, i + 1, j + 1)); + } + } + } + checkTJunctionFreeFromRegion(r); + } +} + +}; // namespace android + diff --git a/libs/ui/tests/region/Android.mk b/libs/ui/tests/region/Android.mk deleted file mode 100644 index 6cc4a5a..0000000 --- a/libs/ui/tests/region/Android.mk +++ /dev/null @@ -1,16 +0,0 @@ -LOCAL_PATH:= $(call my-dir) -include $(CLEAR_VARS) - -LOCAL_SRC_FILES:= \ - region.cpp - -LOCAL_SHARED_LIBRARIES := \ - libcutils \ - libutils \ - libui - -LOCAL_MODULE:= test-region - -LOCAL_MODULE_TAGS := tests - -include $(BUILD_EXECUTABLE) diff --git a/libs/ui/tests/region/region.cpp b/libs/ui/tests/region/region.cpp deleted file mode 100644 index 6347294..0000000 --- a/libs/ui/tests/region/region.cpp +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (C) 2009 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#define LOG_TAG "Region" - -#include <stdio.h> -#include <utils/Debug.h> -#include <ui/Rect.h> -#include <ui/Region.h> - -using namespace android; - -int main() -{ - Region empty; - Region reg0( Rect( 0, 0, 100, 100 ) ); - Region reg1 = reg0; - Region reg2, reg3; - - Region reg4 = empty | reg1; - Region reg5 = reg1 | empty; - - reg4.dump("reg4"); - reg5.dump("reg5"); - - reg0.dump("reg0"); - reg1.dump("reg1"); - - reg0 = reg0 | reg0.translate(150, 0); - reg0.dump("reg0"); - reg1.dump("reg1"); - - reg0 = reg0 | reg0.translate(300, 0); - reg0.dump("reg0"); - reg1.dump("reg1"); - - //reg2 = reg0 | reg0.translate(0, 100); - //reg0.dump("reg0"); - //reg1.dump("reg1"); - //reg2.dump("reg2"); - - //reg3 = reg0 | reg0.translate(0, 150); - //reg0.dump("reg0"); - //reg1.dump("reg1"); - //reg2.dump("reg2"); - //reg3.dump("reg3"); - - ALOGD("---"); - reg2 = reg0 | reg0.translate(100, 0); - reg0.dump("reg0"); - reg1.dump("reg1"); - reg2.dump("reg2"); - - return 0; -} - |