summaryrefslogtreecommitdiffstats
path: root/src/newt
diff options
context:
space:
mode:
Diffstat (limited to 'src/newt')
-rw-r--r--src/newt/classes/jogamp/newt/driver/bcm/vc/iv/WindowDriver.java17
-rw-r--r--src/newt/native/bcm_vc_iv.c21
2 files changed, 26 insertions, 12 deletions
diff --git a/src/newt/classes/jogamp/newt/driver/bcm/vc/iv/WindowDriver.java b/src/newt/classes/jogamp/newt/driver/bcm/vc/iv/WindowDriver.java
index 7b8d2e958..21fbea9ac 100644
--- a/src/newt/classes/jogamp/newt/driver/bcm/vc/iv/WindowDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/bcm/vc/iv/WindowDriver.java
@@ -53,20 +53,19 @@ public class WindowDriver extends WindowImpl {
if(0!=getParentWindowHandle()) {
throw new RuntimeException("Window parenting not supported (yet)");
}
- // FIXME: Hack - Native BCM_VC_IV code CreateWindow() uses the default alpha value setting,
- // which is alpha:8 ! Hence we require to chose alpha from the egl configurations.
- // TODO: Properly select the alpha mode in CreateWindow()! This will allow this hack.
- final Capabilities capsChosen = (Capabilities) capsRequested.cloneMutable();
- capsChosen.setAlphaBits(1);
final AbstractGraphicsConfiguration cfg = GraphicsConfigurationFactory.getFactory(getScreen().getDisplay().getGraphicsDevice(), capsRequested).chooseGraphicsConfiguration(
- capsChosen, capsRequested, capabilitiesChooser, getScreen().getGraphicsScreen(), VisualIDHolder.VID_UNDEFINED);
+ capsRequested, capsRequested, capabilitiesChooser, getScreen().getGraphicsScreen(), VisualIDHolder.VID_UNDEFINED);
if (null == cfg) {
throw new NativeWindowException("Error choosing GraphicsConfiguration creating window: "+this);
}
+ final Capabilities chosenCaps = (Capabilities) cfg.getChosenCapabilities();
+ // FIXME: Pass along opaque flag, since EGL doesn't determine it
+ if(capsRequested.isBackgroundOpaque() != chosenCaps.isBackgroundOpaque()) {
+ chosenCaps.setBackgroundOpaque(capsRequested.isBackgroundOpaque());
+ }
setGraphicsConfiguration(cfg);
-
- nativeWindowHandle = CreateWindow(getWidth(), getHeight());
+ nativeWindowHandle = CreateWindow(getWidth(), getHeight(), chosenCaps.isBackgroundOpaque(), chosenCaps.getAlphaBits());
if (nativeWindowHandle == 0) {
throw new NativeWindowException("Error creating egl window: "+cfg);
}
@@ -139,7 +138,7 @@ public class WindowDriver extends WindowImpl {
//
protected static native boolean initIDs();
- private native long CreateWindow(int width, int height);
+ private native long CreateWindow(int width, int height, boolean opaque, int alphaBits);
private native long RealizeWindow(long eglWindowHandle);
private native int CloseWindow(long eglWindowHandle, long userData);
private native void setVisible0(long eglWindowHandle, boolean visible);
diff --git a/src/newt/native/bcm_vc_iv.c b/src/newt/native/bcm_vc_iv.c
index e41745e14..0093da437 100644
--- a/src/newt/native/bcm_vc_iv.c
+++ b/src/newt/native/bcm_vc_iv.c
@@ -101,8 +101,9 @@ JNIEXPORT void JNICALL Java_jogamp_newt_driver_bcm_vc_iv_ScreenDriver_initNative
if( graphics_get_display_size(0 /* LCD */, &screen_width, &screen_height) >= 0 ) {
DBG_PRINT( "BCM.Screen initNative ok %dx%d\n", screen_width, screen_height );
(*env)->CallVoidMethod(env, obj, setScreenSizeID, (jint) screen_width, (jint) screen_height);
+ } else {
+ DBG_PRINT( "BCM.Screen initNative failed\n" );
}
- DBG_PRINT( "BCM.Screen initNative failed\n" );
}
/**
@@ -132,7 +133,7 @@ JNIEXPORT jboolean JNICALL Java_jogamp_newt_driver_bcm_vc_iv_WindowDriver_initID
}
JNIEXPORT jlong JNICALL Java_jogamp_newt_driver_bcm_vc_iv_WindowDriver_CreateWindow
- (JNIEnv *env, jobject obj, jint width, jint height)
+ (JNIEnv *env, jobject obj, jint width, jint height, jboolean opaque, jint alphaBits)
{
int32_t success = 0;
VC_RECT_T dst_rect;
@@ -148,12 +149,26 @@ JNIEXPORT jlong JNICALL Java_jogamp_newt_driver_bcm_vc_iv_WindowDriver_CreateWin
src_rect.width = width << 16;
src_rect.height = height << 16;
+ VC_DISPMANX_ALPHA_T dispman_alpha;
+ memset(&dispman_alpha, 0x0, sizeof(VC_DISPMANX_ALPHA_T));
+
+ if( JNI_TRUE == opaque ) {
+ dispman_alpha.flags = DISPMANX_FLAGS_ALPHA_FIXED_ALL_PIXELS ;
+ dispman_alpha.opacity = 0xFF;
+ dispman_alpha.mask = 0;
+ } else {
+ dispman_alpha.flags = DISPMANX_FLAGS_ALPHA_FROM_SOURCE ;
+ dispman_alpha.opacity = 0xFF;
+ dispman_alpha.mask = 0xFF;
+ }
+
DISPMANX_DISPLAY_HANDLE_T dispman_display = vc_dispmanx_display_open( 0 /* LCD */);
DISPMANX_UPDATE_HANDLE_T dispman_update = vc_dispmanx_update_start( 0 );
DISPMANX_ELEMENT_HANDLE_T dispman_element = vc_dispmanx_element_add ( dispman_update, dispman_display,
0/*layer*/, &dst_rect, 0/*src*/,
&src_rect, DISPMANX_PROTECTION_NONE,
- 0 /*alpha TODO*/, 0/*clamp*/, 0/*transform*/);
+ &dispman_alpha /*alpha */, 0/*clamp*/, 0/*transform*/);
+
EGL_DISPMANX_WINDOW_T * nativeWindowPtr = calloc(1, sizeof(EGL_DISPMANX_WINDOW_T));
nativeWindowPtr->element = dispman_element;
nativeWindowPtr->width = width;