summaryrefslogtreecommitdiffstats
path: root/include/ui
diff options
context:
space:
mode:
Diffstat (limited to 'include/ui')
-rw-r--r--include/ui/ANativeObjectBase.h102
-rw-r--r--include/ui/DisplayInfo.h52
-rw-r--r--include/ui/FramebufferNativeWindow.h94
-rw-r--r--include/ui/GraphicBuffer.h158
-rw-r--r--include/ui/GraphicBufferAllocator.h96
-rw-r--r--include/ui/GraphicBufferMapper.h64
-rw-r--r--include/ui/PixelFormat.h128
-rw-r--r--include/ui/Point.h87
-rw-r--r--include/ui/Rect.h149
-rw-r--r--include/ui/Region.h202
10 files changed, 0 insertions, 1132 deletions
diff --git a/include/ui/ANativeObjectBase.h b/include/ui/ANativeObjectBase.h
deleted file mode 100644
index 76e850f..0000000
--- a/include/ui/ANativeObjectBase.h
+++ /dev/null
@@ -1,102 +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.
- */
-
-#ifndef ANDROID_ANDROID_NATIVES_H
-#define ANDROID_ANDROID_NATIVES_H
-
-#include <sys/types.h>
-#include <string.h>
-
-#include <hardware/gralloc.h>
-#include <system/window.h>
-
-// ---------------------------------------------------------------------------
-
-/* FIXME: this is legacy for pixmaps */
-typedef struct egl_native_pixmap_t
-{
- int32_t version; /* must be 32 */
- int32_t width;
- int32_t height;
- int32_t stride;
- uint8_t* data;
- uint8_t format;
- uint8_t rfu[3];
- union {
- uint32_t compressedFormat;
- int32_t vstride;
- };
- int32_t reserved;
-} egl_native_pixmap_t;
-
-/*****************************************************************************/
-
-#ifdef __cplusplus
-
-#include <utils/RefBase.h>
-
-namespace android {
-
-/*
- * This helper class turns a ANativeXXX object type into a C++
- * reference-counted object; with proper type conversions.
- */
-template <typename NATIVE_TYPE, typename TYPE, typename REF>
-class ANativeObjectBase : public NATIVE_TYPE, public REF
-{
-public:
- // Disambiguate between the incStrong in REF and NATIVE_TYPE
- void incStrong(const void* id) const {
- REF::incStrong(id);
- }
- void decStrong(const void* id) const {
- REF::decStrong(id);
- }
-
-protected:
- typedef ANativeObjectBase<NATIVE_TYPE, TYPE, REF> BASE;
- ANativeObjectBase() : NATIVE_TYPE(), REF() {
- NATIVE_TYPE::common.incRef = incRef;
- NATIVE_TYPE::common.decRef = decRef;
- }
- static inline TYPE* getSelf(NATIVE_TYPE* self) {
- return static_cast<TYPE*>(self);
- }
- static inline TYPE const* getSelf(NATIVE_TYPE const* self) {
- return static_cast<TYPE const *>(self);
- }
- static inline TYPE* getSelf(android_native_base_t* base) {
- return getSelf(reinterpret_cast<NATIVE_TYPE*>(base));
- }
- static inline TYPE const * getSelf(android_native_base_t const* base) {
- return getSelf(reinterpret_cast<NATIVE_TYPE const*>(base));
- }
- static void incRef(android_native_base_t* base) {
- ANativeObjectBase* self = getSelf(base);
- self->incStrong(self);
- }
- static void decRef(android_native_base_t* base) {
- ANativeObjectBase* self = getSelf(base);
- self->decStrong(self);
- }
-};
-
-} // namespace android
-#endif // __cplusplus
-
-/*****************************************************************************/
-
-#endif /* ANDROID_ANDROID_NATIVES_H */
diff --git a/include/ui/DisplayInfo.h b/include/ui/DisplayInfo.h
deleted file mode 100644
index edd28a6..0000000
--- a/include/ui/DisplayInfo.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (C) 2007 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.
- */
-
-
-#ifndef ANDROID_UI_DISPLAY_INFO_H
-#define ANDROID_UI_DISPLAY_INFO_H
-
-#include <stdint.h>
-#include <sys/types.h>
-
-#include <ui/PixelFormat.h>
-
-namespace android {
-
-struct DisplayInfo {
- uint32_t w;
- uint32_t h;
- PixelFormatInfo pixelFormatInfo;
- uint8_t orientation;
- uint8_t reserved[3];
- float fps;
- float density;
- float xdpi;
- float ydpi;
-};
-
-/* Display orientations as defined in Surface.java and ISurfaceComposer.h. */
-enum {
- DISPLAY_ORIENTATION_0 = 0,
- DISPLAY_ORIENTATION_90 = 1,
- DISPLAY_ORIENTATION_180 = 2,
- DISPLAY_ORIENTATION_270 = 3
-};
-
-
-}; // namespace android
-
-#endif // ANDROID_COMPOSER_DISPLAY_INFO_H
-
diff --git a/include/ui/FramebufferNativeWindow.h b/include/ui/FramebufferNativeWindow.h
deleted file mode 100644
index b202b95..0000000
--- a/include/ui/FramebufferNativeWindow.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Copyright (C) 2007 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.
- */
-
-#ifndef ANDROID_FRAMEBUFFER_NATIVE_WINDOW_H
-#define ANDROID_FRAMEBUFFER_NATIVE_WINDOW_H
-
-#include <stdint.h>
-#include <sys/types.h>
-
-#include <EGL/egl.h>
-
-#include <utils/threads.h>
-#include <utils/String8.h>
-
-#include <ui/ANativeObjectBase.h>
-#include <ui/Rect.h>
-
-#define NUM_FRAME_BUFFERS 2
-
-extern "C" EGLNativeWindowType android_createDisplaySurface(void);
-
-// ---------------------------------------------------------------------------
-namespace android {
-// ---------------------------------------------------------------------------
-
-class Surface;
-class NativeBuffer;
-
-// ---------------------------------------------------------------------------
-
-class FramebufferNativeWindow
- : public ANativeObjectBase<
- ANativeWindow,
- FramebufferNativeWindow,
- LightRefBase<FramebufferNativeWindow> >
-{
-public:
- FramebufferNativeWindow();
-
- framebuffer_device_t const * getDevice() const { return fbDev; }
-
- bool isUpdateOnDemand() const { return mUpdateOnDemand; }
- status_t setUpdateRectangle(const Rect& updateRect);
- status_t compositionComplete();
-
- void dump(String8& result);
-
- // for debugging only
- int getCurrentBufferIndex() const;
-
-private:
- friend class LightRefBase<FramebufferNativeWindow>;
- ~FramebufferNativeWindow(); // this class cannot be overloaded
- static int setSwapInterval(ANativeWindow* window, int interval);
- static int dequeueBuffer(ANativeWindow* window, ANativeWindowBuffer** buffer);
- static int lockBuffer(ANativeWindow* window, ANativeWindowBuffer* buffer);
- static int queueBuffer(ANativeWindow* window, ANativeWindowBuffer* buffer);
- static int query(const ANativeWindow* window, int what, int* value);
- static int perform(ANativeWindow* window, int operation, ...);
-
- framebuffer_device_t* fbDev;
- alloc_device_t* grDev;
-
- sp<NativeBuffer> buffers[NUM_FRAME_BUFFERS];
- sp<NativeBuffer> front;
-
- mutable Mutex mutex;
- Condition mCondition;
- int32_t mNumBuffers;
- int32_t mNumFreeBuffers;
- int32_t mBufferHead;
- int32_t mCurrentBufferIndex;
- bool mUpdateOnDemand;
-};
-
-// ---------------------------------------------------------------------------
-}; // namespace android
-// ---------------------------------------------------------------------------
-
-#endif // ANDROID_FRAMEBUFFER_NATIVE_WINDOW_H
-
diff --git a/include/ui/GraphicBuffer.h b/include/ui/GraphicBuffer.h
deleted file mode 100644
index f318cd8..0000000
--- a/include/ui/GraphicBuffer.h
+++ /dev/null
@@ -1,158 +0,0 @@
-/*
- * Copyright (C) 2007 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.
- */
-
-#ifndef ANDROID_GRAPHIC_BUFFER_H
-#define ANDROID_GRAPHIC_BUFFER_H
-
-#include <stdint.h>
-#include <sys/types.h>
-
-#include <ui/ANativeObjectBase.h>
-#include <ui/PixelFormat.h>
-#include <ui/Rect.h>
-#include <utils/Flattenable.h>
-
-
-struct ANativeWindowBuffer;
-
-namespace android {
-
-class GraphicBufferMapper;
-
-// ===========================================================================
-// GraphicBuffer
-// ===========================================================================
-
-class GraphicBuffer
- : public ANativeObjectBase<
- ANativeWindowBuffer,
- GraphicBuffer,
- LightRefBase<GraphicBuffer> >, public Flattenable
-{
-public:
-
- enum {
- USAGE_SW_READ_NEVER = GRALLOC_USAGE_SW_READ_NEVER,
- USAGE_SW_READ_RARELY = GRALLOC_USAGE_SW_READ_RARELY,
- USAGE_SW_READ_OFTEN = GRALLOC_USAGE_SW_READ_OFTEN,
- USAGE_SW_READ_MASK = GRALLOC_USAGE_SW_READ_MASK,
-
- USAGE_SW_WRITE_NEVER = GRALLOC_USAGE_SW_WRITE_NEVER,
- USAGE_SW_WRITE_RARELY = GRALLOC_USAGE_SW_WRITE_RARELY,
- USAGE_SW_WRITE_OFTEN = GRALLOC_USAGE_SW_WRITE_OFTEN,
- USAGE_SW_WRITE_MASK = GRALLOC_USAGE_SW_WRITE_MASK,
-
- USAGE_SOFTWARE_MASK = USAGE_SW_READ_MASK|USAGE_SW_WRITE_MASK,
-
- USAGE_PROTECTED = GRALLOC_USAGE_PROTECTED,
-
- USAGE_HW_TEXTURE = GRALLOC_USAGE_HW_TEXTURE,
- USAGE_HW_RENDER = GRALLOC_USAGE_HW_RENDER,
- USAGE_HW_2D = GRALLOC_USAGE_HW_2D,
- USAGE_HW_COMPOSER = GRALLOC_USAGE_HW_COMPOSER,
- USAGE_HW_VIDEO_ENCODER = GRALLOC_USAGE_HW_VIDEO_ENCODER,
- USAGE_HW_MASK = GRALLOC_USAGE_HW_MASK
- };
-
- GraphicBuffer();
-
- // creates w * h buffer
- GraphicBuffer(uint32_t w, uint32_t h, PixelFormat format, uint32_t usage);
-
- // create a buffer from an existing handle
- GraphicBuffer(uint32_t w, uint32_t h, PixelFormat format, uint32_t usage,
- uint32_t stride, native_handle_t* handle, bool keepOwnership);
-
- // create a buffer from an existing ANativeWindowBuffer
- GraphicBuffer(ANativeWindowBuffer* buffer, bool keepOwnership);
-
- // return status
- status_t initCheck() const;
-
- uint32_t getWidth() const { return width; }
- uint32_t getHeight() const { return height; }
- uint32_t getStride() const { return stride; }
- uint32_t getUsage() const { return usage; }
- PixelFormat getPixelFormat() const { return format; }
- Rect getBounds() const { return Rect(width, height); }
-
- status_t reallocate(uint32_t w, uint32_t h, PixelFormat f, uint32_t usage);
-
- status_t lock(uint32_t usage, void** vaddr);
- status_t lock(uint32_t usage, const Rect& rect, void** vaddr);
- status_t unlock();
-
- ANativeWindowBuffer* getNativeBuffer() const;
-
- void setIndex(int index);
- int getIndex() const;
-
- // for debugging
- static void dumpAllocationsToSystemLog();
-
-private:
- virtual ~GraphicBuffer();
-
- enum {
- ownNone = 0,
- ownHandle = 1,
- ownData = 2,
- };
-
- inline const GraphicBufferMapper& getBufferMapper() const {
- return mBufferMapper;
- }
- inline GraphicBufferMapper& getBufferMapper() {
- return mBufferMapper;
- }
- uint8_t mOwner;
-
-private:
- friend class Surface;
- friend class BpSurface;
- friend class BnSurface;
- friend class SurfaceTextureClient;
- friend class LightRefBase<GraphicBuffer>;
- GraphicBuffer(const GraphicBuffer& rhs);
- GraphicBuffer& operator = (const GraphicBuffer& rhs);
- const GraphicBuffer& operator = (const GraphicBuffer& rhs) const;
-
- status_t initSize(uint32_t w, uint32_t h, PixelFormat format,
- uint32_t usage);
-
- void free_handle();
-
- // Flattenable interface
- size_t getFlattenedSize() const;
- size_t getFdCount() const;
- status_t flatten(void* buffer, size_t size,
- int fds[], size_t count) const;
- status_t unflatten(void const* buffer, size_t size,
- int fds[], size_t count);
-
-
- GraphicBufferMapper& mBufferMapper;
- ssize_t mInitCheck;
- int mIndex;
-
- // If we're wrapping another buffer then this reference will make sure it
- // doesn't get freed.
- sp<ANativeWindowBuffer> mWrappedBuffer;
-};
-
-}; // namespace android
-
-#endif // ANDROID_GRAPHIC_BUFFER_H
diff --git a/include/ui/GraphicBufferAllocator.h b/include/ui/GraphicBufferAllocator.h
deleted file mode 100644
index dffa788..0000000
--- a/include/ui/GraphicBufferAllocator.h
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
-**
-** Copyright 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.
-*/
-
-#ifndef ANDROID_BUFFER_ALLOCATOR_H
-#define ANDROID_BUFFER_ALLOCATOR_H
-
-#include <stdint.h>
-
-#include <cutils/native_handle.h>
-
-#include <utils/Errors.h>
-#include <utils/KeyedVector.h>
-#include <utils/threads.h>
-#include <utils/Singleton.h>
-
-#include <ui/PixelFormat.h>
-
-#include <hardware/gralloc.h>
-
-
-namespace android {
-// ---------------------------------------------------------------------------
-
-class String8;
-
-class GraphicBufferAllocator : public Singleton<GraphicBufferAllocator>
-{
-public:
- enum {
- USAGE_SW_READ_NEVER = GRALLOC_USAGE_SW_READ_NEVER,
- USAGE_SW_READ_RARELY = GRALLOC_USAGE_SW_READ_RARELY,
- USAGE_SW_READ_OFTEN = GRALLOC_USAGE_SW_READ_OFTEN,
- USAGE_SW_READ_MASK = GRALLOC_USAGE_SW_READ_MASK,
-
- USAGE_SW_WRITE_NEVER = GRALLOC_USAGE_SW_WRITE_NEVER,
- USAGE_SW_WRITE_RARELY = GRALLOC_USAGE_SW_WRITE_RARELY,
- USAGE_SW_WRITE_OFTEN = GRALLOC_USAGE_SW_WRITE_OFTEN,
- USAGE_SW_WRITE_MASK = GRALLOC_USAGE_SW_WRITE_MASK,
-
- USAGE_SOFTWARE_MASK = USAGE_SW_READ_MASK|USAGE_SW_WRITE_MASK,
-
- USAGE_HW_TEXTURE = GRALLOC_USAGE_HW_TEXTURE,
- USAGE_HW_RENDER = GRALLOC_USAGE_HW_RENDER,
- USAGE_HW_2D = GRALLOC_USAGE_HW_2D,
- USAGE_HW_MASK = GRALLOC_USAGE_HW_MASK
- };
-
- static inline GraphicBufferAllocator& get() { return getInstance(); }
-
-
- status_t alloc(uint32_t w, uint32_t h, PixelFormat format, int usage,
- buffer_handle_t* handle, int32_t* stride);
-
- status_t free(buffer_handle_t handle);
-
- void dump(String8& res) const;
- static void dumpToSystemLog();
-
-private:
- struct alloc_rec_t {
- uint32_t w;
- uint32_t h;
- uint32_t s;
- PixelFormat format;
- uint32_t usage;
- size_t size;
- };
-
- static Mutex sLock;
- static KeyedVector<buffer_handle_t, alloc_rec_t> sAllocList;
-
- friend class Singleton<GraphicBufferAllocator>;
- GraphicBufferAllocator();
- ~GraphicBufferAllocator();
-
- alloc_device_t *mAllocDev;
-};
-
-// ---------------------------------------------------------------------------
-}; // namespace android
-
-#endif // ANDROID_BUFFER_ALLOCATOR_H
diff --git a/include/ui/GraphicBufferMapper.h b/include/ui/GraphicBufferMapper.h
deleted file mode 100644
index 697a02a..0000000
--- a/include/ui/GraphicBufferMapper.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright (C) 2007 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.
- */
-
-#ifndef ANDROID_UI_BUFFER_MAPPER_H
-#define ANDROID_UI_BUFFER_MAPPER_H
-
-#include <stdint.h>
-#include <sys/types.h>
-
-#include <utils/Singleton.h>
-
-#include <hardware/gralloc.h>
-
-
-struct gralloc_module_t;
-
-namespace android {
-
-// ---------------------------------------------------------------------------
-
-class Rect;
-
-class GraphicBufferMapper : public Singleton<GraphicBufferMapper>
-{
-public:
- static inline GraphicBufferMapper& get() { return getInstance(); }
-
- status_t registerBuffer(buffer_handle_t handle);
-
- status_t unregisterBuffer(buffer_handle_t handle);
-
- status_t lock(buffer_handle_t handle,
- int usage, const Rect& bounds, void** vaddr);
-
- status_t unlock(buffer_handle_t handle);
-
- // dumps information about the mapping of this handle
- void dump(buffer_handle_t handle);
-
-private:
- friend class Singleton<GraphicBufferMapper>;
- GraphicBufferMapper();
- gralloc_module_t const *mAllocMod;
-};
-
-// ---------------------------------------------------------------------------
-
-}; // namespace android
-
-#endif // ANDROID_UI_BUFFER_MAPPER_H
-
diff --git a/include/ui/PixelFormat.h b/include/ui/PixelFormat.h
deleted file mode 100644
index 9f3e267..0000000
--- a/include/ui/PixelFormat.h
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * Copyright (C) 2005 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.
- */
-
-//
-
-// Pixel formats used across the system.
-// These formats might not all be supported by all renderers, for instance
-// skia or SurfaceFlinger are not required to support all of these formats
-// (either as source or destination)
-
-
-#ifndef UI_PIXELFORMAT_H
-#define UI_PIXELFORMAT_H
-
-#include <stdint.h>
-#include <sys/types.h>
-#include <utils/Errors.h>
-#include <hardware/hardware.h>
-
-namespace android {
-
-enum {
- //
- // these constants need to match those
- // in graphics/PixelFormat.java & pixelflinger/format.h
- //
- PIXEL_FORMAT_UNKNOWN = 0,
- PIXEL_FORMAT_NONE = 0,
-
- // logical pixel formats used by the SurfaceFlinger -----------------------
- PIXEL_FORMAT_CUSTOM = -4,
- // Custom pixel-format described by a PixelFormatInfo structure
-
- PIXEL_FORMAT_TRANSLUCENT = -3,
- // System chooses a format that supports translucency (many alpha bits)
-
- PIXEL_FORMAT_TRANSPARENT = -2,
- // System chooses a format that supports transparency
- // (at least 1 alpha bit)
-
- PIXEL_FORMAT_OPAQUE = -1,
- // System chooses an opaque format (no alpha bits required)
-
- // real pixel formats supported for rendering -----------------------------
-
- PIXEL_FORMAT_RGBA_8888 = HAL_PIXEL_FORMAT_RGBA_8888, // 4x8-bit RGBA
- PIXEL_FORMAT_RGBX_8888 = HAL_PIXEL_FORMAT_RGBX_8888, // 4x8-bit RGB0
- PIXEL_FORMAT_RGB_888 = HAL_PIXEL_FORMAT_RGB_888, // 3x8-bit RGB
- PIXEL_FORMAT_RGB_565 = HAL_PIXEL_FORMAT_RGB_565, // 16-bit RGB
- PIXEL_FORMAT_BGRA_8888 = HAL_PIXEL_FORMAT_BGRA_8888, // 4x8-bit BGRA
- PIXEL_FORMAT_RGBA_5551 = HAL_PIXEL_FORMAT_RGBA_5551, // 16-bit ARGB
- PIXEL_FORMAT_RGBA_4444 = HAL_PIXEL_FORMAT_RGBA_4444, // 16-bit ARGB
- PIXEL_FORMAT_A_8 = 8, // 8-bit A
-};
-
-typedef int32_t PixelFormat;
-
-struct PixelFormatInfo {
- enum {
- INDEX_ALPHA = 0,
- INDEX_RED = 1,
- INDEX_GREEN = 2,
- INDEX_BLUE = 3
- };
-
- enum { // components
- ALPHA = 1,
- RGB = 2,
- RGBA = 3,
- L = 4,
- LA = 5,
- OTHER = 0xFF
- };
-
- struct szinfo {
- uint8_t h;
- uint8_t l;
- };
-
- inline PixelFormatInfo() : version(sizeof(PixelFormatInfo)) { }
- size_t getScanlineSize(unsigned int width) const;
- size_t getSize(size_t ci) const {
- return (ci <= 3) ? (cinfo[ci].h - cinfo[ci].l) : 0;
- }
- size_t version;
- PixelFormat format;
- size_t bytesPerPixel;
- size_t bitsPerPixel;
- union {
- szinfo cinfo[4];
- struct {
- uint8_t h_alpha;
- uint8_t l_alpha;
- uint8_t h_red;
- uint8_t l_red;
- uint8_t h_green;
- uint8_t l_green;
- uint8_t h_blue;
- uint8_t l_blue;
- };
- };
- uint8_t components;
- uint8_t reserved0[3];
- uint32_t reserved1;
-};
-
-// Consider caching the results of these functions are they're not
-// guaranteed to be fast.
-ssize_t bytesPerPixel(PixelFormat format);
-ssize_t bitsPerPixel(PixelFormat format);
-status_t getPixelFormatInfo(PixelFormat format, PixelFormatInfo* info);
-
-}; // namespace android
-
-#endif // UI_PIXELFORMAT_H
diff --git a/include/ui/Point.h b/include/ui/Point.h
deleted file mode 100644
index 1653120..0000000
--- a/include/ui/Point.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Copyright (C) 2006 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.
- */
-
-#ifndef ANDROID_UI_POINT
-#define ANDROID_UI_POINT
-
-#include <utils/TypeHelpers.h>
-
-namespace android {
-
-class Point
-{
-public:
- int x;
- int y;
-
- // we don't provide copy-ctor and operator= on purpose
- // because we want the compiler generated versions
-
- // Default constructor doesn't initialize the Point
- inline Point() {
- }
- inline Point(int x, int y) : x(x), y(y) {
- }
-
- inline bool operator == (const Point& rhs) const {
- return (x == rhs.x) && (y == rhs.y);
- }
- inline bool operator != (const Point& rhs) const {
- return !operator == (rhs);
- }
-
- inline bool isOrigin() const {
- return !(x|y);
- }
-
- // operator < defines an order which allows to use points in sorted
- // vectors.
- bool operator < (const Point& rhs) const {
- return y<rhs.y || (y==rhs.y && x<rhs.x);
- }
-
- inline Point& operator - () {
- x = -x;
- y = -y;
- return *this;
- }
-
- inline Point& operator += (const Point& rhs) {
- x += rhs.x;
- y += rhs.y;
- return *this;
- }
- inline Point& operator -= (const Point& rhs) {
- x -= rhs.x;
- y -= rhs.y;
- return *this;
- }
-
- const Point operator + (const Point& rhs) const {
- const Point result(x+rhs.x, y+rhs.y);
- return result;
- }
- const Point operator - (const Point& rhs) const {
- const Point result(x-rhs.x, y-rhs.y);
- return result;
- }
-};
-
-ANDROID_BASIC_TYPES_TRAITS(Point)
-
-}; // namespace android
-
-#endif // ANDROID_UI_POINT
diff --git a/include/ui/Rect.h b/include/ui/Rect.h
deleted file mode 100644
index 9e98bc5..0000000
--- a/include/ui/Rect.h
+++ /dev/null
@@ -1,149 +0,0 @@
-/*
- * Copyright (C) 2006 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.
- */
-
-#ifndef ANDROID_UI_RECT
-#define ANDROID_UI_RECT
-
-#include <utils/TypeHelpers.h>
-#include <ui/Point.h>
-
-#include <android/rect.h>
-
-namespace android {
-
-class Rect : public ARect
-{
-public:
- typedef ARect::value_type value_type;
-
- // we don't provide copy-ctor and operator= on purpose
- // because we want the compiler generated versions
-
- inline Rect() {
- }
- inline Rect(int32_t w, int32_t h) {
- left = top = 0; right = w; bottom = h;
- }
- inline Rect(int32_t l, int32_t t, int32_t r, int32_t b) {
- left = l; top = t; right = r; bottom = b;
- }
- inline Rect(const Point& lt, const Point& rb) {
- left = lt.x; top = lt.y; right = rb.x; bottom = rb.y;
- }
-
- void makeInvalid();
-
- inline void clear() {
- left = top = right = bottom = 0;
- }
-
- // a valid rectangle has a non negative width and height
- inline bool isValid() const {
- return (width()>=0) && (height()>=0);
- }
-
- // an empty rect has a zero width or height, or is invalid
- inline bool isEmpty() const {
- return (width()<=0) || (height()<=0);
- }
-
- inline void set(const Rect& rhs) {
- operator = (rhs);
- }
-
- // rectangle's width
- inline int32_t width() const {
- return right-left;
- }
-
- // rectangle's height
- inline int32_t height() const {
- return bottom-top;
- }
-
- void setLeftTop(const Point& lt) {
- left = lt.x;
- top = lt.y;
- }
-
- void setRightBottom(const Point& rb) {
- right = rb.x;
- bottom = rb.y;
- }
-
- // the following 4 functions return the 4 corners of the rect as Point
- Point leftTop() const {
- return Point(left, top);
- }
- Point rightBottom() const {
- return Point(right, bottom);
- }
- Point rightTop() const {
- return Point(right, top);
- }
- Point leftBottom() const {
- return Point(left, bottom);
- }
-
- // comparisons
- inline bool operator == (const Rect& rhs) const {
- return (left == rhs.left) && (top == rhs.top) &&
- (right == rhs.right) && (bottom == rhs.bottom);
- }
-
- inline bool operator != (const Rect& rhs) const {
- return !operator == (rhs);
- }
-
- // operator < defines an order which allows to use rectangles in sorted
- // vectors.
- bool operator < (const Rect& rhs) const;
-
- Rect& offsetToOrigin() {
- right -= left;
- bottom -= top;
- left = top = 0;
- return *this;
- }
- Rect& offsetTo(const Point& p) {
- return offsetTo(p.x, p.y);
- }
- Rect& offsetBy(const Point& dp) {
- return offsetBy(dp.x, dp.y);
- }
- Rect& operator += (const Point& rhs) {
- return offsetBy(rhs.x, rhs.y);
- }
- Rect& operator -= (const Point& rhs) {
- return offsetBy(-rhs.x, -rhs.y);
- }
- const Rect operator + (const Point& rhs) const;
- const Rect operator - (const Point& rhs) const;
-
- void translate(int32_t dx, int32_t dy) { // legacy, don't use.
- offsetBy(dx, dy);
- }
-
- Rect& offsetTo(int32_t x, int32_t y);
- Rect& offsetBy(int32_t x, int32_t y);
- bool intersect(const Rect& with, Rect* result) const;
-};
-
-ANDROID_BASIC_TYPES_TRAITS(Rect)
-
-}; // namespace android
-
-#endif // ANDROID_UI_RECT
diff --git a/include/ui/Region.h b/include/ui/Region.h
deleted file mode 100644
index f242f18..0000000
--- a/include/ui/Region.h
+++ /dev/null
@@ -1,202 +0,0 @@
-/*
- * Copyright (C) 2007 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.
- */
-
-#ifndef ANDROID_UI_REGION_H
-#define ANDROID_UI_REGION_H
-
-#include <stdint.h>
-#include <sys/types.h>
-
-#include <utils/Vector.h>
-
-#include <ui/Rect.h>
-
-namespace android {
-// ---------------------------------------------------------------------------
-
-class String8;
-
-// ---------------------------------------------------------------------------
-class Region
-{
-public:
- Region();
- Region(const Region& rhs);
- explicit Region(const Rect& rhs);
- explicit Region(const void* buffer);
- ~Region();
-
- Region& operator = (const Region& rhs);
-
- inline bool isEmpty() const { return mBounds.isEmpty(); }
- inline bool isRect() const { return mStorage.isEmpty(); }
-
- inline Rect getBounds() const { return mBounds; }
- inline Rect bounds() const { return getBounds(); }
-
- // the region becomes its bounds
- Region& makeBoundsSelf();
-
- void clear();
- void set(const Rect& r);
- void set(uint32_t w, uint32_t h);
-
- Region& orSelf(const Rect& rhs);
- Region& xorSelf(const Rect& rhs);
- Region& andSelf(const Rect& rhs);
- Region& subtractSelf(const Rect& rhs);
-
- // boolean operators, applied on this
- Region& orSelf(const Region& rhs);
- Region& xorSelf(const Region& rhs);
- Region& andSelf(const Region& rhs);
- Region& subtractSelf(const Region& rhs);
-
- // boolean operators
- const Region merge(const Rect& rhs) const;
- const Region mergeExclusive(const Rect& rhs) const;
- const Region intersect(const Rect& rhs) const;
- const Region subtract(const Rect& rhs) const;
-
- // boolean operators
- const Region merge(const Region& rhs) const;
- const Region mergeExclusive(const Region& rhs) const;
- const Region intersect(const Region& rhs) const;
- const Region subtract(const Region& rhs) const;
-
- // these translate rhs first
- Region& translateSelf(int dx, int dy);
- Region& orSelf(const Region& rhs, int dx, int dy);
- Region& xorSelf(const Region& rhs, int dx, int dy);
- Region& andSelf(const Region& rhs, int dx, int dy);
- Region& subtractSelf(const Region& rhs, int dx, int dy);
-
- // these translate rhs first
- const Region translate(int dx, int dy) const;
- const Region merge(const Region& rhs, int dx, int dy) const;
- const Region mergeExclusive(const Region& rhs, int dx, int dy) const;
- const Region intersect(const Region& rhs, int dx, int dy) const;
- const Region subtract(const Region& rhs, int dx, int dy) const;
-
- // convenience operators overloads
- inline const Region operator | (const Region& rhs) const;
- inline const Region operator ^ (const Region& rhs) const;
- inline const Region operator & (const Region& rhs) const;
- inline const Region operator - (const Region& rhs) const;
- inline const Region operator + (const Point& pt) const;
-
- inline Region& operator |= (const Region& rhs);
- inline Region& operator ^= (const Region& rhs);
- inline Region& operator &= (const Region& rhs);
- inline Region& operator -= (const Region& rhs);
- inline Region& operator += (const Point& pt);
-
-
- /* various ways to access the rectangle list */
-
- typedef Rect const* const_iterator;
-
- const_iterator begin() const;
- const_iterator end() const;
-
- /* no user serviceable parts here... */
-
- size_t getRects(Vector<Rect>& rectList) const;
- Rect const* getArray(size_t* count) const;
-
-
- // add a rectangle to the internal list. This rectangle must
- // be sorted in Y and X and must not make the region invalid.
- void addRectUnchecked(int l, int t, int r, int b);
-
- // flatten/unflatten a region to/from a raw buffer
- ssize_t write(void* buffer, size_t size) const;
- static ssize_t writeEmpty(void* buffer, size_t size);
-
- ssize_t read(const void* buffer);
- static bool isEmpty(void* buffer);
-
- void dump(String8& out, const char* what, uint32_t flags=0) const;
- void dump(const char* what, uint32_t flags=0) const;
-
-private:
- class rasterizer;
- friend class rasterizer;
-
- Region& operationSelf(const Rect& r, int op);
- Region& operationSelf(const Region& r, int op);
- Region& operationSelf(const Region& r, int dx, int dy, int op);
- const Region operation(const Rect& rhs, int op) const;
- const Region operation(const Region& rhs, int op) const;
- const Region operation(const Region& rhs, int dx, int dy, int op) const;
-
- static void boolean_operation(int op, Region& dst,
- const Region& lhs, const Region& rhs, int dx, int dy);
- static void boolean_operation(int op, Region& dst,
- const Region& lhs, const Rect& rhs, int dx, int dy);
-
- static void boolean_operation(int op, Region& dst,
- const Region& lhs, const Region& rhs);
- static void boolean_operation(int op, Region& dst,
- const Region& lhs, const Rect& rhs);
-
- static void translate(Region& reg, int dx, int dy);
- static void translate(Region& dst, const Region& reg, int dx, int dy);
-
- static bool validate(const Region& reg, const char* name);
-
- Rect mBounds;
- Vector<Rect> mStorage;
-};
-
-
-const Region Region::operator | (const Region& rhs) const {
- return merge(rhs);
-}
-const Region Region::operator ^ (const Region& rhs) const {
- return mergeExclusive(rhs);
-}
-const Region Region::operator & (const Region& rhs) const {
- return intersect(rhs);
-}
-const Region Region::operator - (const Region& rhs) const {
- return subtract(rhs);
-}
-const Region Region::operator + (const Point& pt) const {
- return translate(pt.x, pt.y);
-}
-
-
-Region& Region::operator |= (const Region& rhs) {
- return orSelf(rhs);
-}
-Region& Region::operator ^= (const Region& rhs) {
- return xorSelf(rhs);
-}
-Region& Region::operator &= (const Region& rhs) {
- return andSelf(rhs);
-}
-Region& Region::operator -= (const Region& rhs) {
- return subtractSelf(rhs);
-}
-Region& Region::operator += (const Point& pt) {
- return translateSelf(pt.x, pt.y);
-}
-// ---------------------------------------------------------------------------
-}; // namespace android
-
-#endif // ANDROID_UI_REGION_H
-