summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@osg.samsung.com>2017-06-28 17:06:04 -0400
committerMike Blumenkrantz <zmike@osg.samsung.com>2017-07-07 15:21:44 -0400
commit0c66472dd25d3ad6b47e598aba536ca6aded54fd (patch)
tree81fe5a08f7106b62a202c1271c3637cc48668a2c
parent72cc7b0561e76b1c087a9d5b364d6058f0b0d745 (diff)
evas: add rotation support for buffer canvas in RGB modedevs/discomfitor/rotation
@feature
-rw-r--r--src/lib/ecore_evas/ecore_evas_buffer.c82
-rw-r--r--src/lib/ecore_evas/ecore_evas_buffer.h1
-rw-r--r--src/modules/evas/engines/buffer/Evas_Engine_Buffer.h2
-rw-r--r--src/modules/evas/engines/buffer/evas_engine.c7
-rw-r--r--src/modules/evas/engines/buffer/evas_engine.h10
-rw-r--r--src/modules/evas/engines/buffer/evas_outbuf.c217
6 files changed, 266 insertions, 53 deletions
diff --git a/src/lib/ecore_evas/ecore_evas_buffer.c b/src/lib/ecore_evas/ecore_evas_buffer.c
index dcb9fa13f1..e3a75c2577 100644
--- a/src/lib/ecore_evas/ecore_evas_buffer.c
+++ b/src/lib/ecore_evas/ecore_evas_buffer.c
@@ -30,8 +30,9 @@ _ecore_evas_buffer_free(Ecore_Evas *ee)
30 } 30 }
31 else 31 else
32 { 32 {
33 bdata->free_func(bdata->data, 33 bdata->free_func(bdata->data, bdata->pixels);
34 bdata->pixels); 34 if (bdata->swap)
35 bdata->free_func(bdata->data, bdata->swap);
35 } 36 }
36 37
37 free(bdata); 38 free(bdata);
@@ -51,9 +52,18 @@ _ecore_evas_resize(Ecore_Evas *ee, int w, int h)
51 if ((w == ee->w) && (h == ee->h)) return; 52 if ((w == ee->w) && (h == ee->h)) return;
52 ee->w = w; 53 ee->w = w;
53 ee->h = h; 54 ee->h = h;
54 evas_output_size_set(ee->evas, ee->w, ee->h); 55 if (PORTRAIT_CHECK(ee->rotation))
55 evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h); 56 {
56 evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); 57 evas_output_size_set(ee->evas, ee->w, ee->h);
58 evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h);
59 evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h);
60 }
61 else
62 {
63 evas_output_size_set(ee->evas, ee->h, ee->w);
64 evas_output_viewport_set(ee->evas, 0, 0, ee->h, ee->w);
65 evas_damage_rectangle_add(ee->evas, 0, 0, ee->h, ee->w);
66 }
57 67
58 if (bdata->image) 68 if (bdata->image)
59 { 69 {
@@ -63,11 +73,18 @@ _ecore_evas_resize(Ecore_Evas *ee, int w, int h)
63 else 73 else
64 { 74 {
65 if (bdata->pixels) 75 if (bdata->pixels)
66 bdata->free_func(bdata->data, 76 bdata->free_func(bdata->data, bdata->pixels);
67 bdata->pixels); 77 if (bdata->swap)
68 bdata->pixels = bdata->alloc_func(bdata->data, 78 bdata->free_func(bdata->data, bdata->swap);
69 ee->w * ee->h * sizeof(int)); 79 bdata->pixels = bdata->alloc_func(bdata->data, ee->w * ee->h * sizeof(int));
70 stride = ee->w * sizeof(int); 80 bdata->swap = NULL;
81 if (ee->rotation)
82 bdata->swap = bdata->alloc_func(bdata->data, ee->w * ee->h * sizeof(int));
83 if (PORTRAIT_CHECK(ee->rotation))
84 stride = ee->w;
85 else
86 stride = ee->h;
87 stride *= sizeof(int);
71 } 88 }
72 89
73 einfo = (Evas_Engine_Info_Buffer *)evas_engine_info_get(ee->evas); 90 einfo = (Evas_Engine_Info_Buffer *)evas_engine_info_get(ee->evas);
@@ -83,6 +100,7 @@ _ecore_evas_resize(Ecore_Evas *ee, int w, int h)
83 einfo->info.alpha_threshold = 0; 100 einfo->info.alpha_threshold = 0;
84 einfo->info.func.new_update_region = NULL; 101 einfo->info.func.new_update_region = NULL;
85 einfo->info.func.free_update_region = NULL; 102 einfo->info.func.free_update_region = NULL;
103 einfo->info.render_buffer = bdata->swap;
86 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) 104 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
87 { 105 {
88 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); 106 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
@@ -100,6 +118,47 @@ _ecore_evas_move_resize(Ecore_Evas *ee, int x EINA_UNUSED, int y EINA_UNUSED, in
100} 118}
101 119
102static void 120static void
121_ecore_evas_buffer_rotation_set(Ecore_Evas *ee, int rotation, int resize)
122{
123 Evas_Engine_Info_Buffer *einfo;
124 const Evas_Device *pointer;
125 Ecore_Evas_Cursor *cursor = NULL;
126 Ecore_Evas_Engine_Buffer_Data *bdata = ee->engine.data;
127
128 if (rotation == ee->rotation) return;
129 if (bdata->image) return; //parent canvas should rotate?
130 pointer = evas_default_device_get(ee->evas, EFL_INPUT_DEVICE_TYPE_SEAT);
131 if (pointer) cursor = eina_hash_find(ee->prop.cursors, &pointer);
132 einfo = (Evas_Engine_Info_Buffer *)evas_engine_info_get(ee->evas);
133 einfo->info.rotation = rotation;
134 if (!resize)
135 {
136 if ((!rotation) && bdata->swap)
137 {
138 bdata->free_func(bdata->data, bdata->swap);
139 bdata->swap = NULL;
140 }
141 if (rotation && (!bdata->swap))
142 bdata->swap = bdata->alloc_func(bdata->data, ee->w * ee->h * sizeof(int));
143 }
144 einfo->info.render_buffer = bdata->swap;
145 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info*)einfo))
146 {
147 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
148 }
149 ee->rotation = rotation;
150 if (resize)
151 {
152 int w = ee->w, h = ee->h;
153 ee->w = 0, ee->h = 0;
154 _ecore_evas_resize(ee, w, h);
155 }
156 if (!cursor) return;
157 _ecore_evas_mouse_move_process(ee, cursor->pos_x, cursor->pos_y,
158 (unsigned int)((unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff));
159}
160
161static void
103_ecore_evas_show(Ecore_Evas *ee) 162_ecore_evas_show(Ecore_Evas *ee)
104{ 163{
105 Ecore_Evas_Engine_Buffer_Data *bdata = ee->engine.data; 164 Ecore_Evas_Engine_Buffer_Data *bdata = ee->engine.data;
@@ -641,7 +700,7 @@ static Ecore_Evas_Engine_Func _ecore_buffer_engine_func =
641 NULL, 700 NULL,
642 _ecore_evas_resize, 701 _ecore_evas_resize,
643 _ecore_evas_move_resize, 702 _ecore_evas_move_resize,
644 NULL, 703 _ecore_evas_buffer_rotation_set,
645 NULL, 704 NULL,
646 _ecore_evas_show, 705 _ecore_evas_show,
647 NULL, 706 NULL,
@@ -801,6 +860,7 @@ ecore_evas_buffer_allocfunc_new(int w, int h,
801 einfo->info.alpha_threshold = 0; 860 einfo->info.alpha_threshold = 0;
802 einfo->info.func.new_update_region = NULL; 861 einfo->info.func.new_update_region = NULL;
803 einfo->info.func.free_update_region = NULL; 862 einfo->info.func.free_update_region = NULL;
863 einfo->info.switch_data = ee;
804 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) 864 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
805 { 865 {
806 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); 866 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
diff --git a/src/lib/ecore_evas/ecore_evas_buffer.h b/src/lib/ecore_evas/ecore_evas_buffer.h
index e29dee335b..234fde3ed1 100644
--- a/src/lib/ecore_evas/ecore_evas_buffer.h
+++ b/src/lib/ecore_evas/ecore_evas_buffer.h
@@ -5,6 +5,7 @@ typedef struct _Ecore_Evas_Engine_Buffer_Data Ecore_Evas_Engine_Buffer_Data;
5 5
6struct _Ecore_Evas_Engine_Buffer_Data { 6struct _Ecore_Evas_Engine_Buffer_Data {
7 void *pixels; 7 void *pixels;
8 void *swap;
8 Evas_Object *image; 9 Evas_Object *image;
9 void (*free_func) (void *data, void *pix); 10 void (*free_func) (void *data, void *pix);
10 void *(*alloc_func) (void *data, int size); 11 void *(*alloc_func) (void *data, int size);
diff --git a/src/modules/evas/engines/buffer/Evas_Engine_Buffer.h b/src/modules/evas/engines/buffer/Evas_Engine_Buffer.h
index 0f23758079..933ab7b446 100644
--- a/src/modules/evas/engines/buffer/Evas_Engine_Buffer.h
+++ b/src/modules/evas/engines/buffer/Evas_Engine_Buffer.h
@@ -19,6 +19,7 @@ struct _Evas_Engine_Info_Buffer
19 int depth_type; 19 int depth_type;
20 20
21 void *dest_buffer; 21 void *dest_buffer;
22 void *render_buffer;
22 int dest_buffer_row_bytes; 23 int dest_buffer_row_bytes;
23 24
24 Eina_Bool use_color_key : 1; 25 Eina_Bool use_color_key : 1;
@@ -33,6 +34,7 @@ struct _Evas_Engine_Info_Buffer
33 } func; 34 } func;
34 35
35 void *switch_data; 36 void *switch_data;
37 int rotation;
36 } info; 38 } info;
37 39
38 /* non-blocking or blocking mode */ 40 /* non-blocking or blocking mode */
diff --git a/src/modules/evas/engines/buffer/evas_engine.c b/src/modules/evas/engines/buffer/evas_engine.c
index bd6543bc74..e7334b4670 100644
--- a/src/modules/evas/engines/buffer/evas_engine.c
+++ b/src/modules/evas/engines/buffer/evas_engine.c
@@ -19,7 +19,6 @@ static Evas_Func func, pfunc;
19typedef Render_Engine_Software_Generic Render_Engine; 19typedef Render_Engine_Software_Generic Render_Engine;
20 20
21/* prototypes we will use here */ 21/* prototypes we will use here */
22static void *_output_setup(int w, int h, void *dest_buffer, int dest_buffer_row_bytes, int depth_type, int use_color_key, int alpha_threshold, int color_key_r, int color_key_g, int color_key_b, void *(*new_update_region)(int x, int y, int w, int h, int *row_bytes), void (*free_update_region)(int x, int y, int w, int h, void *data), void *(*switch_buffer)(void *data, void *dest_buffer), void *switch_data);
23 22
24static void *eng_info(Evas *eo_e EINA_UNUSED); 23static void *eng_info(Evas *eo_e EINA_UNUSED);
25static void eng_info_free(Evas *eo_e EINA_UNUSED, void *info); 24static void eng_info_free(Evas *eo_e EINA_UNUSED, void *info);
@@ -29,7 +28,9 @@ static void eng_output_free(void *engine EINA_UNUSED, void *data);
29static void * 28static void *
30_output_setup(int w, 29_output_setup(int w,
31 int h, 30 int h,
31 int rot,
32 void *dest_buffer, 32 void *dest_buffer,
33 void *render_buffer,
33 int dest_buffer_row_bytes, 34 int dest_buffer_row_bytes,
34 int depth_type, 35 int depth_type,
35 int use_color_key, 36 int use_color_key,
@@ -70,8 +71,10 @@ _output_setup(int w,
70 A_VAL(&color_key) = 0; 71 A_VAL(&color_key) = 0;
71 ob = evas_buffer_outbuf_buf_setup_fb(w, 72 ob = evas_buffer_outbuf_buf_setup_fb(w,
72 h, 73 h,
74 rot,
73 dep, 75 dep,
74 dest_buffer, 76 dest_buffer,
77 render_buffer,
75 dest_buffer_row_bytes, 78 dest_buffer_row_bytes,
76 use_color_key, 79 use_color_key,
77 color_key, 80 color_key,
@@ -132,7 +135,9 @@ eng_setup(void *engine EINA_UNUSED, void *in, unsigned int w, unsigned int h)
132 135
133 return _output_setup(w, 136 return _output_setup(w,
134 h, 137 h,
138 info->info.rotation,
135 info->info.dest_buffer, 139 info->info.dest_buffer,
140 info->info.render_buffer,
136 info->info.dest_buffer_row_bytes, 141 info->info.dest_buffer_row_bytes,
137 info->info.depth_type, 142 info->info.depth_type,
138 info->info.use_color_key, 143 info->info.use_color_key,
diff --git a/src/modules/evas/engines/buffer/evas_engine.h b/src/modules/evas/engines/buffer/evas_engine.h
index 4fcf2e451f..c840ea0916 100644
--- a/src/modules/evas/engines/buffer/evas_engine.h
+++ b/src/modules/evas/engines/buffer/evas_engine.h
@@ -39,11 +39,13 @@ struct _Outbuf
39 Outbuf_Depth depth; 39 Outbuf_Depth depth;
40 40
41 void *dest; 41 void *dest;
42 void *rdest;
42 unsigned int dest_row_bytes; 43 unsigned int dest_row_bytes;
43 void *switch_data; 44 void *switch_data;
44 45
45 int alpha_level; 46 int alpha_level;
46 DATA32 color_key; 47 DATA32 color_key;
48 int rotation;
47 Eina_Bool use_color_key : 1; 49 Eina_Bool use_color_key : 1;
48 Eina_Bool first_frame : 1; 50 Eina_Bool first_frame : 1;
49 51
@@ -54,7 +56,8 @@ struct _Outbuf
54 } func; 56 } func;
55 57
56 struct { 58 struct {
57 RGBA_Image *back_buf; 59 RGBA_Image *back_buf; //not actually the back buffer, just a cache entry for the front buffer
60 RGBA_Image *render_buf;
58 } priv; 61 } priv;
59}; 62};
60 63
@@ -64,9 +67,10 @@ void evas_buffer_outbuf_buf_init (void);
64void evas_buffer_outbuf_buf_free (Outbuf *buf); 67void evas_buffer_outbuf_buf_free (Outbuf *buf);
65 68
66void evas_buffer_outbuf_buf_update_fb (Outbuf *buf, 69void evas_buffer_outbuf_buf_update_fb (Outbuf *buf,
67 int w, int h, 70 int w, int h, int rot,
68 Outbuf_Depth depth, 71 Outbuf_Depth depth,
69 void *dest, 72 void *dest,
73 void *rdest,
70 int dest_row_bytes, 74 int dest_row_bytes,
71 int use_color_key, 75 int use_color_key,
72 DATA32 color_key, 76 DATA32 color_key,
@@ -75,7 +79,7 @@ void evas_buffer_outbuf_buf_update_fb (Outbuf *buf,
75 void (*free_update_region) (int x, int y, int w, int h, void *data), 79 void (*free_update_region) (int x, int y, int w, int h, void *data),
76 void * (*switch_buffer) (void *data, void *dest_buffer), 80 void * (*switch_buffer) (void *data, void *dest_buffer),
77 void *switch_data); 81 void *switch_data);
78Outbuf *evas_buffer_outbuf_buf_setup_fb (int w, int h, Outbuf_Depth depth, void *dest, int dest_row_bytes, int use_color_key, DATA32 color_key, int alpha_level, 82Outbuf *evas_buffer_outbuf_buf_setup_fb (int w, int h, int rot, Outbuf_Depth depth, void *dest, void *rdest, int dest_row_bytes, int use_color_key, DATA32 color_key, int alpha_level,
79 void * (*new_update_region) (int x, int y, int w, int h, int *row_bytes), 83 void * (*new_update_region) (int x, int y, int w, int h, int *row_bytes),
80 void (*free_update_region) (int x, int y, int w, int h, void *data), 84 void (*free_update_region) (int x, int y, int w, int h, void *data),
81 void * (*switch_buffer)(void *switch_data, void *dest), 85 void * (*switch_buffer)(void *switch_data, void *dest),
diff --git a/src/modules/evas/engines/buffer/evas_outbuf.c b/src/modules/evas/engines/buffer/evas_outbuf.c
index a6c7152e68..968adb81ac 100644
--- a/src/modules/evas/engines/buffer/evas_outbuf.c
+++ b/src/modules/evas/engines/buffer/evas_outbuf.c
@@ -17,6 +17,15 @@ evas_buffer_outbuf_buf_init(void)
17void 17void
18evas_buffer_outbuf_buf_free(Outbuf *buf) 18evas_buffer_outbuf_buf_free(Outbuf *buf)
19{ 19{
20 if (buf->priv.render_buf)
21 {
22#ifdef EVAS_CSERVE2
23 if (evas_cserve2_use_get())
24 evas_cache2_image_close(&buf->priv.render_buf->cache_entry);
25 else
26#endif
27 evas_cache_image_drop(&buf->priv.render_buf->cache_entry);
28 }
20 if (buf->priv.back_buf) 29 if (buf->priv.back_buf)
21 { 30 {
22#ifdef EVAS_CSERVE2 31#ifdef EVAS_CSERVE2
@@ -30,7 +39,7 @@ evas_buffer_outbuf_buf_free(Outbuf *buf)
30} 39}
31 40
32void 41void
33evas_buffer_outbuf_buf_update_fb(Outbuf *buf, int w, int h, Outbuf_Depth depth, void *dest, int dest_row_bytes, int use_color_key, DATA32 color_key, int alpha_level, 42evas_buffer_outbuf_buf_update_fb(Outbuf *buf, int w, int h, int rot, Outbuf_Depth depth, void *dest, void *rdest, int dest_row_bytes, int use_color_key, DATA32 color_key, int alpha_level,
34 void * (*new_update_region)(int x, int y, int w, int h, int *row_bytes), 43 void * (*new_update_region)(int x, int y, int w, int h, int *row_bytes),
35 void (*free_update_region)(int x, int y, int w, int h, void *data), 44 void (*free_update_region)(int x, int y, int w, int h, void *data),
36 void * (*switch_buffer)(void *data, void *dest_buffer), 45 void * (*switch_buffer)(void *data, void *dest_buffer),
@@ -38,9 +47,11 @@ evas_buffer_outbuf_buf_update_fb(Outbuf *buf, int w, int h, Outbuf_Depth depth,
38{ 47{
39 buf->w = w; 48 buf->w = w;
40 buf->h = h; 49 buf->h = h;
50 buf->rotation = rot;
41 buf->depth = depth; 51 buf->depth = depth;
42 52
43 buf->dest = dest; 53 buf->dest = dest;
54 buf->rdest = rdest;
44 buf->dest_row_bytes = dest_row_bytes; 55 buf->dest_row_bytes = dest_row_bytes;
45 56
46 buf->alpha_level = alpha_level; 57 buf->alpha_level = alpha_level;
@@ -59,37 +70,67 @@ evas_buffer_outbuf_buf_update_fb(Outbuf *buf, int w, int h, Outbuf_Depth depth,
59 memset(buf->dest, 0, h * buf->dest_row_bytes); 70 memset(buf->dest, 0, h * buf->dest_row_bytes);
60#ifdef EVAS_CSERVE2 71#ifdef EVAS_CSERVE2
61 if (evas_cserve2_use_get()) 72 if (evas_cserve2_use_get())
62 buf->priv.back_buf = (RGBA_Image *)evas_cache2_image_data(evas_common_image_cache2_get(), 73 {
63 w, h, 74 buf->priv.back_buf = (RGBA_Image *)evas_cache2_image_data(evas_common_image_cache2_get(),
64 buf->dest, 75 w, h,
65 1, EVAS_COLORSPACE_ARGB8888); 76 buf->dest,
77 1, EVAS_COLORSPACE_ARGB8888);
78 if (buf->rdest)
79 buf->priv.render_buf = (RGBA_Image *)evas_cache2_image_data(evas_common_image_cache2_get(),
80 w, h,
81 buf->rdest,
82 1, EVAS_COLORSPACE_ARGB8888);
83
84 }
66 else 85 else
67#endif 86#endif
68 buf->priv.back_buf = (RGBA_Image *)evas_cache_image_data(evas_common_image_cache_get(), 87 {
69 w, h, 88 buf->priv.back_buf = (RGBA_Image *)evas_cache_image_data(evas_common_image_cache_get(),
70 buf->dest, 89 w, h,
71 1, EVAS_COLORSPACE_ARGB8888); 90 buf->dest,
91 1, EVAS_COLORSPACE_ARGB8888);
92 if (buf->rdest)
93 buf->priv.render_buf = (RGBA_Image *)evas_cache_image_data(evas_common_image_cache_get(),
94 w, h,
95 buf->rdest,
96 1, EVAS_COLORSPACE_ARGB8888);
97 }
72 } 98 }
73 else if ((buf->depth == OUTBUF_DEPTH_RGB_32BPP_888_8888) && 99 else if ((buf->depth == OUTBUF_DEPTH_RGB_32BPP_888_8888) &&
74 (buf->dest) && (buf->dest_row_bytes == (buf->w * sizeof(DATA32)))) 100 (buf->dest) && (buf->dest_row_bytes == (buf->w * sizeof(DATA32))))
75 { 101 {
76#ifdef EVAS_CSERVE2 102#ifdef EVAS_CSERVE2
77 if (evas_cserve2_use_get()) 103 if (evas_cserve2_use_get())
78 buf->priv.back_buf = (RGBA_Image *)evas_cache2_image_data(evas_common_image_cache2_get(), 104 {
79 w, h, 105 buf->priv.back_buf = (RGBA_Image *)evas_cache2_image_data(evas_common_image_cache2_get(),
80 buf->dest, 106 w, h,
81 0, EVAS_COLORSPACE_ARGB8888); 107 buf->dest,
108 0, EVAS_COLORSPACE_ARGB8888);
109 if (buf->rdest)
110 buf->priv.render_buf = (RGBA_Image *)evas_cache2_image_data(evas_common_image_cache2_get(),
111 w, h,
112 buf->rdest,
113 0, EVAS_COLORSPACE_ARGB8888);
114
115 }
82 else 116 else
83#endif 117#endif
84 buf->priv.back_buf = (RGBA_Image *)evas_cache_image_data(evas_common_image_cache_get(), 118 {
85 w, h, 119 buf->priv.back_buf = (RGBA_Image *)evas_cache_image_data(evas_common_image_cache_get(),
86 buf->dest, 120 w, h,
87 0, EVAS_COLORSPACE_ARGB8888); 121 buf->dest,
122 0, EVAS_COLORSPACE_ARGB8888);
123 if (buf->rdest)
124 buf->priv.render_buf = (RGBA_Image *)evas_cache_image_data(evas_common_image_cache_get(),
125 w, h,
126 buf->rdest,
127 0, EVAS_COLORSPACE_ARGB8888);
128 }
88 } 129 }
89} 130}
90 131
91Outbuf * 132Outbuf *
92evas_buffer_outbuf_buf_setup_fb(int w, int h, Outbuf_Depth depth, void *dest, int dest_row_bytes, int use_color_key, DATA32 color_key, int alpha_level, 133evas_buffer_outbuf_buf_setup_fb(int w, int h, int rot, Outbuf_Depth depth, void *dest, void *rdest, int dest_row_bytes, int use_color_key, DATA32 color_key, int alpha_level,
93 void * (*new_update_region)(int x, int y, int w, int h, int *row_bytes), 134 void * (*new_update_region)(int x, int y, int w, int h, int *row_bytes),
94 void (*free_update_region)(int x, int y, int w, int h, void *data), 135 void (*free_update_region)(int x, int y, int w, int h, void *data),
95 void * (*switch_buffer)(void *data, void *dest_buffer), 136 void * (*switch_buffer)(void *data, void *dest_buffer),
@@ -103,8 +144,10 @@ evas_buffer_outbuf_buf_setup_fb(int w, int h, Outbuf_Depth depth, void *dest, in
103 evas_buffer_outbuf_buf_update_fb(buf, 144 evas_buffer_outbuf_buf_update_fb(buf,
104 w, 145 w,
105 h, 146 h,
147 rot,
106 depth, 148 depth,
107 dest, 149 dest,
150 rdest,
108 dest_row_bytes, 151 dest_row_bytes,
109 use_color_key, 152 use_color_key,
110 color_key, 153 color_key,
@@ -122,6 +165,11 @@ evas_buffer_outbuf_buf_new_region_for_update(Outbuf *buf, int x, int y, int w, i
122{ 165{
123 RGBA_Image *im; 166 RGBA_Image *im;
124 167
168 if (buf->priv.render_buf)
169 {
170 *cx = x; *cy = y; *cw = w; *ch = h;
171 return buf->priv.render_buf;
172 }
125 if (buf->priv.back_buf) 173 if (buf->priv.back_buf)
126 { 174 {
127 *cx = x; *cy = y; *cw = w; *ch = h; 175 *cx = x; *cy = y; *cw = w; *ch = h;
@@ -158,7 +206,7 @@ evas_buffer_outbuf_buf_new_region_for_update(Outbuf *buf, int x, int y, int w, i
158void 206void
159evas_buffer_outbuf_buf_free_region_for_update(Outbuf *buf, RGBA_Image *update) 207evas_buffer_outbuf_buf_free_region_for_update(Outbuf *buf, RGBA_Image *update)
160{ 208{
161 if (update != buf->priv.back_buf) 209 if ((update != buf->priv.back_buf) && (update != buf->priv.render_buf))
162 { 210 {
163#ifdef EVAS_CSERVE2 211#ifdef EVAS_CSERVE2
164 if (evas_cserve2_use_get()) 212 if (evas_cserve2_use_get())
@@ -175,6 +223,7 @@ evas_buffer_outbuf_buf_switch_buffer(Outbuf *buf, Tilebuf_Rect *surface_damage E
175 if (buf->func.switch_buffer) 223 if (buf->func.switch_buffer)
176 { 224 {
177 buf->dest = buf->func.switch_buffer(buf->switch_data, buf->dest); 225 buf->dest = buf->func.switch_buffer(buf->switch_data, buf->dest);
226
178 if (buf->priv.back_buf) 227 if (buf->priv.back_buf)
179 { 228 {
180#ifdef EVAS_CSERVE2 229#ifdef EVAS_CSERVE2
@@ -222,6 +271,39 @@ _update_24bpp_888_888(DATA8 *dst, DATA32 *src, int depth)
222void 271void
223evas_buffer_outbuf_buf_push_updated_region(Outbuf *buf, RGBA_Image *update, int x, int y, int w, int h) 272evas_buffer_outbuf_buf_push_updated_region(Outbuf *buf, RGBA_Image *update, int x, int y, int w, int h)
224{ 273{
274 Eina_Rectangle r = {0}, pr;
275 int rx = 0, ry = 0;
276
277 if (buf->rotation == 0)
278 {
279 r.x = x;
280 r.y = y;
281 }
282 else if (buf->rotation == 90)
283 {
284 r.x = y;
285 r.y = buf->w - x - w;
286 }
287 else if (buf->rotation == 180)
288 {
289 r.x = buf->w - x - w;
290 r.y = buf->h - y - h;
291 }
292 else if (buf->rotation == 270)
293 {
294 r.x = buf->h - y - h;
295 r.y = x;
296 }
297 if ((buf->rotation == 0) || (buf->rotation == 180))
298 {
299 r.w = w;
300 r.h = h;
301 }
302 else if ((buf->rotation == 90) || (buf->rotation == 270))
303 {
304 r.w = h;
305 r.h = w;
306 }
225 /* copy update image to out buf & convert */ 307 /* copy update image to out buf & convert */
226 switch (buf->depth) 308 switch (buf->depth)
227 { 309 {
@@ -246,18 +328,32 @@ evas_buffer_outbuf_buf_push_updated_region(Outbuf *buf, RGBA_Image *update, int
246 dest = buf->func.new_update_region(x, y, w, h, &row_bytes); 328 dest = buf->func.new_update_region(x, y, w, h, &row_bytes);
247 } 329 }
248 if (!dest) break; 330 if (!dest) break;
249 for (yy = 0; yy < h; yy++) 331 for (yy = 0; yy < update->cache_entry.h; yy++)
250 { 332 {
251 dst = dest + (yy * row_bytes); 333 dst = dest + (yy * row_bytes);
252 src = update->image.data + (yy * update->cache_entry.w); 334 src = update->image.data + (yy * update->cache_entry.w);
253 for (xx = 0; xx < update->cache_entry.w; xx++) 335 for (xx = 0; xx < update->cache_entry.w; xx++)
254 { 336 {
255 if ((!buf->use_color_key) || (A_VAL(src) > thresh)) 337 if ((!buf->use_color_key) || (A_VAL(src) > thresh))
256 dst = _update_24bpp_888_888(dst, src, buf->depth); 338 dst = _update_24bpp_888_888(dst, src, buf->depth);
257 else 339 else
258 dst = _update_24bpp_888_888(dst, &colorkey, buf->depth); 340 dst = _update_24bpp_888_888(dst, &colorkey, buf->depth);
259 src++; 341 src++;
260 } 342 }
343/* FIXME: finish these...
344 case 90:
345 dst = dest + ((update->cache_entry.h - yy - 1) * row_bytes);
346 src = update->image.data + yy;
347 for (xx = 0; xx < update->cache_entry.h; xx++)
348 {
349 if ((!buf->use_color_key) || (A_VAL(src) > thresh))
350 dst = _update_24bpp_888_888(dst, src, buf->depth);
351 else
352 dst = _update_24bpp_888_888(dst, &colorkey, buf->depth);
353 src += w;
354 }
355 break;
356*/
261 } 357 }
262 if (buf->func.free_update_region) 358 if (buf->func.free_update_region)
263 { 359 {
@@ -269,11 +365,12 @@ evas_buffer_outbuf_buf_push_updated_region(Outbuf *buf, RGBA_Image *update, int
269 case OUTBUF_DEPTH_RGB_32BPP_888_8888: 365 case OUTBUF_DEPTH_RGB_32BPP_888_8888:
270 case OUTBUF_DEPTH_ARGB_32BPP_8888_8888: 366 case OUTBUF_DEPTH_ARGB_32BPP_8888_8888:
271 { 367 {
272 DATA32 *dest, *src, *dst; 368 DATA32 *dest, *src;
273 int yy, row_bytes; 369 int yy, row_bytes;
274 370
275 row_bytes = buf->dest_row_bytes; 371 row_bytes = buf->dest_row_bytes;
276 dest = (DATA32 *)((DATA8 *)(buf->dest) + (y * row_bytes) + (x * 4)); 372 dest = (DATA32 *)((DATA8 *)(buf->dest) + (y * row_bytes) + (x * 4));
373 src = update->image.data;
277 if (buf->func.new_update_region) 374 if (buf->func.new_update_region)
278 { 375 {
279 dest = buf->func.new_update_region(x, y, w, h, &row_bytes); 376 dest = buf->func.new_update_region(x, y, w, h, &row_bytes);
@@ -286,14 +383,54 @@ evas_buffer_outbuf_buf_push_updated_region(Outbuf *buf, RGBA_Image *update, int
286 func = evas_common_draw_func_copy_get(w, 0); 383 func = evas_common_draw_func_copy_get(w, 0);
287 if (func) 384 if (func)
288 { 385 {
289 for (yy = 0; yy < h; yy++) 386 for (yy = 0; yy < update->cache_entry.h; yy++)
290 { 387 {
388 DATA32 *dst;
291 src = update->image.data + (yy * update->cache_entry.w); 389 src = update->image.data + (yy * update->cache_entry.w);
292 dst = (DATA32 *)((DATA8 *)(buf->dest) + ((y + yy) * row_bytes)); 390 dst = (DATA32 *)((DATA8 *)(buf->dest) + ((y + yy) * row_bytes));
293 func(src, dst, w); 391 func(src, dst, w);
294 } 392 }
295 } 393 }
296 } 394 }
395 else if (buf->rotation)
396 {
397 Gfx_Func_Convert conv_func;
398 DATA8 *dst = buf->dest;
399
400 conv_func = evas_common_convert_func_get(0, buf->w, buf->h, 32,
401 0x00ff0000, 0x0000ff00, 0x000000ff, 0, buf->rotation);
402 if (buf->rotation == 180)
403 {
404 pr = r;
405 RECTS_CLIP_TO_RECT(r.x, r.y, r.w, r.h, 0, 0, buf->w, buf->h);
406 rx = pr.w - r.w; ry = pr.h - r.h;
407 src += (update->cache_entry.w * ry) + rx;
408 w -= rx;
409 }
410 else if (buf->rotation == 90)
411 {
412 pr = r;
413 RECTS_CLIP_TO_RECT(r.x, r.y, r.w, r.h, 0, 0, buf->w, buf->h);
414 rx = pr.w - r.w; ry = pr.h - r.h;
415 src += ry;
416 w -= ry;
417 }
418 else if (buf->rotation == 270)
419 {
420 pr = r;
421 RECTS_CLIP_TO_RECT(r.x, r.y, r.w, r.h, 0, 0, buf->w, buf->h);
422 rx = pr.w - r.w; ry = pr.h - r.h;
423 src += (update->cache_entry.w * rx);
424 w -= ry;
425 }
426 if (conv_func)
427 conv_func(src, dst,
428 update->cache_entry.w - w,
429 (row_bytes / 4) - r.w,
430 r.w, r.h,
431 x + rx, y + ry,
432 NULL);
433 }
297 if (buf->func.free_update_region) 434 if (buf->func.free_update_region)
298 { 435 {
299 buf->func.free_update_region(x, y, w, h, dest); 436 buf->func.free_update_region(x, y, w, h, dest);
@@ -314,11 +451,12 @@ evas_buffer_outbuf_buf_push_updated_region(Outbuf *buf, RGBA_Image *update, int
314 { 451 {
315 dest = buf->func.new_update_region(x, y, w, h, &row_bytes); 452 dest = buf->func.new_update_region(x, y, w, h, &row_bytes);
316 } 453 }
317 for (yy = 0; yy < h; yy++) 454 /* FIXME: use evas convert functions with rotations */
455 for (yy = 0; yy < update->cache_entry.h; yy++)
318 { 456 {
319 dst = (DATA32 *)(dest + (yy * row_bytes)); 457 dst = (DATA32 *)(dest + (yy * row_bytes));
320 src = update->image.data + (yy * update->cache_entry.w); 458 src = update->image.data + (yy * update->cache_entry.w);
321 for (xx = 0; xx < w; xx++) 459 for (xx = 0; xx < update->cache_entry.w; xx++)
322 { 460 {
323 A_VAL(dst) = B_VAL(src); 461 A_VAL(dst) = B_VAL(src);
324 R_VAL(dst) = G_VAL(src); 462 R_VAL(dst) = G_VAL(src);
@@ -340,9 +478,9 @@ evas_buffer_outbuf_buf_push_updated_region(Outbuf *buf, RGBA_Image *update, int
340} 478}
341 479
342void 480void
343evas_buffer_outbuf_reconfigure(Outbuf *ob, int w, int h, int rot EINA_UNUSED, Outbuf_Depth depth) 481evas_buffer_outbuf_reconfigure(Outbuf *ob, int w, int h, int rot, Outbuf_Depth depth)
344{ 482{
345 void *dest; 483 void *dest, *rdest;
346 int dest_row_bytes; 484 int dest_row_bytes;
347 int alpha_level; 485 int alpha_level;
348 DATA32 color_key; 486 DATA32 color_key;
@@ -354,6 +492,7 @@ evas_buffer_outbuf_reconfigure(Outbuf *ob, int w, int h, int rot EINA_UNUSED, Ou
354 492
355 if (depth == OUTBUF_DEPTH_INHERIT) depth = ob->depth; 493 if (depth == OUTBUF_DEPTH_INHERIT) depth = ob->depth;
356 dest = ob->dest; 494 dest = ob->dest;
495 rdest = ob->rdest;
357 dest_row_bytes = ob->dest_row_bytes; 496 dest_row_bytes = ob->dest_row_bytes;
358 alpha_level = ob->alpha_level; 497 alpha_level = ob->alpha_level;
359 color_key = ob->color_key; 498 color_key = ob->color_key;
@@ -366,8 +505,10 @@ evas_buffer_outbuf_reconfigure(Outbuf *ob, int w, int h, int rot EINA_UNUSED, Ou
366 evas_buffer_outbuf_buf_update_fb(ob, 505 evas_buffer_outbuf_buf_update_fb(ob,
367 w, 506 w,
368 h, 507 h,
508 rot,
369 depth, 509 depth,
370 dest, 510 dest,
511 rdest,
371 dest_row_bytes, 512 dest_row_bytes,
372 use_color_key, 513 use_color_key,
373 color_key, 514 color_key,
@@ -386,8 +527,8 @@ evas_buffer_outbuf_buf_swap_mode_get(Outbuf *ob)
386} 527}
387 528
388int 529int
389evas_buffer_outbuf_buf_rot_get(Outbuf *buf EINA_UNUSED) 530evas_buffer_outbuf_buf_rot_get(Outbuf *buf)
390{ 531{
391 return 0; 532 return buf->rotation;
392} 533}
393 534