Evas GL generic: Simplify "scaled" images (used for masking)
Invert the meaning of scaled (w,h), so that im->(w,h) corresponds to the final scaled size, and the original size is stored directly in the texture itself. This simplifies code a little bit. Also, lift the limitation on the maximum texture size, as those virtual textures are not limited by GPU texture size.
This commit is contained in:
parent
32009a0e8c
commit
740995e089
|
@ -619,7 +619,6 @@ struct _Evas_GL_Image
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
Evas_GL_Image *origin;
|
Evas_GL_Image *origin;
|
||||||
int w, h;
|
|
||||||
Eina_Bool smooth : 1;
|
Eina_Bool smooth : 1;
|
||||||
} scaled;
|
} scaled;
|
||||||
|
|
||||||
|
|
|
@ -85,19 +85,11 @@ evas_gl_font_texture_draw(void *context, void *surface EINA_UNUSED, void *draw_c
|
||||||
if (mtex && mtex->pt && mtex->pt->w && mtex->pt->h)
|
if (mtex && mtex->pt && mtex->pt->w && mtex->pt->h)
|
||||||
{
|
{
|
||||||
// canvas coords
|
// canvas coords
|
||||||
mx = dc->clip.mask_x;
|
mx = gc->dc->clip.mask_x;
|
||||||
my = dc->clip.mask_y;
|
my = gc->dc->clip.mask_y;
|
||||||
if (mask->scaled.origin)
|
mw = mask->w;
|
||||||
{
|
mh = mask->h;
|
||||||
mw = mask->scaled.w;
|
mask_smooth = mask->scaled.smooth;
|
||||||
mh = mask->scaled.h;
|
|
||||||
mask_smooth = mask->scaled.smooth;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mw = mask->w;
|
|
||||||
mh = mask->h;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else mtex = NULL;
|
else mtex = NULL;
|
||||||
|
|
||||||
|
|
|
@ -960,24 +960,11 @@ evas_gl_common_image_map_draw(Evas_Engine_GL_Context *gc, Evas_GL_Image *im,
|
||||||
if (mtex && mtex->pt && mtex->pt->w && mtex->pt->h)
|
if (mtex && mtex->pt && mtex->pt->w && mtex->pt->h)
|
||||||
{
|
{
|
||||||
// canvas coords
|
// canvas coords
|
||||||
mx = dc->clip.mask_x;
|
mx = gc->dc->clip.mask_x;
|
||||||
my = dc->clip.mask_y;
|
my = gc->dc->clip.mask_y;
|
||||||
if (mask->scaled.origin)
|
mw = mask->w;
|
||||||
{
|
mh = mask->h;
|
||||||
mw = mask->scaled.w;
|
mask_smooth = mask->scaled.smooth;
|
||||||
mh = mask->scaled.h;
|
|
||||||
//scalex = mask->w / (double)mask->scaled.w;
|
|
||||||
//scaley = mask->h / (double)mask->scaled.h;
|
|
||||||
mask_smooth = mask->scaled.smooth;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mw = mask->w;
|
|
||||||
mh = mask->h;
|
|
||||||
}
|
|
||||||
//if (c) RECTS_CLIP_TO_RECT(mx, my, mw, mh, cx, cy, cw, ch);
|
|
||||||
//mx = mx - dc->clip.mask_x;
|
|
||||||
//my = my - dc->clip.mask_y;
|
|
||||||
}
|
}
|
||||||
else mtex = NULL;
|
else mtex = NULL;
|
||||||
|
|
||||||
|
@ -1016,17 +1003,9 @@ _evas_gl_common_image_push(Evas_Engine_GL_Context *gc, Evas_GL_Image *im,
|
||||||
// canvas coords
|
// canvas coords
|
||||||
mx = gc->dc->clip.mask_x;
|
mx = gc->dc->clip.mask_x;
|
||||||
my = gc->dc->clip.mask_y;
|
my = gc->dc->clip.mask_y;
|
||||||
if (mask->scaled.origin)
|
mw = mask->w;
|
||||||
{
|
mh = mask->h;
|
||||||
mw = mask->scaled.w;
|
mask_smooth = mask->scaled.smooth;
|
||||||
mh = mask->scaled.h;
|
|
||||||
mask_smooth = mask->scaled.smooth;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mw = mask->w;
|
|
||||||
mh = mask->h;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else mtex = NULL;
|
else mtex = NULL;
|
||||||
|
|
||||||
|
|
|
@ -35,17 +35,9 @@ evas_gl_common_rect_draw(Evas_Engine_GL_Context *gc, int x, int y, int w, int h)
|
||||||
// canvas coords
|
// canvas coords
|
||||||
mx = gc->dc->clip.mask_x;
|
mx = gc->dc->clip.mask_x;
|
||||||
my = gc->dc->clip.mask_y;
|
my = gc->dc->clip.mask_y;
|
||||||
if (mask->scaled.origin)
|
mw = mask->w;
|
||||||
{
|
mh = mask->h;
|
||||||
mw = mask->scaled.w;
|
mask_smooth = mask->scaled.smooth;
|
||||||
mh = mask->scaled.h;
|
|
||||||
mask_smooth = mask->scaled.smooth;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mw = mask->w;
|
|
||||||
mh = mask->h;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else mtex = NULL;
|
else mtex = NULL;
|
||||||
|
|
||||||
|
|
|
@ -989,12 +989,8 @@ eng_image_scaled_update(void *data EINA_UNUSED, void *scaled, void *image,
|
||||||
if (!src) return NULL;
|
if (!src) return NULL;
|
||||||
|
|
||||||
gc = src->gc;
|
gc = src->gc;
|
||||||
if ((dst_w > gc->shared->info.max_texture_size) ||
|
|
||||||
(dst_h > gc->shared->info.max_texture_size))
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
if (dst && (dst->scaled.origin == src) &&
|
if (dst && (dst->scaled.origin == src) &&
|
||||||
(dst->scaled.w == dst_w) && (dst->scaled.h == dst_h))
|
(dst->w == dst_w) && (dst->h == dst_h))
|
||||||
return dst;
|
return dst;
|
||||||
|
|
||||||
if (dst)
|
if (dst)
|
||||||
|
@ -1020,16 +1016,14 @@ eng_image_scaled_update(void *data EINA_UNUSED, void *scaled, void *image,
|
||||||
dst->gc = gc;
|
dst->gc = gc;
|
||||||
dst->cs.space = src->cs.space;
|
dst->cs.space = src->cs.space;
|
||||||
dst->alpha = alpha;
|
dst->alpha = alpha;
|
||||||
dst->w = src->w;
|
dst->w = dst_w;
|
||||||
dst->h = src->h;
|
dst->h = dst_h;
|
||||||
dst->tex = src->tex;
|
dst->tex = src->tex;
|
||||||
dst->tex->references++;
|
dst->tex->references++;
|
||||||
dst->tex_only = 1;
|
dst->tex_only = 1;
|
||||||
|
|
||||||
if (!reffed) src->references++;
|
if (!reffed) src->references++;
|
||||||
dst->scaled.origin = src;
|
dst->scaled.origin = src;
|
||||||
dst->scaled.w = dst_w;
|
|
||||||
dst->scaled.h = dst_h;
|
|
||||||
dst->scaled.smooth = smooth;
|
dst->scaled.smooth = smooth;
|
||||||
|
|
||||||
return dst;
|
return dst;
|
||||||
|
|
Loading…
Reference in New Issue