~cairo-dock-team/cairo-dock-core/popup_from_shortkey

« back to all changes in this revision

Viewing changes to src/gldit/cairo-dock-icon-facility.c

  • Committer: Fabrice Rey
  • Date: 2012-12-17 23:26:50 UTC
  • Revision ID: fabounet03@gmail.com-20121217232650-rpf76vs3atpq8mxc
Icons: changed the sizing algorithm, added allocated and requested size

Show diffs side-by-side

added added

removed removed

Lines of Context:
358
358
 
359
359
void cairo_dock_get_icon_extent (Icon *pIcon, int *iWidth, int *iHeight)
360
360
{
361
 
        *iWidth = pIcon->iImageWidth;
362
 
        *iHeight = pIcon->iImageHeight;
 
361
        *iWidth = pIcon->image.iWidth;
 
362
        *iHeight = pIcon->image.iHeight;
363
363
}
364
364
 
365
365
void cairo_dock_get_current_icon_size (Icon *pIcon, CairoContainer *pContainer, double *fSizeX, double *fSizeY)
684
684
        int w = 24, h = w;
685
685
        int iWidth, iHeight;
686
686
        cairo_dock_get_icon_extent (icon, &iWidth, &iHeight);
687
 
        if (iWidth > 0 && iHeight > 0 && icon->pIconBuffer != NULL)
 
687
        if (iWidth > 0 && iHeight > 0 && icon->image.pSurface != NULL)
688
688
        {
689
689
                cairo_surface_t *surface = cairo_image_surface_create (CAIRO_FORMAT_RGB24,
690
690
                        w,
691
691
                        h);
692
692
                cairo_t *pCairoContext = cairo_create (surface);
693
693
                cairo_scale (pCairoContext, (double)w/iWidth, (double)h/iHeight);
694
 
                cairo_set_source_surface (pCairoContext, icon->pIconBuffer, 0., 0.);
 
694
                cairo_set_source_surface (pCairoContext, icon->image.pSurface, 0., 0.);
695
695
                cairo_paint (pCairoContext);
696
696
                cairo_destroy (pCairoContext);
697
697
                guchar *d, *data = cairo_image_surface_get_data (surface);