コード例 #1
0
ファイル: ctl_list.c プロジェクト: sub77-bkp/libaroma
/*
 * Function    : _libaroma_ctl_list_dodraw_item
 * Return Value: byte
 * Descriptions: do draw item directly
 */
byte _libaroma_ctl_list_dodraw_item(
    LIBAROMA_CONTROLP ctl,
    LIBAROMA_CTL_LIST_ITEMP item
){
  if (!item){
    return 0;
  }
  byte res=0;
  if (libaroma_ctl_scroll_is_visible(ctl,item->y,item->h)){
    word bgcolor = libaroma_ctl_scroll_get_bg_color(ctl);
    LIBAROMA_CANVASP canvas=libaroma_canvas(ctl->w,item->h);
    if (canvas!=NULL){
      _libaroma_ctl_list_draw_item(
        ctl,item,canvas,bgcolor
      );
      res=libaroma_ctl_scroll_blit(
         ctl, 
         canvas,
         0, item->y, canvas->w, canvas->h,
         0
      );
      libaroma_canvas_free(canvas);
    }
  }
  return res;
} /* End of _libaroma_ctl_list_dodraw_item */
コード例 #2
0
ファイル: window.c プロジェクト: sub77-bkp/libaroma
/*
 * Function    : _libaroma_window_updatebg
 * Return Value: byte
 * Descriptions: update window background
 */
byte _libaroma_window_updatebg(LIBAROMA_WINDOWP win){
  if (win==NULL){
    ALOGW("window_recalculate win is NULL");
    return 0;
  }
  if (win->handler!=NULL){
    if (win->handler->updatebg!=NULL){
      return win->handler->updatebg(win);
    }
  }
  if (win->parent!=NULL){
    return 0;
  }
  int w = win->w;
  int h = win->h;
  
  /* draw background */
  if (win->bg!=NULL){
    if ((win->bg->w==w)&&(win->bg->h==h)){
      /* not need recreate background */
      return 1;
    }
    libaroma_canvas_free(win->bg);
  }
  win->bg = libaroma_canvas(w,h);
  libaroma_canvas_setcolor(
    win->bg,
    libaroma_colorget(NULL,win)->window_bg,
    0xff
  );
  return 1;
} /* End of _libaroma_window_updatebg */
コード例 #3
0
void _libaroma_ctl_fragment_measure(LIBAROMA_WINDOWP win){
  _VALIDATE_FRAGMENT();
  libaroma_mutex_lock(me->dmutex);
  win->x = 0;
  win->y = 0;
  win->ax=ctl->x;
  win->ay=ctl->y;
  win->w = ctl->w;
  win->h = ctl->h;
  if (win->dc){
    if ((win->dc->w!=win->w)||(win->dc->h!=win->h)){
      libaroma_canvas_free(win->dc);
      win->dc=NULL;
    }
  }
  if (!win->dc){
    win->dc = libaroma_canvas(
      win->w,
      win->h
    );
  }
  _libaroma_ctl_fragment_window_updatebg(win);
  int i;
  #ifdef LIBAROMA_CONFIG_OPENMP
    #pragma omp parallel for
  #endif
  for (i=0;i<win->childn;i++){
    libaroma_window_measure(win,win->childs[i]);
  }
  libaroma_mutex_unlock(me->dmutex);
}
コード例 #4
0
ファイル: ctl_pager.c プロジェクト: Ever-Never/libaroma
/*
 * Function    : _libaroma_ctl_pager_window_updatebg
 * Return Value: byte
 * Descriptions: window update background
 */
byte _libaroma_ctl_pager_window_updatebg(LIBAROMA_WINDOWP win){
  LIBAROMA_CONTROLP ctl=(LIBAROMA_CONTROLP) win->client_data;
  _LIBAROMA_CTL_CHECK(
    _libaroma_ctl_pager_handler, _LIBAROMA_CTL_PAGERP, 0
  );
  if (me->win!=win){
    return 0;
  }
  int w = win->w;
  int h = win->h;
  /* draw background */
  if (win->bg!=NULL){
    if ((win->bg->w==w)&&(win->bg->h==h)){
      /* not need recreate background */
      return 1;
    }
    libaroma_canvas_free(win->bg);
  }
  win->bg = libaroma_canvas(w,h);
  libaroma_canvas_setcolor(
    win->bg,
    libaroma_colorget(ctl,NULL)->window_bg,
    0xff
  );
  
  return 1;
} /* End of _libaroma_ctl_pager_window_sync */
コード例 #5
0
ファイル: ctl_list.c プロジェクト: sub77-bkp/libaroma
/*
 * Function    : _libaroma_ctl_list_init_state_cache
 * Return Value: byte
 * Descriptions: init cache canvases
 */
byte _libaroma_ctl_list_init_state_cache(
  LIBAROMA_CONTROLP ctl,
  LIBAROMA_CTL_LIST_ITEMP item
){
  LIBAROMA_CTL_SCROLL_CLIENTP client = libaroma_ctl_scroll_get_client(ctl);
  if (!client){
    return 0;
  }
  if (client->handler!=&_libaroma_ctl_list_handler){
    return 0;
  }
  LIBAROMA_CTL_SCROLLP mi = (LIBAROMA_CTL_SCROLLP) client->internal;
  
  if (item->state){
    if (!item->state->cache_rest){
      item->state->cache_rest=libaroma_canvas(ctl->w,item->h);
    }
    if (!item->state->cache_push){
      item->state->cache_push=libaroma_canvas(ctl->w,item->h);
    }
    word bgcolor = libaroma_ctl_scroll_get_bg_color(ctl);
    if (item->state->cache_rest){
      _libaroma_ctl_list_draw_item_fresh(
        ctl,item,item->state->cache_rest,bgcolor,mi->hpad,
        LIBAROMA_CTL_LIST_ITEM_DRAW_NORMAL|LIBAROMA_CTL_LIST_ITEM_DRAW_CACHE
      );
    }
    if (item->state->cache_push){
      _libaroma_ctl_list_draw_item_fresh(
        ctl,item,item->state->cache_push,bgcolor,mi->hpad,
        LIBAROMA_CTL_LIST_ITEM_DRAW_PUSHED|LIBAROMA_CTL_LIST_ITEM_DRAW_CACHE
      );
    }
    return 1;
  }
  return 0;
} /* End of _libaroma_ctl_list_init_state_cache */
コード例 #6
0
ファイル: recovery_libs.c プロジェクト: Ever-Never/libaroma
void recovery_statusbar_sidebar_list_cb(
  LIBAROMA_CONTROLP ctl,LIBAROMA_CANVASP cv,int sy){
  if (recovery_statusbar_overlay_canvas){
    if ((recovery_statusbar_overlay_canvas->w!=cv->w)||
       (recovery_statusbar_overlay_canvas->h!=cv->h)){
      libaroma_canvas_free(recovery_statusbar_overlay_canvas);
    }
  }
  if (recovery_statusbar_overlay_canvas==NULL){
    recovery_statusbar_overlay_canvas=libaroma_canvas(
      cv->w, cv->h
    );
  }
  libaroma_draw(
    recovery_statusbar_overlay_canvas, cv, 0, 0, 0
  );
  if (recovery_statusbar_side_w){
    recovery_statusbar_force_update=1;
  }
}
コード例 #7
0
/*
 * Function    : _libaroma_ctl_fragment_window_updatebg
 * Return Value: byte
 * Descriptions: window update background
 */
byte _libaroma_ctl_fragment_window_updatebg(LIBAROMA_WINDOWP win){
  _VALIDATE_FRAGMENT(0);
  libaroma_mutex_lock(me->dmutex);
  int w = win->w;
  int h = win->h;
  if (win->bg!=NULL){
    if ((win->bg->w==w)&&(win->bg->h==h)){
      libaroma_mutex_unlock(me->dmutex);
      return 1;
    }
    libaroma_canvas_free(win->bg);
  }
  win->bg = libaroma_canvas(w,h);
  libaroma_canvas_setcolor(
    win->bg,
    libaroma_colorget(ctl,NULL)->window_bg,
    0xff
  );
  libaroma_mutex_unlock(me->dmutex);
  return 1;
} /* End of _libaroma_ctl_fragment_window_sync */
コード例 #8
0
ファイル: window.c プロジェクト: sub77-bkp/libaroma
/*
 * Function    : libaroma_window_anishow
 * Return Value: byte
 * Descriptions: show window - animated
 */
byte libaroma_window_anishow(
    LIBAROMA_WINDOWP win,
    byte animation,
    int duration){
  __CHECK_WM(0);
  if (!win){
    return 0;
  }
  if (win->parent!=NULL){
    ALOGW("Child window cannot shown directly...");
    return 0;
  }
  
  /* set initial focus
    libaroma_window_setfocus(win, NULL);
  */
  
  if ((!animation)||(duration<50)){
    return libaroma_wm_set_active_window(win);
  }
  
  /* lock and retval */
  byte retval = 0;
  win->lock_sync = 1;
  
  if (libaroma_wm_set_active_window(win)){
    win->active=2;
    
    /* draw window into temp canvas */
    LIBAROMA_CANVASP wmc = win->dc;
    LIBAROMA_CANVASP tdc = libaroma_canvas(wmc->w,wmc->h);
    libaroma_draw(tdc,wmc,0,0,0);
    win->dc=tdc; /* switch dc */
    
    LIBAROMA_CANVASP back = libaroma_canvas(wmc->w, wmc->h);
    libaroma_draw(back,wmc,0,0,0);
    
    /* invalidate now */
    libaroma_window_invalidate(win, 10);
    
    long start = libaroma_tick();
    int delta = 0;
    while ((delta=libaroma_tick()-start)<duration){
      float state = ((float) delta)/((float) duration);
      if (state>=1.0){
        break;
      }
      switch (animation){
        case LIBAROMA_WINDOW_SHOW_ANIMATION_SLIDE_LEFT:
        case LIBAROMA_WINDOW_SHOW_ANIMATION_PAGE_LEFT:
          {
            float swift_out_state = libaroma_cubic_bezier_swiftout(state);
            int x = win->w - (swift_out_state * win->w);
            int w = win->w - x;
            if (w>0){
              if (animation==LIBAROMA_WINDOW_SHOW_ANIMATION_SLIDE_LEFT){
                if (w<win->w){
                  libaroma_draw_ex(
                    wmc,
                    back,
                    0, 0, win->w - (win->w - w), 0, win->w - w, win->h,
                    0, 0xff
                  );
                }
              }
              libaroma_draw_ex(
                wmc,
                win->dc,
                x, 0, 0, 0, w, win->h,
                0, 0xff
              );
              if (animation==LIBAROMA_WINDOW_SHOW_ANIMATION_SLIDE_LEFT){
                libaroma_wm_sync(win->x,win->y,win->w,win->h);
              }
              else{
                libaroma_wm_sync(win->x+x,win->y,w, win->h);
              }
            }
          }
          break;
        case LIBAROMA_WINDOW_SHOW_ANIMATION_SLIDE_RIGHT:
        case LIBAROMA_WINDOW_SHOW_ANIMATION_PAGE_RIGHT:
          {
            float swift_out_state = libaroma_cubic_bezier_swiftout(state);
            int x = 0 - (win->w - (swift_out_state * win->w));
            int w = win->w + x;
            if (w>0){
              if (animation==LIBAROMA_WINDOW_SHOW_ANIMATION_SLIDE_RIGHT){
                if (w<win->w){
                  libaroma_draw_ex(
                    wmc,
                    back,
                    w, 0, 0, 0, win->w - w, win->h,
                    0, 0xff
                  );
                }
              }
              libaroma_draw_ex(
                wmc,
                win->dc,
                0, 0, win->w-w, 0, w, win->h,
                0, 0xff
              );
              if (animation==LIBAROMA_WINDOW_SHOW_ANIMATION_SLIDE_RIGHT){
                libaroma_wm_sync(win->x,win->y,win->w,win->h);
              }
              else{
                libaroma_wm_sync(win->x,win->y,w, win->h);
              }
            }
          }
          break;
        default:
          /* invalid animation */
          start=0;
          break;
      }
    }
    
    retval = 1;
    libaroma_draw(wmc,win->dc,0,0,0);
              
    win->dc=wmc; /* switch dc back */
  
    /* cleanup */
    libaroma_canvas_free(back);
    libaroma_canvas_free(tdc);
  }
  
  win->lock_sync = 0;
  
  /* sync view now */
  if (retval){
    win->active=1;
    libaroma_window_sync(win, 0, 0, win->w, win->h);
  }
  
  /* send activate */
  LIBAROMA_MSG _msg;
  libaroma_window_process_event(win,libaroma_wm_compose(
    &_msg, LIBAROMA_MSG_WIN_ACTIVE, NULL, 10, 0)
  );
  
  return retval;
} /* End of libaroma_window_show */
コード例 #9
0
ファイル: ctl_list.c プロジェクト: sub77-bkp/libaroma
/*
 * Function    : _libaroma_ctl_list_draw
 * Return Value: void
 * Descriptions: draw routine
 */
void _libaroma_ctl_list_draw(
    LIBAROMA_CONTROLP ctl,
    LIBAROMA_CTL_SCROLL_CLIENTP client,
    LIBAROMA_CANVASP cv,
    int x, int y, int w, int h){
  if (client->handler!=&_libaroma_ctl_list_handler){
    return;
  }
  LIBAROMA_CTL_SCROLLP mi = (LIBAROMA_CTL_SCROLLP) client->internal;
  if (y<mi->vpad){
    libaroma_draw_rect(
      cv, 0, 0, w, mi->vpad-y,
      libaroma_ctl_scroll_get_bg_color(ctl),
      0xff
    );
  }
  if (y+h>mi->h-mi->vpad){
    int dh=(y+h)-(mi->h-mi->vpad);
    libaroma_draw_rect(
      cv, 0, h-dh, w, dh,
      libaroma_ctl_scroll_get_bg_color(ctl),
      0xff
    );
  }
  
  libaroma_mutex_lock(mi->imutex);
  /* find first item */
  int current_index = 0;
  LIBAROMA_CTL_LIST_ITEMP f = mi->first;
  while(f){
    if (f->y+f->h>y){
      break;
    }
    f = f->next;
    current_index++;
  }
  
  word bgcolor = libaroma_ctl_scroll_get_bg_color(ctl);
  
  /* draw routine */
  LIBAROMA_CTL_LIST_ITEMP item = f;
  while(item){
    if (item->y>=y+h){
      break;
    }
    LIBAROMA_CANVASP canvas=NULL;
    byte is_area=0;
    if ((item->y>=y)&&(item->y+item->h<y+cv->h)){
      canvas = libaroma_canvas_area(cv,0,item->y-y,w,item->h);
      is_area=1;
    }
    else{
      canvas = libaroma_canvas(w,item->h);
    }
    if (canvas!=NULL){
      _libaroma_ctl_list_draw_item(
        ctl, item, canvas, bgcolor
      );
      
      /* blit into working canvas */
      if (!is_area){
        libaroma_draw(cv,canvas,0,item->y-y,0);
      }
      libaroma_canvas_free(canvas);
    }
    item=item->next;
    current_index++;
  }
  libaroma_mutex_unlock(mi->imutex);
} /* End of _libaroma_ctl_list_draw */