Define light position (using new lighting spec) in Java
Also updates the relative shadow strengths.
Change-Id: I6cac7275d38df98aea9f0dda463cd7207102986a
diff --git a/libs/hwui/renderthread/CanvasContext.cpp b/libs/hwui/renderthread/CanvasContext.cpp
index 48cd8fc..839ef91 100644
--- a/libs/hwui/renderthread/CanvasContext.cpp
+++ b/libs/hwui/renderthread/CanvasContext.cpp
@@ -410,9 +410,10 @@
// and such to prevent from trying to render into this surface
}
-void CanvasContext::setup(int width, int height) {
+void CanvasContext::setup(int width, int height, const Vector3& lightCenter, float lightRadius) {
if (!mCanvas) return;
mCanvas->setViewport(width, height);
+ mCanvas->initializeLight(lightCenter, lightRadius);
}
void CanvasContext::setOpaque(bool opaque) {
diff --git a/libs/hwui/renderthread/CanvasContext.h b/libs/hwui/renderthread/CanvasContext.h
index a793d42..4232f27 100644
--- a/libs/hwui/renderthread/CanvasContext.h
+++ b/libs/hwui/renderthread/CanvasContext.h
@@ -51,7 +51,7 @@
bool initialize(EGLNativeWindowType window);
void updateSurface(EGLNativeWindowType window);
void pauseSurface(EGLNativeWindowType window);
- void setup(int width, int height);
+ void setup(int width, int height, const Vector3& lightCenter, float lightRadius);
void setOpaque(bool opaque);
void makeCurrent();
void prepareDraw(const Vector<DeferredLayerUpdater*>* layerUpdaters, TreeInfo& info);
diff --git a/libs/hwui/renderthread/RenderProxy.cpp b/libs/hwui/renderthread/RenderProxy.cpp
index 82a2dbc..ef8e45b 100644
--- a/libs/hwui/renderthread/RenderProxy.cpp
+++ b/libs/hwui/renderthread/RenderProxy.cpp
@@ -38,6 +38,7 @@
#define CREATE_BRIDGE2(name, a1, a2) CREATE_BRIDGE(name, a1,a2,,,,,,)
#define CREATE_BRIDGE3(name, a1, a2, a3) CREATE_BRIDGE(name, a1,a2,a3,,,,,)
#define CREATE_BRIDGE4(name, a1, a2, a3, a4) CREATE_BRIDGE(name, a1,a2,a3,a4,,,,)
+#define CREATE_BRIDGE5(name, a1, a2, a3, a4, a5) CREATE_BRIDGE(name, a1,a2,a3,a4,a5,,,)
#define CREATE_BRIDGE(name, a1, a2, a3, a4, a5, a6, a7, a8) \
typedef struct { \
a1; a2; a3; a4; a5; a6; a7; a8; \
@@ -146,16 +147,19 @@
postAndWait(task);
}
-CREATE_BRIDGE3(setup, CanvasContext* context, int width, int height) {
- args->context->setup(args->width, args->height);
+CREATE_BRIDGE5(setup, CanvasContext* context, int width, int height,
+ Vector3 lightCenter, int lightRadius) {
+ args->context->setup(args->width, args->height, args->lightCenter, args->lightRadius);
return NULL;
}
-void RenderProxy::setup(int width, int height) {
+void RenderProxy::setup(int width, int height, const Vector3& lightCenter, float lightRadius) {
SETUP_TASK(setup);
args->context = mContext;
args->width = width;
args->height = height;
+ args->lightCenter = lightCenter;
+ args->lightRadius = lightRadius;
post(task);
}
diff --git a/libs/hwui/renderthread/RenderProxy.h b/libs/hwui/renderthread/RenderProxy.h
index 4a7e70a..4d3499e 100644
--- a/libs/hwui/renderthread/RenderProxy.h
+++ b/libs/hwui/renderthread/RenderProxy.h
@@ -66,7 +66,7 @@
ANDROID_API bool initialize(const sp<ANativeWindow>& window);
ANDROID_API void updateSurface(const sp<ANativeWindow>& window);
ANDROID_API void pauseSurface(const sp<ANativeWindow>& window);
- ANDROID_API void setup(int width, int height);
+ ANDROID_API void setup(int width, int height, const Vector3& lightCenter, float lightRadius);
ANDROID_API void setOpaque(bool opaque);
ANDROID_API int syncAndDrawFrame(nsecs_t frameTimeNanos,
int dirtyLeft, int dirtyTop, int dirtyRight, int dirtyBottom);