Esempio n. 1
0
JNIEXPORT void JNICALL
Java_com_showtimemediacenter_showtime_STCore_glwMotion(JNIEnv *env,
                                                       jobject obj,
                                                       jint id,
                                                       jint action,
                                                       jint x,
                                                       jint y)
{
  android_glw_root_t *agr = (android_glw_root_t *)id;
  glw_root_t *gr = &agr->gr;
  glw_pointer_event_t gpe = {0};

  switch(action) {
  case 0: gpe.type = GLW_POINTER_LEFT_PRESS;    break;
  case 1: gpe.type = GLW_POINTER_LEFT_RELEASE;  break;
  case 2: gpe.type = GLW_POINTER_MOTION_UPDATE; break;
  default: return;
  }

  glw_lock(gr);
  gpe.x =  (2.0f * x / gr->gr_width ) - 1.0f;
  gpe.y = -(2.0f * y / gr->gr_height) + 1.0f;
  glw_pointer_event(gr, &gpe);
  glw_unlock(gr);
}
Esempio n. 2
0
/**
 * Load a view file and do lexographical parsing
 *
 * Returns pointer to last token, or NULL if an error occured.
 * If an error occured 'ei' will be filled with data
 */
token_t *
glw_view_load1(glw_root_t *gr, rstr_t *url, errorinfo_t *ei, token_t *prev,
               int may_unlock)
{
  token_t *last;
  char errbuf[256];

  rstr_t *p = fa_absolute_path(url, prev->file);

  if(may_unlock)
    glw_unlock(gr);

  buf_t *b = fa_load(rstr_get(p),
                     FA_LOAD_VPATHS(gr->gr_vpaths),
                     FA_LOAD_ERRBUF(errbuf, sizeof(errbuf)),
                     NULL);

  if(may_unlock)
    glw_lock(gr);

  if(b == NULL) {
    snprintf(ei->error, sizeof(ei->error), "Unable to open \"%s\" -- %s",
	     rstr_get(p), errbuf);
    snprintf(ei->file,  sizeof(ei->file),  "%s", rstr_get(prev->file));
    ei->line = prev->line;
    rstr_release(p);
    return NULL;
  }

  last = glw_view_lexer(gr, buf_cstr(b), ei, p, prev);
  buf_release(b);
  rstr_release(p);
  return last;
}
Esempio n. 3
0
static void
osk_returned(glw_ps3_t *gp)
{
  oskCallbackReturnParam param = {0};
  uint8_t ret[512];
  uint8_t buf[512];
  
  if(param.result != 0)
    return;

  assert(gp->osk_widget != NULL);

  param.length = sizeof(ret)/2;
  param.str_addr = (intptr_t)ret;
  oskUnloadAsync(&param);

  ucs2_to_utf8(buf, sizeof(buf), ret, sizeof(ret), 0);

  glw_lock(&gp->gr);

  glw_t *w = gp->osk_widget;
  if(!(w->glw_flags & GLW_DESTROYING) && w->glw_class->gc_update_text) {
    w->glw_class->gc_update_text(w, (const char *)buf);
  }
  glw_osk_close(&gp->gr);
  glw_unlock(&gp->gr);
}
Esempio n. 4
0
static void 
drawFrame(glw_ps3_t *gp, int buffer) 
{
  gcmContextData *ctx = gp->gr.gr_be.be_ctx;

  realityViewportTranslate(ctx,
			   gp->res.width/2, gp->res.height/2, 0.0, 0.0);
  realityViewportScale(ctx,
		       gp->res.width/2, -gp->res.height/2, 1.0, 0.0); 

  realityZControl(ctx, 0, 1, 1); // disable viewport culling

  // Enable alpha blending.
  realityBlendFunc(ctx,
		   NV30_3D_BLEND_FUNC_SRC_RGB_SRC_ALPHA |
		   NV30_3D_BLEND_FUNC_SRC_ALPHA_SRC_ALPHA,
		   NV30_3D_BLEND_FUNC_DST_RGB_ONE_MINUS_SRC_ALPHA |
		   NV30_3D_BLEND_FUNC_DST_ALPHA_ZERO);
  realityBlendEquation(ctx, NV40_3D_BLEND_EQUATION_RGB_FUNC_ADD |
		       NV40_3D_BLEND_EQUATION_ALPHA_FUNC_ADD);
  realityBlendEnable(ctx, 1);

  realityViewport(ctx, gp->res.width, gp->res.height);
  
  setupRenderTarget(gp, buffer);

  // set the clear color
  realitySetClearColor(ctx, 0x00000000);

  realitySetClearDepthValue(ctx, 0xffff);

  // Clear the buffers
  realityClearBuffers(ctx,
		      REALITY_CLEAR_BUFFERS_COLOR_R |
		      REALITY_CLEAR_BUFFERS_COLOR_G |
		      REALITY_CLEAR_BUFFERS_COLOR_B |
		      NV30_3D_CLEAR_BUFFERS_COLOR_A | 
		      REALITY_CLEAR_BUFFERS_DEPTH);


  // XMB may overwrite currently loaded shaders, so clear them out
  gp->gr.gr_be.be_vp_current = NULL;
  gp->gr.gr_be.be_fp_current = NULL;

  realityCullEnable(ctx, 1);
  realityFrontFace(ctx, REALITY_FRONT_FACE_CCW);
  realityCullFace(ctx, REALITY_CULL_FACE_BACK);

  glw_lock(&gp->gr);
  glw_prepare_frame(&gp->gr, 0);

  gp->gr.gr_width = gp->res.width;
  gp->gr.gr_height = gp->res.height;

  glw_rctx_t rc;
  glw_rctx_init(&rc, gp->gr.gr_width, gp->gr.gr_height);
  glw_layout0(gp->gr.gr_universe, &rc);
  glw_render0(gp->gr.gr_universe, &rc);
  glw_unlock(&gp->gr);
}
Esempio n. 5
0
static void
ui_courier_poll(void *aux, int val)
{
  glw_root_t *gr = aux;
  glw_lock(gr);
  prop_courier_poll(gr->gr_courier);
  glw_unlock(gr);
}
Esempio n. 6
0
static void
hide_cursor(glw_x11_t *gx11)
{
  glw_pointer_event_t gpe = {0};

  if(gx11->cursor_hidden)
    return;

  gx11->cursor_hidden = 1;
  XDefineCursor(gx11->display, gx11->win, gx11->blank_cursor);
 
  gpe.type = GLW_POINTER_GONE;
  glw_lock(&gx11->gr);
  glw_pointer_event(&gx11->gr, &gpe);
  glw_unlock(&gx11->gr);
}
Esempio n. 7
0
static void
window_shutdown(glw_x11_t *gx11)
{
  glw_video_reset(&gx11->gr);

  glFlush();
  XSync(gx11->display, False);

  if(gx11->is_fullscreen) {
    XUngrabPointer(gx11->display, CurrentTime);
    XUngrabKeyboard(gx11->display, CurrentTime);
  }
  glw_lock(&gx11->gr);
  glw_flush(&gx11->gr);
  glw_unlock(&gx11->gr);
  window_close(gx11);
}
Esempio n. 8
0
JNIEXPORT void JNICALL
Java_com_showtimemediacenter_showtime_STCore_glwFini(JNIEnv *env,
                                                     jobject obj,
                                                     jint id)
{
  android_glw_root_t *agr = (android_glw_root_t *)id;
  glw_root_t *gr = &agr->gr;

  TRACE(TRACE_DEBUG, "GLW", "GLW %p finishing", agr);

  glw_lock(gr);
  // Calling twice will unload all textures, etc
  glw_reap(gr);
  glw_reap(gr);
  glw_flush(gr);
  agr->agr_running = 0;
  hts_cond_signal(&agr->agr_runcond);
  glw_unlock(gr);
}
Esempio n. 9
0
JNIEXPORT void JNICALL
Java_com_showtimemediacenter_showtime_STCore_glwDestroy(JNIEnv *env,
                                                     jobject obj,
                                                     jint id)
{
  android_glw_root_t *agr = (android_glw_root_t *)id;
  glw_root_t *gr = &agr->gr;

  TRACE(TRACE_DEBUG, "GLW", "GLW %p destroying", agr);

  glw_lock(gr);
  while(agr->agr_running == 1)
    hts_cond_wait(&agr->agr_runcond, &gr->gr_mutex);
  glw_unlock(gr);

  TRACE(TRACE_DEBUG, "GLW", "GLW %p destroyed", agr);

  (*env)->DeleteGlobalRef(env, agr->agr_vrp);

  glw_unload_universe(gr);
  glw_fini(gr);
  free(gr);
}
Esempio n. 10
0
JNIEXPORT void JNICALL
Java_com_showtimemediacenter_showtime_STCore_glwStep(JNIEnv *env,
                                                     jobject obj,
                                                     jint id)
{
  android_glw_root_t *agr = (android_glw_root_t *)id;
  glw_root_t *gr = &agr->gr;

  glw_lock(gr);
  gr->gr_can_externalize = 1;
  gr->gr_externalize_cnt = 0;
  glViewport(0, 0, gr->gr_width, gr->gr_height);
  glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
  glw_prepare_frame(gr, 0);

  glw_rctx_t rc;
  glw_rctx_init(&rc, gr->gr_width, gr->gr_height, 1);
  glw_layout0(gr->gr_universe, &rc);
  glw_render0(gr->gr_universe, &rc);

  glw_unlock(gr);
  glw_post_scene(gr);

}