Loading libs/hwui/AmbientShadow.cpp +5 −3 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ #include <math.h> #include <utils/Log.h> #include <utils/Vector.h> #include "AmbientShadow.h" #include "Vertex.h" Loading Loading @@ -60,10 +61,11 @@ void AmbientShadow::createAmbientShadow(const Vector3* vertices, int vertexCount Vector2 centroid; calculatePolygonCentroid(vertices, vertexCount, centroid); Vector2 dir[rays]; Vector<Vector2> dir; // TODO: use C++11 unique_ptr dir.setCapacity(rays); float rayDist[rays]; float rayHeight[rays]; calculateRayDirections(rays, dir); calculateRayDirections(rays, dir.editArray()); // Calculate the length and height of the points along the edge. // Loading Loading @@ -105,7 +107,7 @@ void AmbientShadow::createAmbientShadow(const Vector3* vertices, int vertexCount for (int i = 0; i < rays; i++) { Vector2 normal(1.0f, 0.0f); calculateNormal(rays, i, dir, rayDist, normal); calculateNormal(rays, i, dir.array(), rayDist, normal); float opacity = strength * (0.5f) / (1 + rayHeight[i] / heightFactor); Loading libs/hwui/DisplayList.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -610,14 +610,14 @@ void DisplayList::iterate3dChildren(ChildrenSelectMode mode, OpenGLRenderer& ren handler(op, PROPERTY_SAVECOUNT, mClipToBounds); int rootRestoreTo = renderer.save(SkCanvas::kMatrix_SaveFlag | SkCanvas::kClip_SaveFlag); for (int i = 0; i < m3dNodes.size(); i++) { for (size_t i = 0; i < m3dNodes.size(); i++) { const float zValue = m3dNodes.keyAt(i); if (mode == kPositiveZChildren && zValue < 0.0f) continue; if (mode == kNegativeZChildren && zValue > 0.0f) break; const Vector<DrawDisplayListOp*>& nodesAtZ = m3dNodes[i]; for (int j = 0; j < nodesAtZ.size(); j++) { for (size_t j = 0; j < nodesAtZ.size(); j++) { DrawDisplayListOp* op = nodesAtZ[j]; if (mode == kPositiveZChildren) { /* draw shadow on renderer with parent matrix applied, passing in the child's total matrix Loading libs/hwui/Layer.h +2 −1 Original line number Diff line number Diff line Loading @@ -49,7 +49,8 @@ class DeferStateStruct; /** * A layer has dimensions and is backed by an OpenGL texture or FBO. */ struct Layer { class Layer { public: Layer(const uint32_t layerWidth, const uint32_t layerHeight); ~Layer(); Loading libs/hwui/OpenGLRenderer.cpp +9 −5 Original line number Diff line number Diff line Loading @@ -1795,7 +1795,8 @@ void OpenGLRenderer::setupDrawTextureTransformUniforms(mat4& transform) { GL_FALSE, &transform.data[0]); } void OpenGLRenderer::setupDrawMesh(GLvoid* vertices, GLvoid* texCoords, GLuint vbo) { void OpenGLRenderer::setupDrawMesh(const GLvoid* vertices, const GLvoid* texCoords, GLuint vbo) { bool force = false; if (!vertices || vbo) { force = mCaches.bindMeshBuffer(vbo == 0 ? mCaches.meshBuffer : vbo); Loading @@ -1811,7 +1812,8 @@ void OpenGLRenderer::setupDrawMesh(GLvoid* vertices, GLvoid* texCoords, GLuint v mCaches.unbindIndicesBuffer(); } void OpenGLRenderer::setupDrawMesh(GLvoid* vertices, GLvoid* texCoords, GLvoid* colors) { void OpenGLRenderer::setupDrawMesh(const GLvoid* vertices, const GLvoid* texCoords, const GLvoid* colors) { bool force = mCaches.unbindMeshBuffer(); GLsizei stride = sizeof(ColorTextureVertex); Loading @@ -1828,7 +1830,8 @@ void OpenGLRenderer::setupDrawMesh(GLvoid* vertices, GLvoid* texCoords, GLvoid* mCaches.unbindIndicesBuffer(); } void OpenGLRenderer::setupDrawMeshIndices(GLvoid* vertices, GLvoid* texCoords, GLuint vbo) { void OpenGLRenderer::setupDrawMeshIndices(const GLvoid* vertices, const GLvoid* texCoords, GLuint vbo) { bool force = false; // If vbo is != 0 we want to treat the vertices parameter as an offset inside // a VBO. However, if vertices is set to NULL and vbo == 0 then we want to Loading Loading @@ -2049,8 +2052,9 @@ status_t OpenGLRenderer::drawBitmapMesh(SkBitmap* bitmap, int meshWidth, int mes const uint32_t count = meshWidth * meshHeight * 6; ColorTextureVertex mesh[count]; ColorTextureVertex* vertex = mesh; Vector<ColorTextureVertex> mesh; // TODO: use C++11 unique_ptr mesh.setCapacity(count); ColorTextureVertex* vertex = mesh.editArray(); bool cleanupColors = false; if (!colors) { Loading libs/hwui/OpenGLRenderer.h +4 −4 Original line number Diff line number Diff line Loading @@ -861,7 +861,7 @@ private: * transformations are stored in the modelView matrix and uploaded to the shader. * * @param offset Set to true if the the matrix should be fudged (translated) slightly to disambiguate * geometry pixel positioning. See Vertex::gGeometryFudgeFactor. * geometry pixel positioning. See Vertex::GeometryFudgeFactor(). * * @param ignoreTransform Set to true if l,t,r,b coordinates already in layer space, * currentTransform() will be ignored. (e.g. when drawing clip in layer coordinates to stencil, Loading @@ -879,9 +879,9 @@ private: void setupDrawTextureTransform(); void setupDrawTextureTransformUniforms(mat4& transform); void setupDrawTextGammaUniforms(); void setupDrawMesh(GLvoid* vertices, GLvoid* texCoords = NULL, GLuint vbo = 0); void setupDrawMesh(GLvoid* vertices, GLvoid* texCoords, GLvoid* colors); void setupDrawMeshIndices(GLvoid* vertices, GLvoid* texCoords, GLuint vbo = 0); void setupDrawMesh(const GLvoid* vertices, const GLvoid* texCoords = NULL, GLuint vbo = 0); void setupDrawMesh(const GLvoid* vertices, const GLvoid* texCoords, const GLvoid* colors); void setupDrawMeshIndices(const GLvoid* vertices, const GLvoid* texCoords, GLuint vbo = 0); void setupDrawIndexedVertices(GLvoid* vertices); void accountForClear(SkXfermode::Mode mode); Loading Loading
libs/hwui/AmbientShadow.cpp +5 −3 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ #include <math.h> #include <utils/Log.h> #include <utils/Vector.h> #include "AmbientShadow.h" #include "Vertex.h" Loading Loading @@ -60,10 +61,11 @@ void AmbientShadow::createAmbientShadow(const Vector3* vertices, int vertexCount Vector2 centroid; calculatePolygonCentroid(vertices, vertexCount, centroid); Vector2 dir[rays]; Vector<Vector2> dir; // TODO: use C++11 unique_ptr dir.setCapacity(rays); float rayDist[rays]; float rayHeight[rays]; calculateRayDirections(rays, dir); calculateRayDirections(rays, dir.editArray()); // Calculate the length and height of the points along the edge. // Loading Loading @@ -105,7 +107,7 @@ void AmbientShadow::createAmbientShadow(const Vector3* vertices, int vertexCount for (int i = 0; i < rays; i++) { Vector2 normal(1.0f, 0.0f); calculateNormal(rays, i, dir, rayDist, normal); calculateNormal(rays, i, dir.array(), rayDist, normal); float opacity = strength * (0.5f) / (1 + rayHeight[i] / heightFactor); Loading
libs/hwui/DisplayList.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -610,14 +610,14 @@ void DisplayList::iterate3dChildren(ChildrenSelectMode mode, OpenGLRenderer& ren handler(op, PROPERTY_SAVECOUNT, mClipToBounds); int rootRestoreTo = renderer.save(SkCanvas::kMatrix_SaveFlag | SkCanvas::kClip_SaveFlag); for (int i = 0; i < m3dNodes.size(); i++) { for (size_t i = 0; i < m3dNodes.size(); i++) { const float zValue = m3dNodes.keyAt(i); if (mode == kPositiveZChildren && zValue < 0.0f) continue; if (mode == kNegativeZChildren && zValue > 0.0f) break; const Vector<DrawDisplayListOp*>& nodesAtZ = m3dNodes[i]; for (int j = 0; j < nodesAtZ.size(); j++) { for (size_t j = 0; j < nodesAtZ.size(); j++) { DrawDisplayListOp* op = nodesAtZ[j]; if (mode == kPositiveZChildren) { /* draw shadow on renderer with parent matrix applied, passing in the child's total matrix Loading
libs/hwui/Layer.h +2 −1 Original line number Diff line number Diff line Loading @@ -49,7 +49,8 @@ class DeferStateStruct; /** * A layer has dimensions and is backed by an OpenGL texture or FBO. */ struct Layer { class Layer { public: Layer(const uint32_t layerWidth, const uint32_t layerHeight); ~Layer(); Loading
libs/hwui/OpenGLRenderer.cpp +9 −5 Original line number Diff line number Diff line Loading @@ -1795,7 +1795,8 @@ void OpenGLRenderer::setupDrawTextureTransformUniforms(mat4& transform) { GL_FALSE, &transform.data[0]); } void OpenGLRenderer::setupDrawMesh(GLvoid* vertices, GLvoid* texCoords, GLuint vbo) { void OpenGLRenderer::setupDrawMesh(const GLvoid* vertices, const GLvoid* texCoords, GLuint vbo) { bool force = false; if (!vertices || vbo) { force = mCaches.bindMeshBuffer(vbo == 0 ? mCaches.meshBuffer : vbo); Loading @@ -1811,7 +1812,8 @@ void OpenGLRenderer::setupDrawMesh(GLvoid* vertices, GLvoid* texCoords, GLuint v mCaches.unbindIndicesBuffer(); } void OpenGLRenderer::setupDrawMesh(GLvoid* vertices, GLvoid* texCoords, GLvoid* colors) { void OpenGLRenderer::setupDrawMesh(const GLvoid* vertices, const GLvoid* texCoords, const GLvoid* colors) { bool force = mCaches.unbindMeshBuffer(); GLsizei stride = sizeof(ColorTextureVertex); Loading @@ -1828,7 +1830,8 @@ void OpenGLRenderer::setupDrawMesh(GLvoid* vertices, GLvoid* texCoords, GLvoid* mCaches.unbindIndicesBuffer(); } void OpenGLRenderer::setupDrawMeshIndices(GLvoid* vertices, GLvoid* texCoords, GLuint vbo) { void OpenGLRenderer::setupDrawMeshIndices(const GLvoid* vertices, const GLvoid* texCoords, GLuint vbo) { bool force = false; // If vbo is != 0 we want to treat the vertices parameter as an offset inside // a VBO. However, if vertices is set to NULL and vbo == 0 then we want to Loading Loading @@ -2049,8 +2052,9 @@ status_t OpenGLRenderer::drawBitmapMesh(SkBitmap* bitmap, int meshWidth, int mes const uint32_t count = meshWidth * meshHeight * 6; ColorTextureVertex mesh[count]; ColorTextureVertex* vertex = mesh; Vector<ColorTextureVertex> mesh; // TODO: use C++11 unique_ptr mesh.setCapacity(count); ColorTextureVertex* vertex = mesh.editArray(); bool cleanupColors = false; if (!colors) { Loading
libs/hwui/OpenGLRenderer.h +4 −4 Original line number Diff line number Diff line Loading @@ -861,7 +861,7 @@ private: * transformations are stored in the modelView matrix and uploaded to the shader. * * @param offset Set to true if the the matrix should be fudged (translated) slightly to disambiguate * geometry pixel positioning. See Vertex::gGeometryFudgeFactor. * geometry pixel positioning. See Vertex::GeometryFudgeFactor(). * * @param ignoreTransform Set to true if l,t,r,b coordinates already in layer space, * currentTransform() will be ignored. (e.g. when drawing clip in layer coordinates to stencil, Loading @@ -879,9 +879,9 @@ private: void setupDrawTextureTransform(); void setupDrawTextureTransformUniforms(mat4& transform); void setupDrawTextGammaUniforms(); void setupDrawMesh(GLvoid* vertices, GLvoid* texCoords = NULL, GLuint vbo = 0); void setupDrawMesh(GLvoid* vertices, GLvoid* texCoords, GLvoid* colors); void setupDrawMeshIndices(GLvoid* vertices, GLvoid* texCoords, GLuint vbo = 0); void setupDrawMesh(const GLvoid* vertices, const GLvoid* texCoords = NULL, GLuint vbo = 0); void setupDrawMesh(const GLvoid* vertices, const GLvoid* texCoords, const GLvoid* colors); void setupDrawMeshIndices(const GLvoid* vertices, const GLvoid* texCoords, GLuint vbo = 0); void setupDrawIndexedVertices(GLvoid* vertices); void accountForClear(SkXfermode::Mode mode); Loading