summaryrefslogtreecommitdiffstats
path: root/libs
diff options
context:
space:
mode:
Diffstat (limited to 'libs')
-rw-r--r--libs/androidfw/ResourceTypes.cpp2
-rw-r--r--libs/hwui/RenderNode.cpp5
-rw-r--r--libs/hwui/RenderProperties.cpp42
-rw-r--r--libs/hwui/RenderProperties.h12
-rw-r--r--libs/hwui/ShadowTessellator.cpp4
-rw-r--r--libs/hwui/renderthread/CanvasContext.cpp7
6 files changed, 16 insertions, 56 deletions
diff --git a/libs/androidfw/ResourceTypes.cpp b/libs/androidfw/ResourceTypes.cpp
index 6aad5fb..7d4da01 100644
--- a/libs/androidfw/ResourceTypes.cpp
+++ b/libs/androidfw/ResourceTypes.cpp
@@ -102,7 +102,7 @@ static status_t validate_chunk(const ResChunk_header* chunk,
if (headerSize >= minSize) {
if (headerSize <= size) {
if (((headerSize|size)&0x3) == 0) {
- if ((ssize_t)size <= (dataEnd-((const uint8_t*)chunk))) {
+ if ((size_t)size <= (size_t)(dataEnd-((const uint8_t*)chunk))) {
return NO_ERROR;
}
ALOGW("%s data size 0x%x extends beyond resource end %p.",
diff --git a/libs/hwui/RenderNode.cpp b/libs/hwui/RenderNode.cpp
index 9902ff1..fba482d 100644
--- a/libs/hwui/RenderNode.cpp
+++ b/libs/hwui/RenderNode.cpp
@@ -238,9 +238,8 @@ void RenderNode::setViewProperties(OpenGLRenderer& renderer, T& handler) {
}
if (CC_UNLIKELY(properties().hasClippingPath())) {
- // TODO: optimize for round rect/circle clipping
- const SkPath* path = properties().getClippingPath();
- ClipPathOp* op = new (handler.allocator()) ClipPathOp(path, SkRegion::kIntersect_Op);
+ ClipPathOp* op = new (handler.allocator()) ClipPathOp(
+ properties().getClippingPath(), properties().getClippingPathOp());
handler(op, PROPERTY_SAVECOUNT, properties().getClipToBounds());
}
}
diff --git a/libs/hwui/RenderProperties.cpp b/libs/hwui/RenderProperties.cpp
index 99de1fc..5f7d4e3 100644
--- a/libs/hwui/RenderProperties.cpp
+++ b/libs/hwui/RenderProperties.cpp
@@ -50,14 +50,11 @@ RenderProperties::PrimitiveFields::PrimitiveFields()
}
RenderProperties::ComputedFields::ComputedFields()
- : mTransformMatrix(NULL)
- , mClipPath(NULL)
- , mClipPathOp(SkRegion::kIntersect_Op) {
+ : mTransformMatrix(NULL) {
}
RenderProperties::ComputedFields::~ComputedFields() {
delete mTransformMatrix;
- delete mClipPath;
}
RenderProperties::RenderProperties()
@@ -77,9 +74,6 @@ RenderProperties& RenderProperties::operator=(const RenderProperties& other) {
setAnimationMatrix(other.getAnimationMatrix());
setCameraDistance(other.getCameraDistance());
- // Update the computed clip path
- updateClipPath();
-
// Force recalculation of the matrix, since other's dirty bit may be clear
mPrimitiveFields.mMatrixOrPivotDirty = true;
updateMatrix();
@@ -166,39 +160,5 @@ void RenderProperties::updateMatrix() {
}
}
-void RenderProperties::updateClipPath() {
- const SkPath* outlineClipPath = mPrimitiveFields.mOutline.willClip()
- ? mPrimitiveFields.mOutline.getPath() : NULL;
- const SkPath* revealClipPath = mPrimitiveFields.mRevealClip.getPath();
-
- if (!outlineClipPath && !revealClipPath) {
- // mComputedFields.mClipPath doesn't need to be updated, since it won't be used
- return;
- }
-
- if (mComputedFields.mClipPath == NULL) {
- mComputedFields.mClipPath = new SkPath();
- }
- SkPath* clipPath = mComputedFields.mClipPath;
- mComputedFields.mClipPathOp = SkRegion::kIntersect_Op;
-
- if (outlineClipPath && revealClipPath) {
- SkPathOp op = kIntersect_PathOp;
- if (mPrimitiveFields.mRevealClip.isInverseClip()) {
- op = kDifference_PathOp; // apply difference step in the Op below, instead of draw time
- }
-
- Op(*outlineClipPath, *revealClipPath, op, clipPath);
- } else if (outlineClipPath) {
- *clipPath = *outlineClipPath;
- } else {
- *clipPath = *revealClipPath;
- if (mPrimitiveFields.mRevealClip.isInverseClip()) {
- // apply difference step at draw time
- mComputedFields.mClipPathOp = SkRegion::kDifference_Op;
- }
- }
-}
-
} /* namespace uirenderer */
} /* namespace android */
diff --git a/libs/hwui/RenderProperties.h b/libs/hwui/RenderProperties.h
index 6fc8bce..c0e3ce7 100644
--- a/libs/hwui/RenderProperties.h
+++ b/libs/hwui/RenderProperties.h
@@ -437,19 +437,17 @@ public:
ANDROID_API void updateMatrix();
- ANDROID_API void updateClipPath();
-
- // signals that mComputedFields.mClipPath is up to date, and should be used for clipping
bool hasClippingPath() const {
- return mPrimitiveFields.mOutline.willClip() || mPrimitiveFields.mRevealClip.willClip();
+ return mPrimitiveFields.mRevealClip.willClip();
}
const SkPath* getClippingPath() const {
- return hasClippingPath() ? mComputedFields.mClipPath : NULL;
+ return mPrimitiveFields.mRevealClip.getPath();
}
SkRegion::Op getClippingPathOp() const {
- return mComputedFields.mClipPathOp;
+ return mPrimitiveFields.mRevealClip.isInverseClip()
+ ? SkRegion::kDifference_Op : SkRegion::kIntersect_Op;
}
Outline& mutableOutline() {
@@ -505,8 +503,6 @@ private:
SkMatrix* mTransformMatrix;
Sk3DView mTransformCamera;
- SkPath* mClipPath; // TODO: remove this, create new ops for efficient/special case clipping
- SkRegion::Op mClipPathOp;
} mComputedFields;
};
diff --git a/libs/hwui/ShadowTessellator.cpp b/libs/hwui/ShadowTessellator.cpp
index be49aed..55b82e4 100644
--- a/libs/hwui/ShadowTessellator.cpp
+++ b/libs/hwui/ShadowTessellator.cpp
@@ -196,6 +196,10 @@ Vector2 ShadowTessellator::centroid2d(const Vector2* poly, int polyLength) {
* @param len the number of points of the polygon
*/
bool ShadowTessellator::isClockwise(const Vector2* polygon, int len) {
+ if (len < 2 || polygon == NULL) {
+ ALOGW("Invalid polygon %p, length is %d @ isClockwise()", polygon, len);
+ return true;
+ }
double sum = 0;
double p1x = polygon[len - 1].x;
double p1y = polygon[len - 1].y;
diff --git a/libs/hwui/renderthread/CanvasContext.cpp b/libs/hwui/renderthread/CanvasContext.cpp
index 5754536..48cd8fc 100644
--- a/libs/hwui/renderthread/CanvasContext.cpp
+++ b/libs/hwui/renderthread/CanvasContext.cpp
@@ -31,11 +31,10 @@
#define PROPERTY_RENDER_DIRTY_REGIONS "debug.hwui.render_dirty_regions"
#define GLES_VERSION 2
+#define USE_TEXTURE_ATLAS false
-#ifdef USE_OPENGL_RENDERER
// Android-specific addition that is used to show when frames began in systrace
EGLAPI void EGLAPIENTRY eglBeginFrame(EGLDisplay dpy, EGLSurface surface);
-#endif
namespace android {
namespace uirenderer {
@@ -230,7 +229,9 @@ void GlobalContext::setTextureAtlas(const sp<GraphicBuffer>& buffer,
}
void GlobalContext::initAtlas() {
- Caches::getInstance().assetAtlas.init(mAtlasBuffer, mAtlasMap, mAtlasMapSize);
+ if (USE_TEXTURE_ATLAS) {
+ Caches::getInstance().assetAtlas.init(mAtlasBuffer, mAtlasMap, mAtlasMapSize);
+ }
}
void GlobalContext::usePBufferSurface() {