libui: remove frameworks/native/include/ui symlink
Remove the global include for ui. Only symlink the two headers that are depended on by vendor code. The changes to Region and RegionHelepr were made by the linter. No code was changed. Bug: 145624276 Test: Compiles Change-Id: I1bbd99581faa703f73329ebde2da05d55950f910
This commit is contained in:
parent
28d8c7db9b
commit
15375f9262
13 changed files with 65 additions and 85 deletions
|
@ -1 +0,0 @@
|
|||
../libs/ui/include/ui
|
1
include/ui/DisplayInfo.h
Symbolic link
1
include/ui/DisplayInfo.h
Symbolic link
|
@ -0,0 +1 @@
|
|||
../../libs/ui/include/ui/DisplayInfo.h
|
1
include/ui/FloatRect.h
Symbolic link
1
include/ui/FloatRect.h
Symbolic link
|
@ -0,0 +1 @@
|
|||
../../libs/ui/include/ui/FloatRect.h
|
1
include/ui/PixelFormat.h
Symbolic link
1
include/ui/PixelFormat.h
Symbolic link
|
@ -0,0 +1 @@
|
|||
../../libs/ui/include/ui/PixelFormat.h
|
1
include/ui/Point.h
Symbolic link
1
include/ui/Point.h
Symbolic link
|
@ -0,0 +1 @@
|
|||
../../libs/ui/include/ui/Point.h
|
1
include/ui/PublicFormat.h
Symbolic link
1
include/ui/PublicFormat.h
Symbolic link
|
@ -0,0 +1 @@
|
|||
../../libs/ui/include/ui/PublicFormat.h
|
1
include/ui/Rect.h
Symbolic link
1
include/ui/Rect.h
Symbolic link
|
@ -0,0 +1 @@
|
|||
../../libs/ui/include/ui/Rect.h
|
1
include/ui/Region.h
Symbolic link
1
include/ui/Region.h
Symbolic link
|
@ -0,0 +1 @@
|
|||
../../libs/ui/include/ui/Region.h
|
1
include/ui/Size.h
Symbolic link
1
include/ui/Size.h
Symbolic link
|
@ -0,0 +1 @@
|
|||
../../libs/ui/include/ui/Size.h
|
|
@ -69,6 +69,10 @@ cc_library_shared {
|
|||
include_dirs: [
|
||||
"frameworks/native/include",
|
||||
],
|
||||
export_include_dirs: [
|
||||
"include",
|
||||
"include_private",
|
||||
],
|
||||
|
||||
// Uncomment the following line to enable VALIDATE_REGIONS traces
|
||||
//defaults: ["libui-validate-regions-defaults"],
|
||||
|
|
|
@ -27,7 +27,6 @@
|
|||
#include <ui/BufferHubBuffer.h>
|
||||
#endif // LIBUI_IN_VNDK
|
||||
|
||||
#include <ui/Gralloc2.h>
|
||||
#include <ui/GraphicBufferAllocator.h>
|
||||
#include <ui/GraphicBufferMapper.h>
|
||||
#include <utils/Trace.h>
|
||||
|
|
|
@ -23,11 +23,10 @@
|
|||
|
||||
#include <utils/Log.h>
|
||||
|
||||
#include <ui/Point.h>
|
||||
#include <ui/Rect.h>
|
||||
#include <ui/Region.h>
|
||||
#include <ui/Point.h>
|
||||
|
||||
#include <private/ui/RegionHelper.h>
|
||||
#include <ui/RegionHelper.h>
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
|
|
|
@ -17,18 +17,17 @@
|
|||
#ifndef ANDROID_UI_PRIVATE_REGION_HELPER_H
|
||||
#define ANDROID_UI_PRIVATE_REGION_HELPER_H
|
||||
|
||||
#include <limits>
|
||||
#include <stdint.h>
|
||||
#include <sys/types.h>
|
||||
#include <limits>
|
||||
|
||||
#include <limits>
|
||||
|
||||
namespace android {
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
template<typename RECT>
|
||||
class region_operator
|
||||
{
|
||||
template <typename RECT>
|
||||
class region_operator {
|
||||
public:
|
||||
typedef typename RECT::value_type TYPE;
|
||||
static const TYPE max_value = std::numeric_limits<TYPE>::max();
|
||||
|
@ -40,39 +39,32 @@ public:
|
|||
* their corresponding value with the above formulae and use
|
||||
* it when instantiating a region_operator.
|
||||
*/
|
||||
static const uint32_t LHS = 0x5; // 0b101
|
||||
static const uint32_t RHS = 0x6; // 0b110
|
||||
enum {
|
||||
op_nand = LHS & ~RHS,
|
||||
op_and = LHS & RHS,
|
||||
op_or = LHS | RHS,
|
||||
op_xor = LHS ^ RHS
|
||||
};
|
||||
static const uint32_t LHS = 0x5; // 0b101
|
||||
static const uint32_t RHS = 0x6; // 0b110
|
||||
enum { op_nand = LHS & ~RHS, op_and = LHS & RHS, op_or = LHS | RHS, op_xor = LHS ^ RHS };
|
||||
|
||||
struct region {
|
||||
RECT const* rects;
|
||||
size_t count;
|
||||
TYPE dx;
|
||||
TYPE dy;
|
||||
inline region(const region& rhs)
|
||||
: rects(rhs.rects), count(rhs.count), dx(rhs.dx), dy(rhs.dy) { }
|
||||
inline region(RECT const* _r, size_t _c)
|
||||
: rects(_r), count(_c), dx(), dy() { }
|
||||
inline region(const region& rhs)
|
||||
: rects(rhs.rects), count(rhs.count), dx(rhs.dx), dy(rhs.dy) {}
|
||||
inline region(RECT const* _r, size_t _c) : rects(_r), count(_c), dx(), dy() {}
|
||||
inline region(RECT const* _r, size_t _c, TYPE _dx, TYPE _dy)
|
||||
: rects(_r), count(_c), dx(_dx), dy(_dy) { }
|
||||
: rects(_r), count(_c), dx(_dx), dy(_dy) {}
|
||||
};
|
||||
|
||||
class region_rasterizer {
|
||||
friend class region_operator;
|
||||
virtual void operator()(const RECT& rect) = 0;
|
||||
|
||||
public:
|
||||
virtual ~region_rasterizer() { }
|
||||
virtual ~region_rasterizer() {}
|
||||
};
|
||||
|
||||
|
||||
inline region_operator(uint32_t op, const region& lhs, const region& rhs)
|
||||
: op_mask(op), spanner(lhs, rhs)
|
||||
{
|
||||
}
|
||||
: op_mask(op), spanner(lhs, rhs) {}
|
||||
|
||||
void operator()(region_rasterizer& rasterizer) {
|
||||
RECT current(Rect::EMPTY_RECT);
|
||||
|
@ -83,31 +75,26 @@ public:
|
|||
do {
|
||||
int inner_inside = spannerInner.next(current.left, current.right);
|
||||
if ((op_mask >> inner_inside) & 1) {
|
||||
if (current.left < current.right &&
|
||||
current.top < current.bottom) {
|
||||
if (current.left < current.right && current.top < current.bottom) {
|
||||
rasterizer(current);
|
||||
}
|
||||
}
|
||||
} while(!spannerInner.isDone());
|
||||
} while(!spanner.isDone());
|
||||
} while (!spannerInner.isDone());
|
||||
} while (!spanner.isDone());
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
uint32_t op_mask;
|
||||
|
||||
class SpannerBase
|
||||
{
|
||||
class SpannerBase {
|
||||
public:
|
||||
SpannerBase()
|
||||
: lhs_head(max_value), lhs_tail(max_value),
|
||||
rhs_head(max_value), rhs_tail(max_value) {
|
||||
}
|
||||
: lhs_head(max_value),
|
||||
lhs_tail(max_value),
|
||||
rhs_head(max_value),
|
||||
rhs_tail(max_value) {}
|
||||
|
||||
enum {
|
||||
lhs_before_rhs = 0,
|
||||
lhs_after_rhs = 1,
|
||||
lhs_coincide_rhs = 2
|
||||
};
|
||||
enum { lhs_before_rhs = 0, lhs_after_rhs = 1, lhs_coincide_rhs = 2 };
|
||||
|
||||
protected:
|
||||
TYPE lhs_head;
|
||||
|
@ -115,9 +102,7 @@ private:
|
|||
TYPE rhs_head;
|
||||
TYPE rhs_tail;
|
||||
|
||||
inline int next(TYPE& head, TYPE& tail,
|
||||
bool& more_lhs, bool& more_rhs)
|
||||
{
|
||||
inline int next(TYPE& head, TYPE& tail, bool& more_lhs, bool& more_rhs) {
|
||||
int inside;
|
||||
more_lhs = false;
|
||||
more_rhs = false;
|
||||
|
@ -157,32 +142,26 @@ private:
|
|||
}
|
||||
};
|
||||
|
||||
class Spanner : protected SpannerBase
|
||||
{
|
||||
class Spanner : protected SpannerBase {
|
||||
friend class region_operator;
|
||||
region lhs;
|
||||
region rhs;
|
||||
|
||||
public:
|
||||
inline Spanner(const region& _lhs, const region& _rhs)
|
||||
: lhs(_lhs), rhs(_rhs)
|
||||
{
|
||||
inline Spanner(const region& _lhs, const region& _rhs) : lhs(_lhs), rhs(_rhs) {
|
||||
if (lhs.count) {
|
||||
SpannerBase::lhs_head = lhs.rects->top + lhs.dy;
|
||||
SpannerBase::lhs_tail = lhs.rects->bottom + lhs.dy;
|
||||
SpannerBase::lhs_head = lhs.rects->top + lhs.dy;
|
||||
SpannerBase::lhs_tail = lhs.rects->bottom + lhs.dy;
|
||||
}
|
||||
if (rhs.count) {
|
||||
SpannerBase::rhs_head = rhs.rects->top + rhs.dy;
|
||||
SpannerBase::rhs_tail = rhs.rects->bottom + rhs.dy;
|
||||
SpannerBase::rhs_head = rhs.rects->top + rhs.dy;
|
||||
SpannerBase::rhs_tail = rhs.rects->bottom + rhs.dy;
|
||||
}
|
||||
}
|
||||
|
||||
inline bool isDone() const {
|
||||
return !rhs.count && !lhs.count;
|
||||
}
|
||||
inline bool isDone() const { return !rhs.count && !lhs.count; }
|
||||
|
||||
inline int next(TYPE& top, TYPE& bottom)
|
||||
{
|
||||
inline int next(TYPE& top, TYPE& bottom) {
|
||||
bool more_lhs = false;
|
||||
bool more_rhs = false;
|
||||
int inside = SpannerBase::next(top, bottom, more_lhs, more_rhs);
|
||||
|
@ -196,22 +175,21 @@ private:
|
|||
}
|
||||
|
||||
private:
|
||||
static inline
|
||||
void advance(region& reg, TYPE& aTop, TYPE& aBottom) {
|
||||
static inline void advance(region& reg, TYPE& aTop, TYPE& aBottom) {
|
||||
// got to next span
|
||||
size_t count = reg.count;
|
||||
RECT const * rects = reg.rects;
|
||||
RECT const * const end = rects + count;
|
||||
RECT const* rects = reg.rects;
|
||||
RECT const* const end = rects + count;
|
||||
const int top = rects->top;
|
||||
while (rects != end && rects->top == top) {
|
||||
rects++;
|
||||
count--;
|
||||
}
|
||||
if (rects != end) {
|
||||
aTop = rects->top + reg.dy;
|
||||
aTop = rects->top + reg.dy;
|
||||
aBottom = rects->bottom + reg.dy;
|
||||
} else {
|
||||
aTop = max_value;
|
||||
aTop = max_value;
|
||||
aBottom = max_value;
|
||||
}
|
||||
reg.rects = rects;
|
||||
|
@ -219,21 +197,17 @@ private:
|
|||
}
|
||||
};
|
||||
|
||||
class SpannerInner : protected SpannerBase
|
||||
{
|
||||
class SpannerInner : protected SpannerBase {
|
||||
region lhs;
|
||||
region rhs;
|
||||
|
||||
|
||||
public:
|
||||
inline SpannerInner(const region& _lhs, const region& _rhs)
|
||||
: lhs(_lhs), rhs(_rhs)
|
||||
{
|
||||
}
|
||||
inline SpannerInner(const region& _lhs, const region& _rhs) : lhs(_lhs), rhs(_rhs) {}
|
||||
|
||||
inline void prepare(int inside) {
|
||||
if (inside == SpannerBase::lhs_before_rhs) {
|
||||
if (lhs.count) {
|
||||
SpannerBase::lhs_head = lhs.rects->left + lhs.dx;
|
||||
SpannerBase::lhs_head = lhs.rects->left + lhs.dx;
|
||||
SpannerBase::lhs_tail = lhs.rects->right + lhs.dx;
|
||||
}
|
||||
SpannerBase::rhs_head = max_value;
|
||||
|
@ -242,28 +216,26 @@ private:
|
|||
SpannerBase::lhs_head = max_value;
|
||||
SpannerBase::lhs_tail = max_value;
|
||||
if (rhs.count) {
|
||||
SpannerBase::rhs_head = rhs.rects->left + rhs.dx;
|
||||
SpannerBase::rhs_head = rhs.rects->left + rhs.dx;
|
||||
SpannerBase::rhs_tail = rhs.rects->right + rhs.dx;
|
||||
}
|
||||
} else {
|
||||
if (lhs.count) {
|
||||
SpannerBase::lhs_head = lhs.rects->left + lhs.dx;
|
||||
SpannerBase::lhs_head = lhs.rects->left + lhs.dx;
|
||||
SpannerBase::lhs_tail = lhs.rects->right + lhs.dx;
|
||||
}
|
||||
if (rhs.count) {
|
||||
SpannerBase::rhs_head = rhs.rects->left + rhs.dx;
|
||||
SpannerBase::rhs_head = rhs.rects->left + rhs.dx;
|
||||
SpannerBase::rhs_tail = rhs.rects->right + rhs.dx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
inline bool isDone() const {
|
||||
return SpannerBase::lhs_head == max_value &&
|
||||
SpannerBase::rhs_head == max_value;
|
||||
return SpannerBase::lhs_head == max_value && SpannerBase::rhs_head == max_value;
|
||||
}
|
||||
|
||||
inline int next(TYPE& left, TYPE& right)
|
||||
{
|
||||
inline int next(TYPE& left, TYPE& right) {
|
||||
bool more_lhs = false;
|
||||
bool more_rhs = false;
|
||||
int inside = SpannerBase::next(left, right, more_lhs, more_rhs);
|
||||
|
@ -277,17 +249,16 @@ private:
|
|||
}
|
||||
|
||||
private:
|
||||
static inline
|
||||
void advance(region& reg, TYPE& left, TYPE& right) {
|
||||
static inline void advance(region& reg, TYPE& left, TYPE& right) {
|
||||
if (reg.rects && reg.count) {
|
||||
const int cur_span_top = reg.rects->top;
|
||||
reg.rects++;
|
||||
reg.count--;
|
||||
if (!reg.count || reg.rects->top != cur_span_top) {
|
||||
left = max_value;
|
||||
left = max_value;
|
||||
right = max_value;
|
||||
} else {
|
||||
left = reg.rects->left + reg.dx;
|
||||
left = reg.rects->left + reg.dx;
|
||||
right = reg.rects->right + reg.dx;
|
||||
}
|
||||
}
|
||||
|
@ -298,6 +269,6 @@ private:
|
|||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
};
|
||||
}; // namespace android
|
||||
|
||||
#endif /* ANDROID_UI_PRIVATE_REGION_HELPER_H */
|
Loading…
Reference in a new issue