and add a scale factor per object. right now text and textblock use it.
authorraster <raster@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Tue, 9 Sep 2008 14:14:26 +0000 (14:14 +0000)
committerraster <raster@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Tue, 9 Sep 2008 14:14:26 +0000 (14:14 +0000)
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.

git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/evas@35896 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/lib/Evas.h
src/lib/canvas/evas_object_main.c
src/lib/canvas/evas_object_text.c
src/lib/canvas/evas_object_textblock.c
src/lib/include/evas_private.h

index 4d31273..32334ed 100644 (file)
@@ -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);
 
index a585ce6..f2a1029 100644 (file)
@@ -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);
 }
@@ -1088,6 +1090,42 @@ evas_object_anti_alias_get(const Evas_Object *obj)
 }
 
 /**
+ * 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.
  * @param   color_space, one of EVAS_COLOR_SPACE_ARGB or EVAS_COLOR_SPACE_AHSV.
index d8db3b2..32912e3 100644 (file)
@@ -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) ||
index 8bccfc7..a044056 100644 (file)
@@ -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;
 }
index 2f6a790..f60316d 100644 (file)
@@ -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;