summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarsten Haitzler <raster@rasterman.com>2013-01-23 10:07:31 +0000
committerCarsten Haitzler <raster@rasterman.com>2013-01-23 10:07:31 +0000
commit07c3ce0bbe771e84cf21b6d89f9c6773053951a3 (patch)
tree49450366fd41828ba72bcaba17d436da033d1f2c
parentf57257b3ecb2eebd57b83827cf74cbb8e4b4d0d6 (diff)
ummm this really fubars stuff up cedric.. revert. put it back when u
have figured things out. :) SVN revision: 83143
-rw-r--r--src/lib/evas/canvas/evas_main.c1
-rw-r--r--src/lib/evas/canvas/evas_object_image.c195
-rw-r--r--src/lib/evas/include/evas_private.h2
3 files changed, 73 insertions, 125 deletions
diff --git a/src/lib/evas/canvas/evas_main.c b/src/lib/evas/canvas/evas_main.c
index 31e7ad2f3d..ec38b80936 100644
--- a/src/lib/evas/canvas/evas_main.c
+++ b/src/lib/evas/canvas/evas_main.c
@@ -88,7 +88,6 @@ evas_shutdown(void)
88 88
89 eina_cow_del(evas_object_proxy_cow); 89 eina_cow_del(evas_object_proxy_cow);
90 eina_cow_del(evas_object_map_cow); 90 eina_cow_del(evas_object_map_cow);
91 eina_cow_del(evas_object_image_load_opts_cow);
92 evas_object_proxy_cow = NULL; 91 evas_object_proxy_cow = NULL;
93 92
94 evas_thread_shutdown(); 93 evas_thread_shutdown();
diff --git a/src/lib/evas/canvas/evas_object_image.c b/src/lib/evas/canvas/evas_object_image.c
index 7883f54f6f..529a718a50 100644
--- a/src/lib/evas/canvas/evas_object_image.c
+++ b/src/lib/evas/canvas/evas_object_image.c
@@ -32,24 +32,6 @@ static const char o_type[] = "image";
32 32
33/* private struct for rectangle object internal data */ 33/* private struct for rectangle object internal data */
34typedef struct _Evas_Object_Image Evas_Object_Image; 34typedef struct _Evas_Object_Image Evas_Object_Image;
35typedef struct _Evas_Object_Image_Load_Opts Evas_Object_Image_Load_Opts;
36
37struct _Evas_Object_Image_Load_Opts
38{
39 unsigned char scale_down_by;
40 double dpi;
41 short w, h;
42 struct {
43 short x, y, w, h;
44 } region;
45 struct {
46 int src_x, src_y, src_w, src_h;
47 int dst_w, dst_h;
48 int smooth;
49 int scale_hint;
50 } scale_load;
51 Eina_Bool orientation : 1;
52};
53 35
54struct _Evas_Object_Image 36struct _Evas_Object_Image
55{ 37{
@@ -80,8 +62,21 @@ struct _Evas_Object_Image
80 int load_error; 62 int load_error;
81 Eina_List *pixel_updates; 63 Eina_List *pixel_updates;
82 64
83 // This pointer is an Eina_Cow pointer 65 struct {
84 const Evas_Object_Image_Load_Opts *load_opts; 66 unsigned char scale_down_by;
67 double dpi;
68 short w, h;
69 struct {
70 short x, y, w, h;
71 } region;
72 struct {
73 int src_x, src_y, src_w, src_h;
74 int dst_w, dst_h;
75 int smooth;
76 int scale_hint;
77 } scale_load;
78 Eina_Bool orientation : 1;
79 } load_opts;
85 80
86 struct { 81 struct {
87 Evas_Object_Image_Pixels_Get_Cb get_pixels; 82 Evas_Object_Image_Pixels_Get_Cb get_pixels;
@@ -167,12 +162,6 @@ static const Evas_Object_Func object_func =
167 evas_object_image_can_map 162 evas_object_image_can_map
168}; 163};
169 164
170static const Evas_Object_Image_Load_Opts default_load_opts = {
171 0, 0, 0, 0, { 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0 }, 0
172};
173
174Eina_Cow *evas_object_image_load_opts_cow = NULL;
175
176static void 165static void
177_evas_object_image_cleanup(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj, Evas_Object_Image *o) 166_evas_object_image_cleanup(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj, Evas_Object_Image *o)
178{ 167{
@@ -198,21 +187,7 @@ _constructor(Eo *eo_obj, void *class_data, va_list *list EINA_UNUSED)
198 eo_do_super(eo_obj, eo_constructor()); 187 eo_do_super(eo_obj, eo_constructor());
199 evas_object_image_init(eo_obj); 188 evas_object_image_init(eo_obj);
200 evas_object_inject(eo_obj, obj, eo_e); 189 evas_object_inject(eo_obj, obj, eo_e);
201 190 o->cur.cspace = obj->layer->evas->engine.func->image_colorspace_get(obj->layer->evas->engine.data.output, o->engine_data);
202 if (!evas_object_image_load_opts_cow)
203 evas_object_image_load_opts_cow = eina_cow_add("Evas_Object_Image load opts",
204 sizeof (Evas_Object_Image_Load_Opts),
205 8,
206 &default_load_opts);
207 if (!evas_object_image_load_opts_cow)
208 {
209 eo_error_set(eo_obj);
210 return;
211 }
212
213 o->load_opts = eina_cow_alloc(evas_object_image_load_opts_cow);
214 o->cur.cspace = obj->layer->evas->engine.func->image_colorspace_get(obj->layer->evas->engine.data.output,
215 o->engine_data);
216} 191}
217 192
218EAPI Evas_Object * 193EAPI Evas_Object *
@@ -419,23 +394,23 @@ _image_file_set(Eo *eo_obj, void *_pd, va_list *list)
419 obj->layer->evas->engine.func->image_free(obj->layer->evas->engine.data.output, o->engine_data); 394 obj->layer->evas->engine.func->image_free(obj->layer->evas->engine.data.output, o->engine_data);
420 } 395 }
421 o->load_error = EVAS_LOAD_ERROR_NONE; 396 o->load_error = EVAS_LOAD_ERROR_NONE;
422 lo.scale_down_by = o->load_opts->scale_down_by; 397 lo.scale_down_by = o->load_opts.scale_down_by;
423 lo.dpi = o->load_opts->dpi; 398 lo.dpi = o->load_opts.dpi;
424 lo.w = o->load_opts->w; 399 lo.w = o->load_opts.w;
425 lo.h = o->load_opts->h; 400 lo.h = o->load_opts.h;
426 lo.region.x = o->load_opts->region.x; 401 lo.region.x = o->load_opts.region.x;
427 lo.region.y = o->load_opts->region.y; 402 lo.region.y = o->load_opts.region.y;
428 lo.region.w = o->load_opts->region.w; 403 lo.region.w = o->load_opts.region.w;
429 lo.region.h = o->load_opts->region.h; 404 lo.region.h = o->load_opts.region.h;
430 lo.scale_load.src_x = o->load_opts->scale_load.src_x; 405 lo.scale_load.src_x = o->load_opts.scale_load.src_x;
431 lo.scale_load.src_y = o->load_opts->scale_load.src_y; 406 lo.scale_load.src_y = o->load_opts.scale_load.src_y;
432 lo.scale_load.src_w = o->load_opts->scale_load.src_w; 407 lo.scale_load.src_w = o->load_opts.scale_load.src_w;
433 lo.scale_load.src_h = o->load_opts->scale_load.src_h; 408 lo.scale_load.src_h = o->load_opts.scale_load.src_h;
434 lo.scale_load.dst_w = o->load_opts->scale_load.dst_w; 409 lo.scale_load.dst_w = o->load_opts.scale_load.dst_w;
435 lo.scale_load.dst_h = o->load_opts->scale_load.dst_h; 410 lo.scale_load.dst_h = o->load_opts.scale_load.dst_h;
436 lo.scale_load.smooth = o->load_opts->scale_load.smooth; 411 lo.scale_load.smooth = o->load_opts.scale_load.smooth;
437 lo.scale_load.scale_hint = o->load_opts->scale_load.scale_hint; 412 lo.scale_load.scale_hint = o->load_opts.scale_load.scale_hint;
438 lo.orientation = o->load_opts->orientation; 413 lo.orientation = o->load_opts.orientation;
439 o->engine_data = obj->layer->evas->engine.func->image_load(obj->layer->evas->engine.data.output, 414 o->engine_data = obj->layer->evas->engine.func->image_load(obj->layer->evas->engine.data.output,
440 o->cur.file, 415 o->cur.file,
441 o->cur.key, 416 o->cur.key,
@@ -1892,12 +1867,8 @@ _image_load_dpi_set(Eo *eo_obj, void *_pd, va_list *list)
1892 1867
1893 Evas_Object_Image *o = _pd; 1868 Evas_Object_Image *o = _pd;
1894 1869
1895 if (dpi == o->load_opts->dpi) return; 1870 if (dpi == o->load_opts.dpi) return;
1896 1871 o->load_opts.dpi = dpi;
1897 EINA_COW_WRITE_BEGIN(evas_object_image_load_opts_cow, o->load_opts, Evas_Object_Image_Load_Opts, low)
1898 low->dpi = dpi;
1899 EINA_COW_WRITE_END(evas_object_image_load_opts_cow, o->load_opts, low);
1900
1901 if (o->cur.file) 1872 if (o->cur.file)
1902 { 1873 {
1903 Evas_Object_Protected_Data *obj = eo_data_get(eo_obj, EVAS_OBJ_CLASS); 1874 Evas_Object_Protected_Data *obj = eo_data_get(eo_obj, EVAS_OBJ_CLASS);
@@ -1925,7 +1896,7 @@ _image_load_dpi_get(Eo *eo_obj EINA_UNUSED, void *_pd, va_list *list)
1925{ 1896{
1926 const Evas_Object_Image *o = _pd; 1897 const Evas_Object_Image *o = _pd;
1927 double *dpi = va_arg(*list, double *); 1898 double *dpi = va_arg(*list, double *);
1928 *dpi = o->load_opts->dpi; 1899 *dpi = o->load_opts.dpi;
1929} 1900}
1930 1901
1931EAPI void 1902EAPI void
@@ -1945,15 +1916,9 @@ _image_load_size_set(Eo *eo_obj, void *_pd, va_list *list)
1945 1916
1946 Evas_Object_Image *o = _pd; 1917 Evas_Object_Image *o = _pd;
1947 1918
1948 if ((o->load_opts->w == w) && (o->load_opts->h == h)) return; 1919 if ((o->load_opts.w == w) && (o->load_opts.h == h)) return;
1949 1920 o->load_opts.w = w;
1950 EINA_COW_WRITE_BEGIN(evas_object_image_load_opts_cow, o->load_opts, Evas_Object_Image_Load_Opts, low) 1921 o->load_opts.h = h;
1951 {
1952 low->w = w;
1953 low->h = h;
1954 }
1955 EINA_COW_WRITE_END(evas_object_image_load_opts_cow, o->load_opts, low);
1956
1957 if (o->cur.file) 1922 if (o->cur.file)
1958 { 1923 {
1959 Evas_Object_Protected_Data *obj = eo_data_get(eo_obj, EVAS_OBJ_CLASS); 1924 Evas_Object_Protected_Data *obj = eo_data_get(eo_obj, EVAS_OBJ_CLASS);
@@ -1981,8 +1946,8 @@ _image_load_size_get(Eo *eo_obj EINA_UNUSED, void *_pd, va_list *list)
1981 int *h = va_arg(*list, int *); 1946 int *h = va_arg(*list, int *);
1982 const Evas_Object_Image *o = _pd; 1947 const Evas_Object_Image *o = _pd;
1983 1948
1984 if (w) *w = o->load_opts->w; 1949 if (w) *w = o->load_opts.w;
1985 if (h) *h = o->load_opts->h; 1950 if (h) *h = o->load_opts.h;
1986} 1951}
1987 1952
1988EAPI void 1953EAPI void
@@ -2001,11 +1966,8 @@ _image_load_scale_down_set(Eo *eo_obj, void *_pd, va_list *list)
2001 1966
2002 Evas_Object_Image *o = _pd; 1967 Evas_Object_Image *o = _pd;
2003 1968
2004 if (o->load_opts->scale_down_by == scale_down) return; 1969 if (o->load_opts.scale_down_by == scale_down) return;
2005 EINA_COW_WRITE_BEGIN(evas_object_image_load_opts_cow, o->load_opts, Evas_Object_Image_Load_Opts, low) 1970 o->load_opts.scale_down_by = scale_down;
2006 low->scale_down_by = scale_down;
2007 EINA_COW_WRITE_END(evas_object_image_load_opts_cow, o->load_opts, low);
2008
2009 if (o->cur.file) 1971 if (o->cur.file)
2010 { 1972 {
2011 Evas_Object_Protected_Data *obj = eo_data_get(eo_obj, EVAS_OBJ_CLASS); 1973 Evas_Object_Protected_Data *obj = eo_data_get(eo_obj, EVAS_OBJ_CLASS);
@@ -2033,7 +1995,7 @@ _image_load_scale_down_get(Eo *eo_obj EINA_UNUSED, void *_pd, va_list *list)
2033{ 1995{
2034 int *scale_down = va_arg(*list, int *); 1996 int *scale_down = va_arg(*list, int *);
2035 const Evas_Object_Image *o = _pd; 1997 const Evas_Object_Image *o = _pd;
2036 *scale_down = o->load_opts->scale_down_by; 1998 *scale_down = o->load_opts.scale_down_by;
2037} 1999}
2038 2000
2039EAPI void 2001EAPI void
@@ -2055,18 +2017,12 @@ _image_load_region_set(Eo *eo_obj, void *_pd, va_list *list)
2055 2017
2056 Evas_Object_Image *o = _pd; 2018 Evas_Object_Image *o = _pd;
2057 2019
2058 if ((o->load_opts->region.x == x) && (o->load_opts->region.y == y) && 2020 if ((o->load_opts.region.x == x) && (o->load_opts.region.y == y) &&
2059 (o->load_opts->region.w == w) && (o->load_opts->region.h == h)) return; 2021 (o->load_opts.region.w == w) && (o->load_opts.region.h == h)) return;
2060 2022 o->load_opts.region.x = x;
2061 EINA_COW_WRITE_BEGIN(evas_object_image_load_opts_cow, o->load_opts, Evas_Object_Image_Load_Opts, low) 2023 o->load_opts.region.y = y;
2062 { 2024 o->load_opts.region.w = w;
2063 low->region.x = x; 2025 o->load_opts.region.h = h;
2064 low->region.y = y;
2065 low->region.w = w;
2066 low->region.h = h;
2067 }
2068 EINA_COW_WRITE_END(evas_object_image_load_opts_cow, o->load_opts, low);
2069
2070 if (o->cur.file) 2026 if (o->cur.file)
2071 { 2027 {
2072 Evas_Object_Protected_Data *obj = eo_data_get(eo_obj, EVAS_OBJ_CLASS); 2028 Evas_Object_Protected_Data *obj = eo_data_get(eo_obj, EVAS_OBJ_CLASS);
@@ -2096,10 +2052,10 @@ _image_load_region_get(Eo *eo_obj EINA_UNUSED, void *_pd, va_list *list)
2096 int *h = va_arg(*list, int *); 2052 int *h = va_arg(*list, int *);
2097 const Evas_Object_Image *o = _pd; 2053 const Evas_Object_Image *o = _pd;
2098 2054
2099 if (x) *x = o->load_opts->region.x; 2055 if (x) *x = o->load_opts.region.x;
2100 if (y) *y = o->load_opts->region.y; 2056 if (y) *y = o->load_opts.region.y;
2101 if (w) *w = o->load_opts->region.w; 2057 if (w) *w = o->load_opts.region.w;
2102 if (h) *h = o->load_opts->region.h; 2058 if (h) *h = o->load_opts.region.h;
2103} 2059}
2104 2060
2105EAPI void 2061EAPI void
@@ -2116,12 +2072,7 @@ _image_load_orientation_set(Eo *eo_obj EINA_UNUSED, void *_pd, va_list *list)
2116{ 2072{
2117 Eina_Bool enable = va_arg(*list, int); 2073 Eina_Bool enable = va_arg(*list, int);
2118 Evas_Object_Image *o = _pd; 2074 Evas_Object_Image *o = _pd;
2119 2075 o->load_opts.orientation = !!enable;
2120 if (o->load_opts->orientation == !!enable) return ;
2121
2122 EINA_COW_WRITE_BEGIN(evas_object_image_load_opts_cow, o->load_opts, Evas_Object_Image_Load_Opts, low)
2123 low->orientation = !!enable;
2124 EINA_COW_WRITE_END(evas_object_image_load_opts_cow, o->load_opts, low);
2125} 2076}
2126 2077
2127EAPI Eina_Bool 2078EAPI Eina_Bool
@@ -2140,7 +2091,7 @@ _image_load_orientation_get(Eo *eo_obj EINA_UNUSED, void *_pd, va_list *list)
2140{ 2091{
2141 Eina_Bool *enable = va_arg(*list, Eina_Bool *); 2092 Eina_Bool *enable = va_arg(*list, Eina_Bool *);
2142 const Evas_Object_Image *o = _pd; 2093 const Evas_Object_Image *o = _pd;
2143 *enable = o->load_opts->orientation; 2094 *enable = o->load_opts.orientation;
2144} 2095}
2145 2096
2146EAPI void 2097EAPI void
@@ -3039,23 +2990,23 @@ evas_object_image_load(Evas_Object *eo_obj)
3039 if (o->engine_data) return; 2990 if (o->engine_data) return;
3040 2991
3041 Evas_Object_Protected_Data *obj = eo_data_get(eo_obj, EVAS_OBJ_CLASS); 2992 Evas_Object_Protected_Data *obj = eo_data_get(eo_obj, EVAS_OBJ_CLASS);
3042 lo.scale_down_by = o->load_opts->scale_down_by; 2993 lo.scale_down_by = o->load_opts.scale_down_by;
3043 lo.dpi = o->load_opts->dpi; 2994 lo.dpi = o->load_opts.dpi;
3044 lo.w = o->load_opts->w; 2995 lo.w = o->load_opts.w;
3045 lo.h = o->load_opts->h; 2996 lo.h = o->load_opts.h;
3046 lo.region.x = o->load_opts->region.x; 2997 lo.region.x = o->load_opts.region.x;
3047 lo.region.y = o->load_opts->region.y; 2998 lo.region.y = o->load_opts.region.y;
3048 lo.region.w = o->load_opts->region.w; 2999 lo.region.w = o->load_opts.region.w;
3049 lo.region.h = o->load_opts->region.h; 3000 lo.region.h = o->load_opts.region.h;
3050 lo.scale_load.src_x = o->load_opts->scale_load.src_x; 3001 lo.scale_load.src_x = o->load_opts.scale_load.src_x;
3051 lo.scale_load.src_y = o->load_opts->scale_load.src_y; 3002 lo.scale_load.src_y = o->load_opts.scale_load.src_y;
3052 lo.scale_load.src_w = o->load_opts->scale_load.src_w; 3003 lo.scale_load.src_w = o->load_opts.scale_load.src_w;
3053 lo.scale_load.src_h = o->load_opts->scale_load.src_h; 3004 lo.scale_load.src_h = o->load_opts.scale_load.src_h;
3054 lo.scale_load.dst_w = o->load_opts->scale_load.dst_w; 3005 lo.scale_load.dst_w = o->load_opts.scale_load.dst_w;
3055 lo.scale_load.dst_h = o->load_opts->scale_load.dst_h; 3006 lo.scale_load.dst_h = o->load_opts.scale_load.dst_h;
3056 lo.scale_load.smooth = o->load_opts->scale_load.smooth; 3007 lo.scale_load.smooth = o->load_opts.scale_load.smooth;
3057 lo.scale_load.scale_hint = o->load_opts->scale_load.scale_hint; 3008 lo.scale_load.scale_hint = o->load_opts.scale_load.scale_hint;
3058 lo.orientation = o->load_opts->orientation; 3009 lo.orientation = o->load_opts.orientation;
3059 o->engine_data = obj->layer->evas->engine.func->image_load 3010 o->engine_data = obj->layer->evas->engine.func->image_load
3060 (obj->layer->evas->engine.data.output, 3011 (obj->layer->evas->engine.data.output,
3061 o->cur.file, 3012 o->cur.file,
diff --git a/src/lib/evas/include/evas_private.h b/src/lib/evas/include/evas_private.h
index 50267fb80c..e563042dde 100644
--- a/src/lib/evas/include/evas_private.h
+++ b/src/lib/evas/include/evas_private.h
@@ -1256,8 +1256,6 @@ void _evas_device_unref(Evas_Device *dev);
1256extern Eina_Cow *evas_object_proxy_cow; 1256extern Eina_Cow *evas_object_proxy_cow;
1257extern Eina_Cow *evas_object_map_cow; 1257extern Eina_Cow *evas_object_map_cow;
1258 1258
1259extern Eina_Cow *evas_object_image_load_opts_cow;
1260
1261/****************************************************************************/ 1259/****************************************************************************/
1262/*****************************************/ 1260/*****************************************/
1263/********************/ 1261/********************/