summaryrefslogtreecommitdiffstats
path: root/libs/hwui/utils
diff options
context:
space:
mode:
Diffstat (limited to 'libs/hwui/utils')
-rw-r--r--libs/hwui/utils/Macros.h4
-rw-r--r--libs/hwui/utils/PaintUtils.h7
2 files changed, 11 insertions, 0 deletions
diff --git a/libs/hwui/utils/Macros.h b/libs/hwui/utils/Macros.h
index fe43fdb..eae73a9 100644
--- a/libs/hwui/utils/Macros.h
+++ b/libs/hwui/utils/Macros.h
@@ -29,4 +29,8 @@
friend inline int compare_type(const Type& lhs, const Type& rhs) { return lhs.compare(rhs); } \
friend inline hash_t hash_type(const Type& entry) { return entry.hash(); }
+#define REQUIRE_COMPATIBLE_LAYOUT(Type) \
+ static_assert(std::is_standard_layout<Type>::value, \
+ #Type " must have standard layout")
+
#endif /* MACROS_H */
diff --git a/libs/hwui/utils/PaintUtils.h b/libs/hwui/utils/PaintUtils.h
index 679e2bf..1a5cbf8 100644
--- a/libs/hwui/utils/PaintUtils.h
+++ b/libs/hwui/utils/PaintUtils.h
@@ -37,6 +37,13 @@ public:
return resultMode;
}
+ static inline GLenum getFilter(const SkPaint* paint) {
+ if (!paint || paint->getFilterLevel() != SkPaint::kNone_FilterLevel) {
+ return GL_LINEAR;
+ }
+ return GL_NEAREST;
+ }
+
// TODO: move to a method on android:Paint? replace with SkPaint::nothingToDraw()?
static inline bool paintWillNotDraw(const SkPaint& paint) {
return paint.getAlpha() == 0