Loading libs/hwui/Caches.cpp +10 −0 Original line number Diff line number Diff line Loading @@ -703,6 +703,8 @@ void Caches::initTempProperties() { propertyLightPosY = -1.0f; propertyLightPosZ = -1.0f; propertyAmbientRatio = -1.0f; propertyAmbientShadowStrength = -1; propertySpotShadowStrength = -1; } void Caches::setTempProperty(const char* name, const char* value) { Loading @@ -723,6 +725,14 @@ void Caches::setTempProperty(const char* name, const char* value) { propertyLightPosZ = fmin(fmax(atof(value), 0.0), 3000.0); ALOGD("lightPos Z = %.2f", propertyLightPosZ); return; } else if (!strcmp(name, "ambientShadowStrength")) { propertyAmbientShadowStrength = atoi(value); ALOGD("ambient shadow strength = 0x%x out of 0xff", propertyAmbientShadowStrength); return; } else if (!strcmp(name, "spotShadowStrength")) { propertySpotShadowStrength = atoi(value); ALOGD("spot shadow strength = 0x%x out of 0xff", propertySpotShadowStrength); return; } ALOGD(" failed"); } Loading libs/hwui/Caches.h +3 −0 Original line number Diff line number Diff line Loading @@ -366,6 +366,9 @@ public: float propertyLightPosY; float propertyLightPosZ; float propertyAmbientRatio; int propertyAmbientShadowStrength; int propertySpotShadowStrength; private: enum OverdrawColorSet { kColorSet_Default = 0, Loading libs/hwui/OpenGLRenderer.cpp +13 −4 Original line number Diff line number Diff line Loading @@ -3166,13 +3166,22 @@ status_t OpenGLRenderer::drawShadow(float casterAlpha, SkPaint paint; paint.setAntiAlias(true); // want to use AlphaVertex if (ambientShadowVertexBuffer && mAmbientShadowAlpha > 0) { paint.setARGB(casterAlpha * mAmbientShadowAlpha, 0, 0, 0); // The caller has made sure casterAlpha > 0. float ambientShadowAlpha = mAmbientShadowAlpha; if (CC_UNLIKELY(mCaches.propertyAmbientShadowStrength >= 0)) { ambientShadowAlpha = mCaches.propertyAmbientShadowStrength; } if (ambientShadowVertexBuffer && ambientShadowAlpha > 0) { paint.setARGB(casterAlpha * ambientShadowAlpha, 0, 0, 0); drawVertexBuffer(*ambientShadowVertexBuffer, &paint, kVertexBuffer_ShadowInterp); } if (spotShadowVertexBuffer && mSpotShadowAlpha > 0) { paint.setARGB(casterAlpha * mSpotShadowAlpha, 0, 0, 0); float spotShadowAlpha = mSpotShadowAlpha; if (CC_UNLIKELY(mCaches.propertySpotShadowStrength >= 0)) { spotShadowAlpha = mCaches.propertySpotShadowStrength; } if (spotShadowVertexBuffer && spotShadowAlpha > 0) { paint.setARGB(casterAlpha * spotShadowAlpha, 0, 0, 0); drawVertexBuffer(*spotShadowVertexBuffer, &paint, kVertexBuffer_ShadowInterp); } Loading Loading
libs/hwui/Caches.cpp +10 −0 Original line number Diff line number Diff line Loading @@ -703,6 +703,8 @@ void Caches::initTempProperties() { propertyLightPosY = -1.0f; propertyLightPosZ = -1.0f; propertyAmbientRatio = -1.0f; propertyAmbientShadowStrength = -1; propertySpotShadowStrength = -1; } void Caches::setTempProperty(const char* name, const char* value) { Loading @@ -723,6 +725,14 @@ void Caches::setTempProperty(const char* name, const char* value) { propertyLightPosZ = fmin(fmax(atof(value), 0.0), 3000.0); ALOGD("lightPos Z = %.2f", propertyLightPosZ); return; } else if (!strcmp(name, "ambientShadowStrength")) { propertyAmbientShadowStrength = atoi(value); ALOGD("ambient shadow strength = 0x%x out of 0xff", propertyAmbientShadowStrength); return; } else if (!strcmp(name, "spotShadowStrength")) { propertySpotShadowStrength = atoi(value); ALOGD("spot shadow strength = 0x%x out of 0xff", propertySpotShadowStrength); return; } ALOGD(" failed"); } Loading
libs/hwui/Caches.h +3 −0 Original line number Diff line number Diff line Loading @@ -366,6 +366,9 @@ public: float propertyLightPosY; float propertyLightPosZ; float propertyAmbientRatio; int propertyAmbientShadowStrength; int propertySpotShadowStrength; private: enum OverdrawColorSet { kColorSet_Default = 0, Loading
libs/hwui/OpenGLRenderer.cpp +13 −4 Original line number Diff line number Diff line Loading @@ -3166,13 +3166,22 @@ status_t OpenGLRenderer::drawShadow(float casterAlpha, SkPaint paint; paint.setAntiAlias(true); // want to use AlphaVertex if (ambientShadowVertexBuffer && mAmbientShadowAlpha > 0) { paint.setARGB(casterAlpha * mAmbientShadowAlpha, 0, 0, 0); // The caller has made sure casterAlpha > 0. float ambientShadowAlpha = mAmbientShadowAlpha; if (CC_UNLIKELY(mCaches.propertyAmbientShadowStrength >= 0)) { ambientShadowAlpha = mCaches.propertyAmbientShadowStrength; } if (ambientShadowVertexBuffer && ambientShadowAlpha > 0) { paint.setARGB(casterAlpha * ambientShadowAlpha, 0, 0, 0); drawVertexBuffer(*ambientShadowVertexBuffer, &paint, kVertexBuffer_ShadowInterp); } if (spotShadowVertexBuffer && mSpotShadowAlpha > 0) { paint.setARGB(casterAlpha * mSpotShadowAlpha, 0, 0, 0); float spotShadowAlpha = mSpotShadowAlpha; if (CC_UNLIKELY(mCaches.propertySpotShadowStrength >= 0)) { spotShadowAlpha = mCaches.propertySpotShadowStrength; } if (spotShadowVertexBuffer && spotShadowAlpha > 0) { paint.setARGB(casterAlpha * spotShadowAlpha, 0, 0, 0); drawVertexBuffer(*spotShadowVertexBuffer, &paint, kVertexBuffer_ShadowInterp); } Loading