diff options
| author | 2013-12-16 17:18:12 +0000 | |
|---|---|---|
| committer | 2013-12-16 17:18:12 +0000 | |
| commit | 27e391014a1e01dcc0c6b69c8ef78a60b1c0e751 (patch) | |
| tree | cdd3c02185604a35ecd31838de5f19f30c75a274 /libs/hwui/OpenGLRenderer.cpp | |
| parent | 95de161efd27f319929c438d6f330ab72f843a9b (diff) | |
| parent | 55bfb4e728fe1db619af5d2c287f4abe711b3343 (diff) | |
Merge "Calculate and show Ambient shadow."
Diffstat (limited to 'libs/hwui/OpenGLRenderer.cpp')
| -rw-r--r-- | libs/hwui/OpenGLRenderer.cpp | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp index 79df5201f62c..578a2517105d 100644 --- a/libs/hwui/OpenGLRenderer.cpp +++ b/libs/hwui/OpenGLRenderer.cpp @@ -36,7 +36,9 @@ #include "Fence.h" #include "PathTessellator.h" #include "Properties.h" +#include "ShadowTessellator.h" #include "Vector.h" +#include "VertexBuffer.h" namespace android { namespace uirenderer { @@ -2579,7 +2581,7 @@ status_t OpenGLRenderer::drawVertexBuffer(const VertexBuffer& vertexBuffer, SkPa setupDrawColorFilterUniforms(); setupDrawShaderUniforms(); - void* vertices = vertexBuffer.getBuffer(); + const void* vertices = vertexBuffer.getBuffer(); bool force = mCaches.unbindMeshBuffer(); mCaches.bindPositionVertexPointer(true, vertices, isAA ? gAlphaVertexStride : gVertexStride); mCaches.resetTexCoordsVertexPointer(); @@ -3393,22 +3395,13 @@ status_t OpenGLRenderer::drawShadow(const mat4& casterTransform, float casterAlp SkPaint paint; paint.setColor(0x3f000000); + // Force the draw to use alpha values. paint.setAntiAlias(true); - VertexBuffer vertexBuffer; - { - //TODO: populate vertex buffer with better shadow geometry. - Vector3 pivot(width/2, height/2, 0.0f); - casterTransform.mapPoint3d(pivot); - - float zScaleFactor = 0.5 + 0.0005f * pivot.z; - - SkPath path; - path.addRect(pivot.x - width * zScaleFactor, pivot.y - height * zScaleFactor, - pivot.x + width * zScaleFactor, pivot.y + height * zScaleFactor); - PathTessellator::tessellatePath(path, &paint, mSnapshot->transform, vertexBuffer); - } - return drawVertexBuffer(vertexBuffer, &paint); + VertexBuffer shadowVertexBuffer; + ShadowTessellator::tessellateAmbientShadow(width, height, casterTransform, + shadowVertexBuffer); + return drawVertexBuffer(shadowVertexBuffer, &paint); } status_t OpenGLRenderer::drawColorRects(const float* rects, int count, int color, |