forked from enlightenment/efl
and add a scale factor per object. right now text and textblock use it.
that's about it. a bit hacky - but works and frankly.. the idea is that u'd set a scale factor once really and not change it per obj... most likely. SVN revision: 35896
This commit is contained in:
parent
23e2c9e035
commit
d06c5e9efb
|
@ -721,6 +721,9 @@ extern "C" {
|
|||
EAPI void evas_object_anti_alias_set (Evas_Object *obj, Evas_Bool antialias);
|
||||
EAPI Evas_Bool evas_object_anti_alias_get (const Evas_Object *obj);
|
||||
|
||||
EAPI void evas_object_scale_set (Evas_Object *obj, double scale);
|
||||
EAPI double evas_object_scale_get (const Evas_Object *obj);
|
||||
|
||||
EAPI void evas_object_color_set (Evas_Object *obj, int r, int g, int b, int a);
|
||||
EAPI void evas_object_color_get (const Evas_Object *obj, int *r, int *g, int *b, int *a);
|
||||
|
||||
|
|
|
@ -31,6 +31,8 @@ evas_object_new(void)
|
|||
if (!obj) return NULL;
|
||||
|
||||
obj->magic = MAGIC_OBJ;
|
||||
obj->cur.scale = 1.0;
|
||||
obj->prev.scale = 1.0;
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
@ -1065,7 +1067,7 @@ evas_object_anti_alias_set(Evas_Object *obj, Evas_Bool anti_alias)
|
|||
MAGIC_CHECK_END();
|
||||
if (obj->delete_me) return;
|
||||
if (obj->cur.anti_alias == !!anti_alias)
|
||||
return;
|
||||
return;
|
||||
obj->cur.anti_alias = !!anti_alias;
|
||||
evas_object_change(obj);
|
||||
}
|
||||
|
@ -1087,6 +1089,42 @@ evas_object_anti_alias_get(const Evas_Object *obj)
|
|||
return obj->cur.anti_alias;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the scaling factor for an evas object. Does not affect all objects.
|
||||
* @param obj The given evas object.
|
||||
* @param scale. The scaling factor. 1.0 == none.
|
||||
* @ingroup Evas_Object_Group
|
||||
*/
|
||||
EAPI void
|
||||
evas_object_scale_set(Evas_Object *obj, double scale)
|
||||
{
|
||||
MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
|
||||
return;
|
||||
MAGIC_CHECK_END();
|
||||
if (obj->delete_me) return;
|
||||
if (obj->cur.scale == scale)
|
||||
return;
|
||||
obj->cur.scale = scale;
|
||||
evas_object_change(obj);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Retrieves the scaling factor for the given evas object.
|
||||
* @param obj The given evas object.
|
||||
* @return The scaling factor.
|
||||
* @ingroup Evas_Object_Group
|
||||
*/
|
||||
EAPI double
|
||||
evas_object_scale_get(const Evas_Object *obj)
|
||||
{
|
||||
MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
|
||||
return 0;
|
||||
MAGIC_CHECK_END();
|
||||
if (obj->delete_me) return 1.0;
|
||||
return obj->cur.scale;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the color_space to be used for linear interpolation of colors.
|
||||
* @param obj The given evas object.
|
||||
|
|
|
@ -191,7 +191,7 @@ evas_object_text_font_set(Evas_Object *obj, const char *font, Evas_Font_Size siz
|
|||
evas_font_free(obj->layer->evas, o->engine_data);
|
||||
o->engine_data = NULL;
|
||||
}
|
||||
o->engine_data = evas_font_load(obj->layer->evas, font, o->cur.source, size);
|
||||
o->engine_data = evas_font_load(obj->layer->evas, font, o->cur.source, size * obj->cur.scale);
|
||||
if (!same_font)
|
||||
{
|
||||
if (o->cur.font) evas_stringshare_del(o->cur.font);
|
||||
|
@ -1612,6 +1612,11 @@ evas_object_text_render_pre(Evas_Object *obj)
|
|||
evas_object_render_pre_prev_cur_add(&rects, obj);
|
||||
goto done;
|
||||
}
|
||||
if (obj->cur.scale != obj->prev.scale)
|
||||
{
|
||||
evas_object_render_pre_prev_cur_add(&rects, obj);
|
||||
goto done;
|
||||
}
|
||||
if (o->changed)
|
||||
{
|
||||
if ((o->cur.size != o->prev.size) ||
|
||||
|
|
|
@ -1170,7 +1170,7 @@ _format_command(Evas_Object *obj, Evas_Object_Textblock_Format *fmt, const char
|
|||
buf = strdup(fmt->font.name);
|
||||
fmt->font.font = evas_font_load(obj->layer->evas,
|
||||
buf, fmt->font.source,
|
||||
fmt->font.size);
|
||||
fmt->font.size * obj->cur.scale);
|
||||
if (buf) free(buf);
|
||||
if (of) evas_font_free(obj->layer->evas, of);
|
||||
}
|
||||
|
@ -1291,7 +1291,7 @@ _format_dup(Evas_Object *obj, Evas_Object_Textblock_Format *fmt)
|
|||
buf = strdup(fmt2->font.name);
|
||||
fmt2->font.font = evas_font_load(obj->layer->evas,
|
||||
buf, fmt2->font.source,
|
||||
fmt2->font.size);
|
||||
fmt2->font.size * obj->cur.scale);
|
||||
if (buf) free(buf);
|
||||
return fmt2;
|
||||
}
|
||||
|
|
|
@ -372,6 +372,7 @@ struct _Evas_Object
|
|||
Evas_Bool dirty : 1;
|
||||
} clip;
|
||||
} cache;
|
||||
double scale;
|
||||
Evas_Coord_Rectangle geometry;
|
||||
struct {
|
||||
unsigned char r, g, b, a;
|
||||
|
|
Loading…
Reference in New Issue