summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2015-12-01 15:22:20 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2015-12-03 18:42:50 +0900
commitbad7911cd0f9d7eaa51c0c7b67ff3ed8d7da5599 (patch)
treec1f3f9552f9101c90d904e85f6d8bf5cc43cda57 /src
parent0cf5719e526b17bb6ad03f05643a760edf389e98 (diff)
Ector: Use Ector Buffer inside SW and Cairo renderers
Ector Surface now inherits from Ector Buffer, and the current two renderers (SW and Cairo SW) use Ector.Software.Buffer implementations for pixel surfaces. Basic pixel handling is merged and will allow easy extension (color conversion, etc...). Buffer classes are Mixins to be fully implemented by the final class, such as: Ector.Software.Buffer, Ector.Software.Surface or Ector.Cairo.Surface. This is a large ugly commit. Sorry. The code is quite a mess right now.
Diffstat (limited to 'src')
-rw-r--r--src/Makefile_Ector.am2
-rw-r--r--src/lib/ector/cairo/ector_cairo_surface.eo2
-rw-r--r--src/lib/ector/ector_buffer.h27
-rw-r--r--src/lib/ector/ector_generic_buffer.c12
-rw-r--r--src/lib/ector/ector_generic_buffer.eo3
-rw-r--r--src/lib/ector/ector_generic_surface.eo16
-rw-r--r--src/lib/ector/ector_private.h14
-rw-r--r--src/lib/ector/ector_renderer_base.c21
-rw-r--r--src/lib/ector/ector_renderer_generic_base.eo1
-rw-r--r--src/lib/ector/ector_renderer_generic_buffer.eo6
-rw-r--r--src/lib/ector/ector_surface.c34
-rw-r--r--src/lib/ector/software/Ector_Software.h1
-rw-r--r--src/lib/ector/software/ector_renderer_software_buffer.c4
-rw-r--r--src/lib/ector/software/ector_software_buffer.c111
-rw-r--r--src/lib/ector/software/ector_software_buffer.eo16
-rw-r--r--src/lib/ector/software/ector_software_buffer_base.eo19
-rw-r--r--src/lib/ector/software/ector_software_private.h35
-rw-r--r--src/lib/ector/software/ector_software_rasterizer.c28
-rw-r--r--src/lib/ector/software/ector_software_surface.c52
-rw-r--r--src/lib/ector/software/ector_software_surface.eo26
-rw-r--r--src/modules/evas/engines/gl_generic/ector_cairo_software_surface.eo19
-rw-r--r--src/modules/evas/engines/gl_generic/ector_surface.c90
-rw-r--r--src/modules/evas/engines/gl_generic/evas_engine.c28
-rw-r--r--src/modules/evas/engines/software_generic/ector_cairo_software_surface.eo19
-rw-r--r--src/modules/evas/engines/software_generic/ector_surface.c78
-rw-r--r--src/modules/evas/engines/software_generic/evas_engine.c52
26 files changed, 322 insertions, 394 deletions
diff --git a/src/Makefile_Ector.am b/src/Makefile_Ector.am
index b6cda51a4d..3dc4c73211 100644
--- a/src/Makefile_Ector.am
+++ b/src/Makefile_Ector.am
@@ -24,6 +24,7 @@ ector_eolian_cairo_h = $(ector_eolian_files_cairo:%.eo=%.eo.h)
24ector_eolian_files_software = \ 24ector_eolian_files_software = \
25 lib/ector/software/ector_software_surface.eo \ 25 lib/ector/software/ector_software_surface.eo \
26 lib/ector/software/ector_software_buffer.eo \ 26 lib/ector/software/ector_software_buffer.eo \
27 lib/ector/software/ector_software_buffer_base.eo \
27 lib/ector/software/ector_renderer_software_base.eo \ 28 lib/ector/software/ector_renderer_software_base.eo \
28 lib/ector/software/ector_renderer_software_shape.eo \ 29 lib/ector/software/ector_renderer_software_shape.eo \
29 lib/ector/software/ector_renderer_software_buffer.eo \ 30 lib/ector/software/ector_renderer_software_buffer.eo \
@@ -67,7 +68,6 @@ lib/ector/software/Ector_Software.h
67 68
68lib_ector_libector_la_SOURCES = \ 69lib_ector_libector_la_SOURCES = \
69lib/ector/ector_main.c \ 70lib/ector/ector_main.c \
70lib/ector/ector_surface.c \
71lib/ector/ector_generic_buffer.c \ 71lib/ector/ector_generic_buffer.c \
72lib/ector/ector_renderer_shape.c \ 72lib/ector/ector_renderer_shape.c \
73lib/ector/ector_renderer_base.c \ 73lib/ector/ector_renderer_base.c \
diff --git a/src/lib/ector/cairo/ector_cairo_surface.eo b/src/lib/ector/cairo/ector_cairo_surface.eo
index 78dbe154b5..001d73acf8 100644
--- a/src/lib/ector/cairo/ector_cairo_surface.eo
+++ b/src/lib/ector/cairo/ector_cairo_surface.eo
@@ -1,4 +1,4 @@
1class Ector.Cairo.Surface (Ector.Generic.Surface) 1class Ector.Cairo.Surface (Eo.Base, Ector.Generic.Surface)
2{ 2{
3 eo_prefix: ector_cairo_surface; 3 eo_prefix: ector_cairo_surface;
4 legacy_prefix: null; 4 legacy_prefix: null;
diff --git a/src/lib/ector/ector_buffer.h b/src/lib/ector/ector_buffer.h
new file mode 100644
index 0000000000..41a75cb8ac
--- /dev/null
+++ b/src/lib/ector/ector_buffer.h
@@ -0,0 +1,27 @@
1#include <Ector.h>
2
3#include "ector_generic_buffer.eo.h"
4#include "software/ector_software_buffer_base.eo.h"
5
6typedef struct _Ector_Generic_Buffer_Data
7{
8 Eo *eo;
9 unsigned int w, h;
10 unsigned char l, r, t, b;
11 Efl_Gfx_Colorspace cspace;
12} Ector_Generic_Buffer_Data;
13
14typedef struct _Ector_Software_Buffer_Base_Data
15{
16 Ector_Generic_Buffer_Data *generic; /* ugly */
17 union {
18 unsigned int *u32;
19 unsigned char *u8;
20 } pixels;
21 unsigned int stride;
22 unsigned int pixel_size; // in bytes
23 unsigned int map_count;
24 Eina_Bool writable : 1;
25 Eina_Bool nofree : 1; // pixel data should not be free()'ed
26 Eina_Bool span_free : 1;
27} Ector_Software_Buffer_Base_Data;
diff --git a/src/lib/ector/ector_generic_buffer.c b/src/lib/ector/ector_generic_buffer.c
index ba5955bfd2..9c97ff8e91 100644
--- a/src/lib/ector/ector_generic_buffer.c
+++ b/src/lib/ector/ector_generic_buffer.c
@@ -8,8 +8,6 @@
8#include "ector_private.h" 8#include "ector_private.h"
9#include "ector_generic_buffer.eo.h" 9#include "ector_generic_buffer.eo.h"
10 10
11#define MY_CLASS ECTOR_GENERIC_BUFFER_CLASS
12
13EOLIAN static Efl_Gfx_Colorspace 11EOLIAN static Efl_Gfx_Colorspace
14_ector_generic_buffer_cspace_get(Eo *obj EINA_UNUSED, Ector_Generic_Buffer_Data *pd) 12_ector_generic_buffer_cspace_get(Eo *obj EINA_UNUSED, Ector_Generic_Buffer_Data *pd)
15{ 13{
@@ -38,13 +36,5 @@ _ector_generic_buffer_flags_get(Eo *obj EINA_UNUSED, Ector_Generic_Buffer_Data *
38 return ECTOR_BUFFER_FLAG_NONE; 36 return ECTOR_BUFFER_FLAG_NONE;
39} 37}
40 38
41EOLIAN static Eo_Base *
42_ector_generic_buffer_eo_base_constructor(Eo *obj, Ector_Generic_Buffer_Data *pd)
43{
44 eo_do_super(obj, MY_CLASS, obj = eo_constructor());
45 pd->eo = obj;
46
47 return obj;
48}
49
50#include "ector_generic_buffer.eo.c" 39#include "ector_generic_buffer.eo.c"
40#include "ector_generic_surface.eo.c"
diff --git a/src/lib/ector/ector_generic_buffer.eo b/src/lib/ector/ector_generic_buffer.eo
index f0f15662d4..7b8a3edae6 100644
--- a/src/lib/ector/ector_generic_buffer.eo
+++ b/src/lib/ector/ector_generic_buffer.eo
@@ -15,7 +15,7 @@ enum Ector.Buffer.Access_Flag {
15 write = 0x2, 15 write = 0x2,
16} 16}
17 17
18abstract Ector.Generic.Buffer (Eo.Base) 18mixin Ector.Generic.Buffer
19{ 19{
20 [[2D pixel buffer interface for Ector 20 [[2D pixel buffer interface for Ector
21 @since 1.17 21 @since 1.17
@@ -122,7 +122,6 @@ abstract Ector.Generic.Buffer (Eo.Base)
122 detached; [[Emitted whenever the previously attached pixels are detached during pixels_set]] 122 detached; [[Emitted whenever the previously attached pixels are detached during pixels_set]]
123 } 123 }
124 implements { 124 implements {
125 Eo.Base.constructor;
126 @virtual .pixels_set; 125 @virtual .pixels_set;
127 @virtual .span_get; 126 @virtual .span_get;
128 @virtual .span_free; 127 @virtual .span_free;
diff --git a/src/lib/ector/ector_generic_surface.eo b/src/lib/ector/ector_generic_surface.eo
index a391ea08a2..cb05c6d3d5 100644
--- a/src/lib/ector/ector_generic_surface.eo
+++ b/src/lib/ector/ector_generic_surface.eo
@@ -1,19 +1,9 @@
1abstract Ector.Generic.Surface (Eo.Base) 1mixin Ector.Generic.Surface (Ector.Generic.Buffer)
2{ 2{
3 eo_prefix: ector_surface; 3 eo_prefix: ector_surface;
4 legacy_prefix: null;
5 data: null;
4 methods { 6 methods {
5 @property size {
6 set {
7 [[Changes the size of the given Evas object.]]
8 }
9 get {
10 [[Retrieves the (rectangular) size of the given Evas object.]]
11 }
12 values {
13 w: int;
14 h: int;
15 }
16 }
17 @property reference_point { 7 @property reference_point {
18 set { 8 set {
19 [[This define where is (0,0) in pixels coordinate inside the surface]] 9 [[This define where is (0,0) in pixels coordinate inside the surface]]
diff --git a/src/lib/ector/ector_private.h b/src/lib/ector/ector_private.h
index 13cfc7eee0..3418c99e58 100644
--- a/src/lib/ector/ector_private.h
+++ b/src/lib/ector/ector_private.h
@@ -91,7 +91,6 @@ typedef struct _Ector_Renderer_Generic_Gradient_Linear_Data Ector_Renderer_Gener
91typedef struct _Ector_Renderer_Generic_Gradient_Radial_Data Ector_Renderer_Generic_Gradient_Radial_Data; 91typedef struct _Ector_Renderer_Generic_Gradient_Radial_Data Ector_Renderer_Generic_Gradient_Radial_Data;
92typedef struct _Ector_Renderer_Generic_Shape_Data Ector_Renderer_Generic_Shape_Data; 92typedef struct _Ector_Renderer_Generic_Shape_Data Ector_Renderer_Generic_Shape_Data;
93typedef struct _Ector_Renderer_Generic_Buffer_Data Ector_Renderer_Generic_Buffer_Data; 93typedef struct _Ector_Renderer_Generic_Buffer_Data Ector_Renderer_Generic_Buffer_Data;
94typedef struct _Ector_Generic_Buffer_Data Ector_Generic_Buffer_Data;
95 94
96struct _Ector_Renderer_Generic_Base_Data 95struct _Ector_Renderer_Generic_Base_Data
97{ 96{
@@ -110,7 +109,8 @@ struct _Ector_Renderer_Generic_Base_Data
110 Ector_Renderer *mask; 109 Ector_Renderer *mask;
111 110
112 Ector_Quality q; 111 Ector_Quality q;
113 Eina_Bool visibility; 112 Eina_Bool visibility : 1;
113 Eina_Bool finalized : 1;
114}; 114};
115 115
116struct _Ector_Renderer_Generic_Gradient_Data 116struct _Ector_Renderer_Generic_Gradient_Data
@@ -145,14 +145,6 @@ struct _Ector_Renderer_Generic_Shape_Data
145 } stroke; 145 } stroke;
146}; 146};
147 147
148struct _Ector_Generic_Buffer_Data
149{
150 Eo *eo;
151 unsigned int w, h;
152 unsigned char l, r, t, b;
153 Efl_Gfx_Colorspace cspace;
154};
155
156struct _Ector_Renderer_Generic_Buffer_Data 148struct _Ector_Renderer_Generic_Buffer_Data
157{ 149{
158 Ector_Generic_Buffer *eo_buffer; 150 Ector_Generic_Buffer *eo_buffer;
@@ -172,4 +164,6 @@ _renderer_crc_get(Eo *obj, unsigned int crc)
172 return crc; 164 return crc;
173} 165}
174 166
167#include "ector_buffer.h"
168
175#endif 169#endif
diff --git a/src/lib/ector/ector_renderer_base.c b/src/lib/ector/ector_renderer_base.c
index 2b9a594c3e..66423bff9a 100644
--- a/src/lib/ector/ector_renderer_base.c
+++ b/src/lib/ector/ector_renderer_base.c
@@ -7,13 +7,27 @@
7 7
8#include "ector_private.h" 8#include "ector_private.h"
9 9
10#define MY_CLASS ECTOR_RENDERER_GENERIC_BASE_CLASS
11
10static void 12static void
11_ector_renderer_generic_base_eo_base_destructor(Eo *obj, Ector_Renderer_Generic_Base_Data *pd) 13_ector_renderer_generic_base_eo_base_destructor(Eo *obj, Ector_Renderer_Generic_Base_Data *pd)
12{ 14{
13 if (pd->m) free(pd->m); 15 if (pd->m) free(pd->m);
14 eo_unref(pd->surface); 16 eo_unref(pd->surface);
15 17
16 eo_do_super(obj, ECTOR_RENDERER_GENERIC_BASE_CLASS, eo_destructor()); 18 eo_do_super(obj, MY_CLASS, eo_destructor());
19}
20
21static Eo_Base *
22_ector_renderer_generic_base_eo_base_finalize(Eo *obj, Ector_Renderer_Generic_Base_Data *pd)
23{
24 if (!pd->surface)
25 {
26 CRI("surface is not set yet, go fix your code!");
27 return NULL;
28 }
29 pd->finalized = EINA_TRUE;
30 return eo_do_super_ret(obj, MY_CLASS, obj, eo_finalize());
17} 31}
18 32
19static Ector_Generic_Surface * 33static Ector_Generic_Surface *
@@ -25,6 +39,11 @@ _ector_renderer_generic_base_surface_get(Eo *obj EINA_UNUSED, Ector_Renderer_Gen
25static void 39static void
26_ector_renderer_generic_base_surface_set(Eo *obj EINA_UNUSED, Ector_Renderer_Generic_Base_Data *pd, Ector_Generic_Surface *s) 40_ector_renderer_generic_base_surface_set(Eo *obj EINA_UNUSED, Ector_Renderer_Generic_Base_Data *pd, Ector_Generic_Surface *s)
27{ 41{
42 if (pd->finalized)
43 {
44 CRI("surface_set can be called during object creation only!");
45 return;
46 }
28 pd->surface = eo_xref(s, obj); 47 pd->surface = eo_xref(s, obj);
29} 48}
30 49
diff --git a/src/lib/ector/ector_renderer_generic_base.eo b/src/lib/ector/ector_renderer_generic_base.eo
index 8c6ce6e78e..ea9c3abd1b 100644
--- a/src/lib/ector/ector_renderer_generic_base.eo
+++ b/src/lib/ector/ector_renderer_generic_base.eo
@@ -121,6 +121,7 @@ abstract Ector.Renderer.Generic.Base (Eo.Base)
121 } 121 }
122 implements { 122 implements {
123 Eo.Base.destructor; 123 Eo.Base.destructor;
124 Eo.Base.finalize;
124 @virtual .draw; 125 @virtual .draw;
125 @virtual .bounds_get; 126 @virtual .bounds_get;
126 @virtual .done; 127 @virtual .done;
diff --git a/src/lib/ector/ector_renderer_generic_buffer.eo b/src/lib/ector/ector_renderer_generic_buffer.eo
index 94e1ef295e..4d881052ad 100644
--- a/src/lib/ector/ector_renderer_generic_buffer.eo
+++ b/src/lib/ector/ector_renderer_generic_buffer.eo
@@ -1,12 +1,12 @@
1mixin Ector.Renderer.Generic.Buffer (Eo.Base, Efl.Gfx.Fill) 1mixin Ector.Renderer.Generic.Buffer (Ector.Renderer.Generic.Base, Efl.Gfx.Fill)
2{ 2{
3 [[Ector buffers have a default fill set to repeat]] 3 [[Ector buffers have a default fill set to repeat]]
4 eo_prefix: ector_renderer_buffer; 4 eo_prefix: ector_renderer_buffer;
5 legacy_prefix: null; 5 legacy_prefix: null;
6 methods { 6 methods {
7 @property buffer { 7 @property buffer {
8 set {} 8 set { [[Sets the source buffer for this renderer, adds a ref]] }
9 get {} 9 get { [[Return the current source, no ref change]] }
10 values { 10 values {
11 buf: Ector.Generic.Buffer*; 11 buf: Ector.Generic.Buffer*;
12 } 12 }
diff --git a/src/lib/ector/ector_surface.c b/src/lib/ector/ector_surface.c
deleted file mode 100644
index 23ad7eb2fd..0000000000
--- a/src/lib/ector/ector_surface.c
+++ /dev/null
@@ -1,34 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include "config.h"
3#endif
4
5#include <Eina.h>
6#include <Ector.h>
7
8#include "ector_private.h"
9
10typedef struct _Ector_Generic_Surface_Data Ector_Generic_Surface_Data;
11struct _Ector_Generic_Surface_Data
12{
13 int w, h;
14};
15
16void
17_ector_generic_surface_size_set(Eo *obj EINA_UNUSED,
18 Ector_Generic_Surface_Data *pd,
19 int w, int h)
20{
21 pd->w = w;
22 pd->h = h;
23}
24
25void
26_ector_generic_surface_size_get(Eo *obj EINA_UNUSED,
27 Ector_Generic_Surface_Data *pd,
28 int *w, int *h)
29{
30 if (w) *w = pd->w;
31 if (h) *h = pd->h;
32}
33
34#include "ector_generic_surface.eo.c"
diff --git a/src/lib/ector/software/Ector_Software.h b/src/lib/ector/software/Ector_Software.h
index 8e2a92195a..430315a57e 100644
--- a/src/lib/ector/software/Ector_Software.h
+++ b/src/lib/ector/software/Ector_Software.h
@@ -14,6 +14,7 @@ typedef struct _Software_Rasterizer Software_Rasterizer;
14 14
15#include "software/ector_software_surface.eo.h" 15#include "software/ector_software_surface.eo.h"
16#include "software/ector_software_buffer.eo.h" 16#include "software/ector_software_buffer.eo.h"
17#include "software/ector_software_buffer_base.eo.h"
17#include "software/ector_renderer_software_base.eo.h" 18#include "software/ector_renderer_software_base.eo.h"
18#include "software/ector_renderer_software_shape.eo.h" 19#include "software/ector_renderer_software_shape.eo.h"
19#include "software/ector_renderer_software_buffer.eo.h" 20#include "software/ector_renderer_software_buffer.eo.h"
diff --git a/src/lib/ector/software/ector_renderer_software_buffer.c b/src/lib/ector/software/ector_renderer_software_buffer.c
index 2cda7128c2..0eb6fa90aa 100644
--- a/src/lib/ector/software/ector_renderer_software_buffer.c
+++ b/src/lib/ector/software/ector_renderer_software_buffer.c
@@ -34,7 +34,7 @@ _ector_renderer_software_buffer_buffer_get(Eo *obj EINA_UNUSED, Ector_Renderer_S
34EOLIAN static Eina_Bool 34EOLIAN static Eina_Bool
35_ector_renderer_software_buffer_ector_renderer_software_base_fill(Eo *obj, Ector_Renderer_Software_Buffer_Data *pd) 35_ector_renderer_software_buffer_ector_renderer_software_base_fill(Eo *obj, Ector_Renderer_Software_Buffer_Data *pd)
36{ 36{
37 Ector_Software_Buffer *buffer = eo_data_scope_get(obj, ECTOR_SOFTWARE_BUFFER_CLASS); 37 Ector_Software_Buffer *buffer = eo_data_scope_get(obj, ECTOR_SOFTWARE_BUFFER_BASE_MIXIN);
38 ector_software_rasterizer_buffer_set(pd->surface, buffer); 38 ector_software_rasterizer_buffer_set(pd->surface, buffer);
39 return EINA_TRUE; 39 return EINA_TRUE;
40} 40}
@@ -51,7 +51,7 @@ _ector_renderer_software_buffer_ector_renderer_generic_base_prepare(Eo *obj, Ect
51EOLIAN static unsigned int 51EOLIAN static unsigned int
52_ector_renderer_software_buffer_ector_renderer_generic_base_crc_get(Eo *obj, Ector_Renderer_Software_Buffer_Data *pd) 52_ector_renderer_software_buffer_ector_renderer_generic_base_crc_get(Eo *obj, Ector_Renderer_Software_Buffer_Data *pd)
53{ 53{
54 Ector_Software_Buffer_Data *buffer = eo_data_scope_get(pd->eo_buffer, ECTOR_SOFTWARE_BUFFER_CLASS); 54 Ector_Software_Buffer_Base_Data *buffer = eo_data_scope_get(pd->eo_buffer, ECTOR_SOFTWARE_BUFFER_BASE_MIXIN);
55 unsigned int crc; 55 unsigned int crc;
56 56
57 eo_do_super(obj, MY_CLASS, crc = ector_renderer_crc_get()); 57 eo_do_super(obj, MY_CLASS, crc = ector_renderer_crc_get());
diff --git a/src/lib/ector/software/ector_software_buffer.c b/src/lib/ector/software/ector_software_buffer.c
index 4fdbcde947..541417f558 100644
--- a/src/lib/ector/software/ector_software_buffer.c
+++ b/src/lib/ector/software/ector_software_buffer.c
@@ -9,6 +9,9 @@
9#include "ector_private.h" 9#include "ector_private.h"
10#include "ector_software_private.h" 10#include "ector_software_private.h"
11#include "ector_generic_buffer.eo.h" 11#include "ector_generic_buffer.eo.h"
12#include "ector_software_buffer_base.eo.h"
13
14#define MY_CLASS ECTOR_SOFTWARE_BUFFER_CLASS
12 15
13#define fail(fmt, ...) do { ERR(fmt, ##__VA_ARGS__); goto on_fail; } while (0) 16#define fail(fmt, ...) do { ERR(fmt, ##__VA_ARGS__); goto on_fail; } while (0)
14 17
@@ -47,7 +50,7 @@ _pixels_gry8_to_argb_convert(uint32_t *dst, const uint8_t *src, int len)
47} 50}
48 51
49EOLIAN static void 52EOLIAN static void
50_ector_software_buffer_pixels_clear(Eo *obj, Ector_Software_Buffer_Data *pd) 53_ector_software_buffer_base_pixels_clear(Eo *obj, Ector_Software_Buffer_Base_Data *pd)
51{ 54{
52 if (!pd->pixels.u8) 55 if (!pd->pixels.u8)
53 return; 56 return;
@@ -62,11 +65,11 @@ _ector_software_buffer_pixels_clear(Eo *obj, Ector_Software_Buffer_Data *pd)
62} 65}
63 66
64EOLIAN static Eina_Bool 67EOLIAN static Eina_Bool
65_ector_software_buffer_ector_generic_buffer_pixels_set(Eo *obj, Ector_Software_Buffer_Data *pd, 68_ector_software_buffer_base_ector_generic_buffer_pixels_set(Eo *obj, Ector_Software_Buffer_Base_Data *pd,
66 void *pixels, int width, int height, int stride, 69 void *pixels, int width, int height, int stride,
67 Efl_Gfx_Colorspace cspace, Eina_Bool writable, 70 Efl_Gfx_Colorspace cspace, Eina_Bool writable,
68 unsigned char l, unsigned char r, 71 unsigned char l, unsigned char r,
69 unsigned char t, unsigned char b) 72 unsigned char t, unsigned char b)
70{ 73{
71 // safety check 74 // safety check
72 unsigned px = _min_stride_calc(1, cspace); 75 unsigned px = _min_stride_calc(1, cspace);
@@ -86,12 +89,15 @@ _ector_software_buffer_ector_generic_buffer_pixels_set(Eo *obj, Ector_Software_B
86 { 89 {
87 ERR("Invalid stride %u for width %u (+%u+%u) cspace %u. pixels_set failed.", 90 ERR("Invalid stride %u for width %u (+%u+%u) cspace %u. pixels_set failed.",
88 stride, width, l, r, cspace); 91 stride, width, l, r, cspace);
89 _ector_software_buffer_pixels_clear(obj, pd); 92 _ector_software_buffer_base_pixels_clear(obj, pd);
90 return EINA_FALSE; 93 return EINA_FALSE;
91 } 94 }
92 95
96 if ((px > 1) && (stride & (px - 1)))
97 ERR("Stride (%d) is not aligned to the pixel size (%d)", stride, px);
98
93 if (pd->pixels.u8 && (pd->pixels.u8 != pixels)) 99 if (pd->pixels.u8 && (pd->pixels.u8 != pixels))
94 _ector_software_buffer_pixels_clear(obj, pd); 100 _ector_software_buffer_base_pixels_clear(obj, pd);
95 101
96 if (pixels) 102 if (pixels)
97 { 103 {
@@ -105,38 +111,39 @@ _ector_software_buffer_ector_generic_buffer_pixels_set(Eo *obj, Ector_Software_B
105 pd->nofree = EINA_FALSE; 111 pd->nofree = EINA_FALSE;
106 pd->writable = EINA_TRUE; 112 pd->writable = EINA_TRUE;
107 } 113 }
108 pd->generic.w = width; 114 pd->generic->w = width;
109 pd->generic.h = height; 115 pd->generic->h = height;
110 pd->generic.l = l; 116 pd->generic->l = l;
111 pd->generic.r = r; 117 pd->generic->r = r;
112 pd->generic.t = t; 118 pd->generic->t = t;
113 pd->generic.b = b; 119 pd->generic->b = b;
114 pd->generic.cspace = cspace; 120 pd->generic->cspace = cspace;
115 pd->stride = stride; 121 pd->stride = stride;
122 pd->pixel_size = px;
116 return EINA_TRUE; 123 return EINA_TRUE;
117} 124}
118 125
119EOLIAN static uint8_t * 126EOLIAN static uint8_t *
120_ector_software_buffer_ector_generic_buffer_map(Eo *obj EINA_UNUSED, Ector_Software_Buffer_Data *pd, 127_ector_software_buffer_base_ector_generic_buffer_map(Eo *obj EINA_UNUSED, Ector_Software_Buffer_Base_Data *pd,
121 int *offset, unsigned int *length, 128 int *offset, unsigned int *length,
122 Ector_Buffer_Access_Flag mode EINA_UNUSED, 129 Ector_Buffer_Access_Flag mode EINA_UNUSED,
123 unsigned int x, unsigned int y, unsigned int w, unsigned int h, 130 unsigned int x, unsigned int y, unsigned int w, unsigned int h,
124 Efl_Gfx_Colorspace cspace EINA_UNUSED, unsigned int *stride) 131 Efl_Gfx_Colorspace cspace EINA_UNUSED, unsigned int *stride)
125{ 132{
126 int off; 133 int off;
127 134
128 if (!pd->pixels.u8 || !pd->stride) 135 if (!pd->pixels.u8 || !pd->stride)
129 fail("Buffer has no pixel data yet"); 136 fail("Buffer has no pixel data yet");
130 if (cspace != pd->generic.cspace) 137 if (cspace != pd->generic->cspace)
131 fail("Invalid colorspace"); 138 fail("Invalid colorspace");
132 if (!w || !h || ((x + w) > pd->generic.w) || (y + h > pd->generic.h)) 139 if (!w || !h || ((x + w) > pd->generic->w) || (y + h > pd->generic->h))
133 fail("Invalid region requested: wanted %u,%u %ux%u but image is %ux%u", 140 fail("Invalid region requested: wanted %u,%u %ux%u but image is %ux%u",
134 x, y, w, h, pd->generic.w, pd->generic.h); 141 x, y, w, h, pd->generic->w, pd->generic->h);
135 142
136 pd->map_count++; 143 pd->map_count++;
137 off = _min_stride_calc(x + pd->generic.l, pd->generic.cspace) + (pd->stride * (y + pd->generic.t)); 144 off = _min_stride_calc(x + pd->generic->l, pd->generic->cspace) + (pd->stride * (y + pd->generic->t));
138 if (offset) *offset = off; 145 if (offset) *offset = off;
139 if (length) *length = (pd->stride * pd->generic.h) - off; 146 if (length) *length = (pd->stride * pd->generic->h) - off;
140 if (stride) *stride = pd->stride; 147 if (stride) *stride = pd->stride;
141 return pd->pixels.u8; 148 return pd->pixels.u8;
142 149
@@ -148,7 +155,7 @@ on_fail:
148} 155}
149 156
150EOLIAN static void 157EOLIAN static void
151_ector_software_buffer_ector_generic_buffer_unmap(Eo *obj EINA_UNUSED, Ector_Software_Buffer_Data *pd, void *data, int offset EINA_UNUSED, unsigned int length EINA_UNUSED) 158_ector_software_buffer_base_ector_generic_buffer_unmap(Eo *obj EINA_UNUSED, Ector_Software_Buffer_Base_Data *pd, void *data, int offset EINA_UNUSED, unsigned int length EINA_UNUSED)
152{ 159{
153 if (!data) return; 160 if (!data) return;
154 if (data != pd->pixels.u8) 161 if (data != pd->pixels.u8)
@@ -164,35 +171,35 @@ _ector_software_buffer_ector_generic_buffer_unmap(Eo *obj EINA_UNUSED, Ector_Sof
164 pd->map_count--; 171 pd->map_count--;
165} 172}
166 173
167EOLIAN uint8_t * 174EOLIAN static uint8_t *
168_ector_software_buffer_ector_generic_buffer_span_get(Eo *obj EINA_UNUSED, Ector_Software_Buffer_Data *pd, 175_ector_software_buffer_base_ector_generic_buffer_span_get(Eo *obj EINA_UNUSED, Ector_Software_Buffer_Base_Data *pd,
169 int x, int y, unsigned int w, Efl_Gfx_Colorspace cspace, 176 int x, int y, unsigned int w, Efl_Gfx_Colorspace cspace,
170 unsigned int *length) 177 unsigned int *length)
171{ 178{
172 uint8_t *src; 179 uint8_t *src;
173 int len, px; 180 int len, px;
174 181
175 if (!pd->pixels.u8) 182 if (!pd->pixels.u8)
176 fail("No pixel data"); 183 fail("No pixel data");
177 if ((x < -pd->generic.l) || (y < -pd->generic.t) || 184 if ((x < -pd->generic->l) || (y < -pd->generic->t) ||
178 ((unsigned) x > pd->generic.w) || ((unsigned) y > pd->generic.h)) 185 ((unsigned) x > pd->generic->w) || ((unsigned) y > pd->generic->h))
179 fail("Out of bounds"); 186 fail("Out of bounds");
180 if (((unsigned) x + w) > (pd->generic.w + pd->generic.l + pd->generic.r)) 187 if (((unsigned) x + w) > (pd->generic->w + pd->generic->l + pd->generic->r))
181 fail("Requested span too large"); 188 fail("Requested span too large");
182 189
183 px = _min_stride_calc(1, pd->generic.cspace); 190 px = _min_stride_calc(1, pd->generic->cspace);
184 len = _min_stride_calc(w, cspace); 191 len = _min_stride_calc(w, cspace);
185 if (length) *length = len; 192 if (length) *length = len;
186 193
187 src = pd->pixels.u8 + ((pd->generic.t + y) * pd->stride) + (px * (pd->generic.l + x)); 194 src = pd->pixels.u8 + ((pd->generic->t + y) * pd->stride) + (px * (pd->generic->l + x));
188 195
189 if (cspace == pd->generic.cspace) 196 if (cspace == pd->generic->cspace)
190 { 197 {
191 pd->span_free = EINA_FALSE; 198 pd->span_free = EINA_FALSE;
192 return src; 199 return src;
193 } 200 }
194 else if ((cspace == EFL_GFX_COLORSPACE_ARGB8888) && 201 else if ((cspace == EFL_GFX_COLORSPACE_ARGB8888) &&
195 (pd->generic.cspace == EFL_GFX_COLORSPACE_GRY8)) 202 (pd->generic->cspace == EFL_GFX_COLORSPACE_GRY8))
196 { 203 {
197 uint32_t *buf = malloc(len); 204 uint32_t *buf = malloc(len);
198 _pixels_gry8_to_argb_convert(buf, src, w); 205 _pixels_gry8_to_argb_convert(buf, src, w);
@@ -200,7 +207,7 @@ _ector_software_buffer_ector_generic_buffer_span_get(Eo *obj EINA_UNUSED, Ector_
200 return (uint8_t *) buf; 207 return (uint8_t *) buf;
201 } 208 }
202 else if ((cspace == EFL_GFX_COLORSPACE_GRY8) && 209 else if ((cspace == EFL_GFX_COLORSPACE_GRY8) &&
203 (pd->generic.cspace == EFL_GFX_COLORSPACE_ARGB8888)) 210 (pd->generic->cspace == EFL_GFX_COLORSPACE_ARGB8888))
204 { 211 {
205 uint8_t *buf = malloc(len); 212 uint8_t *buf = malloc(len);
206 _pixels_argb_to_gry8_convert(buf, (uint32_t *) src, w); 213 _pixels_argb_to_gry8_convert(buf, (uint32_t *) src, w);
@@ -215,16 +222,16 @@ on_fail:
215 return NULL; 222 return NULL;
216} 223}
217 224
218EOLIAN void 225EOLIAN static void
219_ector_software_buffer_ector_generic_buffer_span_free(Eo *obj EINA_UNUSED, Ector_Software_Buffer_Data *pd, 226_ector_software_buffer_base_ector_generic_buffer_span_free(Eo *obj EINA_UNUSED, Ector_Software_Buffer_Base_Data *pd,
220 uint8_t *data) 227 uint8_t *data)
221{ 228{
222 if (pd->span_free) free(data); 229 if (pd->span_free) free(data);
223 pd->span_free = EINA_FALSE; 230 pd->span_free = EINA_FALSE;
224} 231}
225 232
226EOLIAN static Ector_Buffer_Flag 233EOLIAN static Ector_Buffer_Flag
227_ector_software_buffer_ector_generic_buffer_flags_get(Eo *obj EINA_UNUSED, Ector_Software_Buffer_Data *pd) 234_ector_software_buffer_base_ector_generic_buffer_flags_get(Eo *obj EINA_UNUSED, Ector_Software_Buffer_Base_Data *pd)
228{ 235{
229 return ECTOR_BUFFER_FLAG_CPU_READABLE | 236 return ECTOR_BUFFER_FLAG_CPU_READABLE |
230 ECTOR_BUFFER_FLAG_CPU_READABLE_FAST | 237 ECTOR_BUFFER_FLAG_CPU_READABLE_FAST |
@@ -234,11 +241,24 @@ _ector_software_buffer_ector_generic_buffer_flags_get(Eo *obj EINA_UNUSED, Ector
234 : 0); 241 : 0);
235} 242}
236 243
244EOLIAN static Eo_Base *
245_ector_software_buffer_eo_base_constructor(Eo *obj, void *data EINA_UNUSED)
246{
247 Ector_Software_Buffer_Base_Data *pd;
248 eo_do_super(obj, MY_CLASS, obj = eo_constructor());
249 pd = eo_data_scope_get(obj, ECTOR_SOFTWARE_BUFFER_BASE_MIXIN);
250 pd->generic = eo_data_ref(obj, ECTOR_GENERIC_BUFFER_MIXIN);
251 pd->generic->eo = obj;
252 return obj;
253}
254
237EOLIAN static void 255EOLIAN static void
238_ector_software_buffer_eo_base_destructor(Eo *obj, Ector_Software_Buffer_Data *pd) 256_ector_software_buffer_eo_base_destructor(Eo *obj, void *data EINA_UNUSED)
239{ 257{
240 _ector_software_buffer_pixels_clear(obj, pd); 258 Ector_Software_Buffer_Base_Data *pd = eo_data_scope_get(obj, ECTOR_SOFTWARE_BUFFER_BASE_MIXIN);
241 eo_do_super(obj, ECTOR_SOFTWARE_BUFFER_CLASS, eo_destructor()); 259 _ector_software_buffer_base_pixels_clear(obj, pd);
260 eo_data_unref(obj, pd->generic);
261 eo_do_super(obj, MY_CLASS, eo_destructor());
242 if (pd->map_count) 262 if (pd->map_count)
243 { 263 {
244 ERR("Pixel data is still mapped during destroy! Check your code!"); 264 ERR("Pixel data is still mapped during destroy! Check your code!");
@@ -246,3 +266,4 @@ _ector_software_buffer_eo_base_destructor(Eo *obj, Ector_Software_Buffer_Data *p
246} 266}
247 267
248#include "ector_software_buffer.eo.c" 268#include "ector_software_buffer.eo.c"
269#include "ector_software_buffer_base.eo.c"
diff --git a/src/lib/ector/software/ector_software_buffer.eo b/src/lib/ector/software/ector_software_buffer.eo
index a2e365a72d..1190dce81a 100644
--- a/src/lib/ector/software/ector_software_buffer.eo
+++ b/src/lib/ector/software/ector_software_buffer.eo
@@ -1,19 +1,9 @@
1class Ector.Software.Buffer (Ector.Generic.Buffer) 1class Ector.Software.Buffer (Eo.Base, Ector.Software.Buffer.Base)
2{ 2{
3 [[A buffer in Ector Software is a readable & optionally writable image]]
4 legacy_prefix: null; 3 legacy_prefix: null;
5 methods { 4 data: null;
6 pixels_clear @protected {
7 [[Clear internal pixel buffer]]
8 }
9 }
10 implements { 5 implements {
6 Eo.Base.constructor;
11 Eo.Base.destructor; 7 Eo.Base.destructor;
12 Ector.Generic.Buffer.flags.get;
13 Ector.Generic.Buffer.pixels_set;
14 Ector.Generic.Buffer.span_get;
15 Ector.Generic.Buffer.span_free;
16 Ector.Generic.Buffer.map;
17 Ector.Generic.Buffer.unmap;
18 } 8 }
19} 9}
diff --git a/src/lib/ector/software/ector_software_buffer_base.eo b/src/lib/ector/software/ector_software_buffer_base.eo
new file mode 100644
index 0000000000..d10df04f1d
--- /dev/null
+++ b/src/lib/ector/software/ector_software_buffer_base.eo
@@ -0,0 +1,19 @@
1mixin Ector.Software.Buffer.Base (Ector.Generic.Buffer)
2{
3 [[A buffer in Ector Software is a readable & optionally writable image]]
4 eo_prefix: ector_software_buffer;
5 legacy_prefix: null;
6 methods {
7 pixels_clear @protected {
8 [[Clear internal pixel buffer]]
9 }
10 }
11 implements {
12 Ector.Generic.Buffer.flags.get;
13 Ector.Generic.Buffer.pixels_set;
14 Ector.Generic.Buffer.span_get;
15 Ector.Generic.Buffer.span_free;
16 Ector.Generic.Buffer.map;
17 Ector.Generic.Buffer.unmap;
18 }
19}
diff --git a/src/lib/ector/software/ector_software_private.h b/src/lib/ector/software/ector_software_private.h
index d0ec1323c6..51b856dabc 100644
--- a/src/lib/ector/software/ector_software_private.h
+++ b/src/lib/ector/software/ector_software_private.h
@@ -1,6 +1,7 @@
1#ifndef ECTOR_SOFTWARE_PRIVATE_H_ 1#ifndef ECTOR_SOFTWARE_PRIVATE_H_
2# define ECTOR_SOFTWARE_PRIVATE_H_ 2# define ECTOR_SOFTWARE_PRIVATE_H_
3 3
4#include "Ector_Software.h"
4#include "sw_ft_raster.h" 5#include "sw_ft_raster.h"
5#include "sw_ft_stroker.h" 6#include "sw_ft_stroker.h"
6#include "../ector_private.h" 7#include "../ector_private.h"
@@ -14,9 +15,14 @@ typedef unsigned int uint;
14#endif 15#endif
15 16
16typedef struct _Ector_Software_Surface_Data Ector_Software_Surface_Data; 17typedef struct _Ector_Software_Surface_Data Ector_Software_Surface_Data;
18typedef struct _Ector_Renderer_Software_Base_Data Ector_Renderer_Software_Base_Data;
17 19
18#define CHECK_SOFTWARE(Parent) (!(Parent && Parent->software)) 20#define CHECK_SOFTWARE(Parent) (!(Parent && Parent->software))
19 21
22struct _Ector_Renderer_Software_Base_Data
23{
24};
25
20// Gradient related structure 26// Gradient related structure
21typedef struct _Software_Gradient_Linear_Data 27typedef struct _Software_Gradient_Linear_Data
22{ 28{
@@ -47,30 +53,6 @@ typedef struct _Ector_Renderer_Software_Gradient_Data
47 uint* color_table; 53 uint* color_table;
48} Ector_Renderer_Software_Gradient_Data; 54} Ector_Renderer_Software_Gradient_Data;
49 55
50
51// Rasterizer related structure
52// FIXME: Merge with Ector_Software_Buffer
53typedef struct _Raster_Buffer
54{
55 int width;
56 int height;
57 DATA32 *buffer;
58} Raster_Buffer;
59
60typedef struct _Ector_Software_Buffer_Data
61{
62 Ector_Generic_Buffer_Data generic;
63 union {
64 unsigned int *u32;
65 unsigned char *u8;
66 } pixels;
67 unsigned int stride;
68 unsigned int map_count;
69 Eina_Bool writable : 1;
70 Eina_Bool nofree : 1; // pixel data should not be free()'ed
71 Eina_Bool span_free : 1;
72} Ector_Software_Buffer_Data;
73
74typedef struct _Shape_Rle_Data 56typedef struct _Shape_Rle_Data
75{ 57{
76 Eina_Rectangle bbox; 58 Eina_Rectangle bbox;
@@ -99,8 +81,7 @@ typedef enum _Span_Data_Type {
99 81
100typedef struct _Span_Data 82typedef struct _Span_Data
101{ 83{
102 Raster_Buffer raster_buffer; 84 Ector_Software_Buffer_Base_Data *raster_buffer;
103
104 SW_FT_SpanFunc blend; 85 SW_FT_SpanFunc blend;
105 SW_FT_SpanFunc unclipped_blend; 86 SW_FT_SpanFunc unclipped_blend;
106 87
@@ -114,7 +95,7 @@ typedef struct _Span_Data
114 union { 95 union {
115 DATA32 color; 96 DATA32 color;
116 Ector_Renderer_Software_Gradient_Data *gradient; 97 Ector_Renderer_Software_Gradient_Data *gradient;
117 Ector_Software_Buffer_Data *buffer; 98 Ector_Software_Buffer_Base_Data *buffer;
118 }; 99 };
119} Span_Data; 100} Span_Data;
120 101
diff --git a/src/lib/ector/software/ector_software_rasterizer.c b/src/lib/ector/software/ector_software_rasterizer.c
index e58d611f40..21bcb94683 100644
--- a/src/lib/ector/software/ector_software_rasterizer.c
+++ b/src/lib/ector/software/ector_software_rasterizer.c
@@ -17,17 +17,18 @@ _blend_color_argb(int count, const SW_FT_Span *spans, void *user_data)
17 RGBA_Comp_Func_Solid comp_func; 17 RGBA_Comp_Func_Solid comp_func;
18 Span_Data *data = (Span_Data *)(user_data); 18 Span_Data *data = (Span_Data *)(user_data);
19 uint color, *buffer, *target; 19 uint color, *buffer, *target;
20 const int pix_stride = data->raster_buffer->stride / 4;
20 21
21 // multiply the color with mul_col if any 22 // multiply the color with mul_col if any
22 color = ECTOR_MUL4_SYM(data->color, data->mul_col); 23 color = ECTOR_MUL4_SYM(data->color, data->mul_col);
23 comp_func = ector_comp_func_solid_span_get(data->op, color); 24 comp_func = ector_comp_func_solid_span_get(data->op, color);
24 25
25 // move to the offset location 26 // move to the offset location
26 buffer = data->raster_buffer.buffer + ((data->raster_buffer.width * data->offy) + data->offx); 27 buffer = data->raster_buffer->pixels.u32 + ((pix_stride * data->offy) + data->offx);
27 28
28 while (count--) 29 while (count--)
29 { 30 {
30 target = buffer + ((data->raster_buffer.width * spans->y) + spans->x); 31 target = buffer + ((pix_stride * spans->y) + spans->x);
31 comp_func(target, spans->len, color, spans->coverage); 32 comp_func(target, spans->len, color, spans->coverage);
32 ++spans; 33 ++spans;
33 } 34 }
@@ -45,6 +46,7 @@ _blend_gradient(int count, const SW_FT_Span *spans, void *user_data)
45 src_fetch fetchfunc = NULL; 46 src_fetch fetchfunc = NULL;
46 unsigned int buffer[BLEND_GRADIENT_BUFFER_SIZE], *target, *destbuffer; 47 unsigned int buffer[BLEND_GRADIENT_BUFFER_SIZE], *target, *destbuffer;
47 int length, l; 48 int length, l;
49 const int pix_stride = data->raster_buffer->stride / 4;
48 50
49 //@TODO, Get the proper composition function using ,color, ECTOR_OP etc. 51 //@TODO, Get the proper composition function using ,color, ECTOR_OP etc.
50 if (data->type == LinearGradient) fetchfunc = &fetch_linear_gradient; 52 if (data->type == LinearGradient) fetchfunc = &fetch_linear_gradient;
@@ -56,11 +58,11 @@ _blend_gradient(int count, const SW_FT_Span *spans, void *user_data)
56 comp_func = ector_comp_func_span_get(data->op, data->mul_col, data->gradient->alpha); 58 comp_func = ector_comp_func_span_get(data->op, data->mul_col, data->gradient->alpha);
57 59
58 // move to the offset location 60 // move to the offset location
59 destbuffer = data->raster_buffer.buffer + ((data->raster_buffer.width * data->offy) + data->offx); 61 destbuffer = data->raster_buffer->pixels.u32 + ((pix_stride * data->offy) + data->offx);
60 62
61 while (count--) 63 while (count--)
62 { 64 {
63 target = destbuffer + ((data->raster_buffer.width * spans->y) + spans->x); 65 target = destbuffer + ((pix_stride * spans->y) + spans->x);
64 length = spans->len; 66 length = spans->len;
65 while (length) 67 while (length)
66 { 68 {
@@ -95,30 +97,31 @@ _blend_image_argb(int count, const SW_FT_Span *spans, void *user_data)
95 DATA32 *buffer, *target; 97 DATA32 *buffer, *target;
96 DATA8 *src8; 98 DATA8 *src8;
97 unsigned int l, length, sy = 0; 99 unsigned int l, length, sy = 0;
100 const int pix_stride = data->raster_buffer->stride / 4;
98 101
99#warning FIXME: Image scaling, anyone? 102#warning FIXME: Image scaling, anyone?
100#warning FIXME: Optimize eo call with early call resolution 103#warning FIXME: Optimize eo call with early call resolution
101 104
102 comp_func = ector_comp_func_span_get(data->op, data->mul_col, EINA_TRUE); 105 comp_func = ector_comp_func_span_get(data->op, data->mul_col, EINA_TRUE);
103 106
104 buffer = data->raster_buffer.buffer + ((data->raster_buffer.width * data->offy) + data->offx); 107 buffer = data->raster_buffer->pixels.u32 + ((pix_stride * data->offy) + data->offx);
105 108
106 while (count--) 109 while (count--)
107 { 110 {
108 target = buffer + ((data->raster_buffer.width * spans->y) + spans->x); 111 target = buffer + ((pix_stride * spans->y) + spans->x);
109 length = spans->len; 112 length = spans->len;
110 while (length) 113 while (length)
111 { 114 {
112 l = MIN(length, data->buffer->generic.w); 115 l = MIN(length, data->buffer->generic->w);
113 eo_do(data->buffer->generic.eo, src8 = ector_buffer_span_get(0, sy, l, EFL_GFX_COLORSPACE_ARGB8888, NULL)); 116 eo_do(data->buffer->generic->eo, src8 = ector_buffer_span_get(0, sy, l, EFL_GFX_COLORSPACE_ARGB8888, NULL));
114 comp_func(target, (DATA32 *) src8, l, data->mul_col, spans->coverage); 117 comp_func(target, (DATA32 *) src8, l, data->mul_col, spans->coverage);
115 eo_do(data->buffer->generic.eo, ector_buffer_span_free(src8)); 118 eo_do(data->buffer->generic->eo, ector_buffer_span_free(src8));
116 target += l; 119 target += l;
117 length -= l; 120 length -= l;
118 } 121 }
119 ++spans; 122 ++spans;
120 ++sy; 123 ++sy;
121 if (sy >= data->buffer->generic.h) 124 if (sy >= data->buffer->generic->h)
122 sy = 0; 125 sy = 0;
123 } 126 }
124} 127}
@@ -327,7 +330,7 @@ _adjust_span_fill_methods(Span_Data *spdata)
327 spdata->unclipped_blend = &_blend_gradient; 330 spdata->unclipped_blend = &_blend_gradient;
328 break; 331 break;
329 case Image: 332 case Image:
330 if (spdata->buffer->generic.cspace == EFL_GFX_COLORSPACE_GRY8) 333 if (spdata->buffer->generic->cspace == EFL_GFX_COLORSPACE_GRY8)
331 spdata->unclipped_blend = &_blend_image_gry8; 334 spdata->unclipped_blend = &_blend_image_gry8;
332 else 335 else
333 spdata->unclipped_blend = &_blend_image_argb; 336 spdata->unclipped_blend = &_blend_image_argb;
@@ -362,7 +365,6 @@ void ector_software_rasterizer_init(Software_Rasterizer *rasterizer)
362 SW_FT_Stroker_Set(rasterizer->stroker, 1<<6,SW_FT_STROKER_LINECAP_BUTT,SW_FT_STROKER_LINEJOIN_MITER,0); 365 SW_FT_Stroker_Set(rasterizer->stroker, 1<<6,SW_FT_STROKER_LINECAP_BUTT,SW_FT_STROKER_LINEJOIN_MITER,0);
363 366
364 //initialize the span data. 367 //initialize the span data.
365 rasterizer->fill_data.raster_buffer.buffer = NULL;
366 rasterizer->fill_data.clip.enabled = EINA_FALSE; 368 rasterizer->fill_data.clip.enabled = EINA_FALSE;
367 rasterizer->fill_data.unclipped_blend = 0; 369 rasterizer->fill_data.unclipped_blend = 0;
368 rasterizer->fill_data.blend = 0; 370 rasterizer->fill_data.blend = 0;
@@ -570,7 +572,7 @@ void ector_software_rasterizer_radial_gradient_set(Software_Rasterizer *rasteriz
570void ector_software_rasterizer_buffer_set(Software_Rasterizer *rasterizer, 572void ector_software_rasterizer_buffer_set(Software_Rasterizer *rasterizer,
571 Ector_Software_Buffer *buffer) 573 Ector_Software_Buffer *buffer)
572{ 574{
573 rasterizer->fill_data.buffer = eo_data_scope_get(buffer, ECTOR_SOFTWARE_BUFFER_CLASS); 575 rasterizer->fill_data.buffer = eo_data_scope_get(buffer, ECTOR_SOFTWARE_BUFFER_BASE_MIXIN);
574 rasterizer->fill_data.type = Image; 576 rasterizer->fill_data.type = Image;
575} 577}
576 578
diff --git a/src/lib/ector/software/ector_software_surface.c b/src/lib/ector/software/ector_software_surface.c
index 4767e4e654..bdd0599610 100644
--- a/src/lib/ector/software/ector_software_surface.c
+++ b/src/lib/ector/software/ector_software_surface.c
@@ -8,10 +8,7 @@
8#include "ector_private.h" 8#include "ector_private.h"
9#include "ector_software_private.h" 9#include "ector_software_private.h"
10 10
11typedef struct _Ector_Renderer_Software_Base_Data Ector_Renderer_Software_Base_Data; 11#define MY_CLASS ECTOR_SOFTWARE_SURFACE_CLASS
12struct _Ector_Renderer_Software_Base_Data
13{
14};
15 12
16static Ector_Renderer * 13static Ector_Renderer *
17_ector_software_surface_ector_generic_surface_renderer_factory_new(Eo *obj, 14_ector_software_surface_ector_generic_surface_renderer_factory_new(Eo *obj,
@@ -34,56 +31,21 @@ _ector_software_surface_ector_generic_surface_renderer_factory_new(Eo *obj,
34 return NULL; 31 return NULL;
35} 32}
36 33
37static void
38_ector_software_surface_context_set(Eo *obj EINA_UNUSED,
39 Ector_Software_Surface_Data *pd,
40 Software_Rasterizer *ctx)
41{
42 pd->software = ctx;
43}
44
45static Software_Rasterizer *
46_ector_software_surface_context_get(Eo *obj EINA_UNUSED,
47 Ector_Software_Surface_Data *pd)
48{
49 return pd->software;
50}
51
52void
53_ector_software_surface_surface_set(Eo *obj EINA_UNUSED,
54 Ector_Software_Surface_Data *pd,
55 void *pixels, unsigned int width, unsigned int height)
56{
57 pd->software->fill_data.raster_buffer.buffer = pixels;
58 pd->software->fill_data.raster_buffer.width = width;
59 pd->software->fill_data.raster_buffer.height = height;
60}
61
62void
63_ector_software_surface_surface_get(Eo *obj EINA_UNUSED,
64 Ector_Software_Surface_Data *pd,
65 void **pixels, unsigned int *width, unsigned int *height)
66{
67 *pixels = pd->software->fill_data.raster_buffer.buffer;
68 *width = pd->software->fill_data.raster_buffer.width;
69 *height = pd->software->fill_data.raster_buffer.height;
70}
71
72static Eo * 34static Eo *
73_ector_software_surface_eo_base_constructor(Eo *obj, 35_ector_software_surface_eo_base_constructor(Eo *obj, Ector_Software_Surface_Data *pd)
74 Ector_Software_Surface_Data *pd EINA_UNUSED)
75{ 36{
76 obj = eo_do_super_ret(obj, ECTOR_SOFTWARE_SURFACE_CLASS, obj, eo_constructor()); 37 obj = eo_do_super_ret(obj, MY_CLASS, obj, eo_constructor());
77 pd->software = (Software_Rasterizer *) calloc(1, sizeof(Software_Rasterizer)); 38 pd->software = (Software_Rasterizer *) calloc(1, sizeof(Software_Rasterizer));
78 ector_software_rasterizer_init(pd->software); 39 ector_software_rasterizer_init(pd->software);
79 return obj; 40 pd->software->fill_data.raster_buffer = eo_data_ref(obj, ECTOR_SOFTWARE_BUFFER_BASE_MIXIN);
41 return obj;
80} 42}
81 43
82static void 44static void
83_ector_software_surface_eo_base_destructor(Eo *obj EINA_UNUSED, 45_ector_software_surface_eo_base_destructor(Eo *obj, Ector_Software_Surface_Data *pd)
84 Ector_Software_Surface_Data *pd EINA_UNUSED)
85{ 46{
86 ector_software_rasterizer_done(pd->software); 47 ector_software_rasterizer_done(pd->software);
48 eo_data_unref(obj, pd->software->fill_data.raster_buffer);
87 free(pd->software); 49 free(pd->software);
88 pd->software = NULL; 50 pd->software = NULL;
89 eo_do_super(obj, ECTOR_SOFTWARE_SURFACE_CLASS, eo_destructor()); 51 eo_do_super(obj, ECTOR_SOFTWARE_SURFACE_CLASS, eo_destructor());
diff --git a/src/lib/ector/software/ector_software_surface.eo b/src/lib/ector/software/ector_software_surface.eo
index bea11cd9cf..34507e6549 100644
--- a/src/lib/ector/software/ector_software_surface.eo
+++ b/src/lib/ector/software/ector_software_surface.eo
@@ -1,30 +1,8 @@
1class Ector.Software.Surface (Ector.Generic.Surface) 1class Ector.Software.Surface (Ector.Software.Buffer, Ector.Generic.Surface)
2{ 2{
3 eo_prefix: ector_software_surface; 3 eo_prefix: ector_software_surface;
4 legacy_prefix: null; 4 legacy_prefix: null;
5 methods { 5 methods {}
6 @property context {
7 set {
8 }
9 get {
10 }
11 values {
12 ctx: Software_Rasterizer *;
13 }
14 }
15 @property surface {
16 set {
17 }
18 get {
19 }
20 values {
21 pixels: void *;
22 width: uint;
23 height: uint;
24 }
25 }
26 }
27
28 implements { 6 implements {
29 Ector.Generic.Surface.renderer_factory_new; 7 Ector.Generic.Surface.renderer_factory_new;
30 Ector.Generic.Surface.reference_point.set; 8 Ector.Generic.Surface.reference_point.set;
diff --git a/src/modules/evas/engines/gl_generic/ector_cairo_software_surface.eo b/src/modules/evas/engines/gl_generic/ector_cairo_software_surface.eo
index 2c470425b8..8d4e789bfe 100644
--- a/src/modules/evas/engines/gl_generic/ector_cairo_software_surface.eo
+++ b/src/modules/evas/engines/gl_generic/ector_cairo_software_surface.eo
@@ -1,18 +1,11 @@
1class Ector.Cairo_Software.Surface (Ector.Cairo.Surface) 1class Ector.Cairo_Software.Surface (Ector.Cairo.Surface, Ector.Software.Buffer.Base)
2{ 2{
3 eo_prefix: ector_cairo_software_surface; 3 eo_prefix: ector_cairo_software_surface;
4 legacy_prefix: null; 4 legacy_prefix: null;
5 methods { 5 methods {}
6 @property surface { 6 implements {
7 set { 7 Ector.Generic.Buffer.pixels_set;
8 } 8 Eo.Base.constructor;
9 get { 9 Eo.Base.destructor;
10 }
11 values {
12 pixels: void *;
13 width: uint;
14 height: uint;
15 }
16 }
17 } 10 }
18} 11}
diff --git a/src/modules/evas/engines/gl_generic/ector_surface.c b/src/modules/evas/engines/gl_generic/ector_surface.c
index 01e3c5de0d..2d4658abaf 100644
--- a/src/modules/evas/engines/gl_generic/ector_surface.c
+++ b/src/modules/evas/engines/gl_generic/ector_surface.c
@@ -4,12 +4,15 @@
4 4
5#include <Ector.h> 5#include <Ector.h>
6 6
7#include "cairo/Ector_Cairo.h" 7#include <cairo/Ector_Cairo.h>
8#include "software/Ector_Software.h" 8#include <software/Ector_Software.h>
9 9
10#include "evas_common_private.h" 10#include "evas_common_private.h"
11#include "evas_private.h" 11#include "evas_private.h"
12#include "ector_cairo_software_surface.eo.h" 12#include "ector_cairo_software_surface.eo.h"
13#include "ector_buffer.h"
14
15#define MY_CLASS ECTOR_CAIRO_SOFTWARE_SURFACE_CLASS
13 16
14#define USE(Obj, Sym, Error) \ 17#define USE(Obj, Sym, Error) \
15 if (!Sym) Sym = _ector_cairo_symbol_get(Obj, #Sym); \ 18 if (!Sym) Sym = _ector_cairo_symbol_get(Obj, #Sym); \
@@ -49,55 +52,76 @@ typedef struct _Ector_Cairo_Software_Surface_Data Ector_Cairo_Software_Surface_D
49struct _Ector_Cairo_Software_Surface_Data 52struct _Ector_Cairo_Software_Surface_Data
50{ 53{
51 cairo_surface_t *surface; 54 cairo_surface_t *surface;
52 cairo_t *ctx; 55 Ector_Software_Buffer_Base_Data *base;
53
54 void *pixels;
55
56 unsigned int width;
57 unsigned int height;
58}; 56};
59 57
60static void 58EOLIAN static Eina_Bool
61_ector_cairo_software_surface_surface_set(Eo *obj, Ector_Cairo_Software_Surface_Data *pd, void *pixels, unsigned int width, unsigned int height) 59_ector_cairo_software_surface_ector_generic_buffer_pixels_set(Eo *obj, Ector_Cairo_Software_Surface_Data *pd,
60 void *pixels, int width, int height, int stride,
61 Efl_Gfx_Colorspace cspace, Eina_Bool writable,
62 unsigned char l, unsigned char r, unsigned char t, unsigned char b)
62{ 63{
63 USE(obj, cairo_image_surface_create_for_data, ); 64 cairo_t *ctx = NULL;
64 USE(obj, cairo_surface_destroy, ); 65 Eina_Bool ok = EINA_FALSE;
65 USE(obj, cairo_create, ); 66
66 USE(obj, cairo_destroy, ); 67 if ((cspace != EFL_GFX_COLORSPACE_ARGB8888) || !writable)
68 {
69 ERR("Unsupported surface type!");
70 return EINA_FALSE;
71 }
72
73 USE(obj, cairo_image_surface_create_for_data, EINA_FALSE);
74 USE(obj, cairo_surface_destroy, EINA_FALSE);
75 USE(obj, cairo_create, EINA_FALSE);
76 USE(obj, cairo_destroy, EINA_FALSE);
67 77
68 if (pd->surface) cairo_surface_destroy(pd->surface); pd->surface = NULL; 78 if (pd->surface)
69 if (pd->ctx) cairo_destroy(pd->ctx); pd->ctx = NULL; 79 cairo_surface_destroy(pd->surface);
80 pd->surface = NULL;
70 81
71 pd->pixels = NULL; 82 eo_do_super(obj, MY_CLASS,
72 pd->width = 0; 83 ok = ector_buffer_pixels_set(pixels, width, height, stride,
73 pd->height = 0; 84 cspace, writable, l, r, t, b));
74 85
75 if (pixels) 86 if (ok && pixels)
76 { 87 {
77 pd->surface = cairo_image_surface_create_for_data(pixels, 88 pd->surface = cairo_image_surface_create_for_data(pixels,
78 CAIRO_FORMAT_ARGB32, 89 CAIRO_FORMAT_ARGB32,
79 width, height, width); 90 width, height, pd->base->stride);
80 if (!pd->surface) goto end; 91 if (!pd->surface) goto end;
81 92
82 pd->ctx = cairo_create(pd->surface); 93 ctx = cairo_create(pd->surface);
83 if (!pd->ctx) goto end;
84 } 94 }
85 pd->pixels = pixels;
86 pd->width = width;
87 pd->height = height;
88 95
89 end: 96 end:
90 eo_do(obj, 97 evas_common_cpu_end_opt();
91 ector_cairo_surface_context_set(pd->ctx), 98 eo_do(obj, ector_cairo_surface_context_set(ctx));
92 ector_surface_size_set(pd->width, pd->height)); 99 return ok;
93} 100}
94 101
95static void 102void
96_ector_cairo_software_surface_surface_get(Eo *obj EINA_UNUSED, Ector_Cairo_Software_Surface_Data *pd, void **pixels, unsigned int *width, unsigned int *height) 103_ector_cairo_software_surface_surface_get(Eo *obj EINA_UNUSED, Ector_Cairo_Software_Surface_Data *pd, void **pixels, unsigned int *width, unsigned int *height)
97{ 104{
98 if (pixels) *pixels = pd->pixels; 105 if (pixels) *pixels = pd->base->pixels.u8;
99 if (width) *width = pd->width; 106 if (width) *width = pd->base->generic->w;
100 if (height) *height = pd->height; 107 if (height) *height = pd->base->generic->h;
108}
109
110static Eo_Base *
111_ector_cairo_software_surface_eo_base_constructor(Eo *obj, Ector_Cairo_Software_Surface_Data *pd)
112{
113 eo_do_super(obj, MY_CLASS, obj = eo_constructor());
114 pd->base = eo_data_ref(obj, ECTOR_SOFTWARE_BUFFER_BASE_MIXIN);
115 pd->base->generic = eo_data_ref(obj, ECTOR_GENERIC_BUFFER_MIXIN);
116 pd->base->generic->eo = obj;
117 return obj;
118}
119
120EOLIAN static void
121_ector_cairo_software_surface_eo_base_destructor(Eo *obj, Ector_Cairo_Software_Surface_Data *pd)
122{
123 eo_data_unref(obj, pd->base);
124 eo_do_super(obj, MY_CLASS, eo_destructor());
101} 125}
102 126
103#include "ector_cairo_software_surface.eo.c" 127#include "ector_cairo_software_surface.eo.c"
diff --git a/src/modules/evas/engines/gl_generic/evas_engine.c b/src/modules/evas/engines/gl_generic/evas_engine.c
index d9b42eaf3d..8771d75ef7 100644
--- a/src/modules/evas/engines/gl_generic/evas_engine.c
+++ b/src/modules/evas/engines/gl_generic/evas_engine.c
@@ -2601,18 +2601,10 @@ eng_ector_begin(void *data, void *context EINA_UNUSED, Ector_Surface *ector,
2601 } 2601 }
2602 } 2602 }
2603 memset(buffer->software, 0, sizeof (unsigned int) * w * h); 2603 memset(buffer->software, 0, sizeof (unsigned int) * w * h);
2604 if (use_cairo) 2604 eo_do(ector,
2605 { 2605 ector_buffer_pixels_set(buffer->software, w, h, 0, EFL_GFX_COLORSPACE_ARGB8888,
2606 eo_do(ector, 2606 EINA_TRUE, 0, 0, 0, 0),
2607 ector_cairo_software_surface_set(buffer->software, w, h), 2607 ector_surface_reference_point_set(x, y));
2608 ector_surface_reference_point_set(x, y));
2609 }
2610 else
2611 {
2612 eo_do(ector,
2613 ector_software_surface_set(buffer->software, w, h),
2614 ector_surface_reference_point_set(x, y));
2615 }
2616} 2608}
2617 2609
2618static void 2610static void
@@ -2630,17 +2622,7 @@ eng_ector_end(void *data, void *context EINA_UNUSED, Ector_Surface *ector,
2630 w = gl_context->w; h = gl_context->h; 2622 w = gl_context->w; h = gl_context->h;
2631 mul_use = gl_context->dc->mul.use; 2623 mul_use = gl_context->dc->mul.use;
2632 2624
2633 if (use_cairo) 2625 eo_do(ector, ector_buffer_pixels_set(NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0));
2634 {
2635 eo_do(ector,
2636 ector_cairo_software_surface_set(NULL, 0, 0));
2637 }
2638 else
2639 {
2640 eo_do(ector,
2641 ector_software_surface_set(NULL, 0, 0));
2642 }
2643
2644 eng_image_data_put(data, buffer->gl, buffer->software); 2626 eng_image_data_put(data, buffer->gl, buffer->software);
2645 2627
2646 if (!mul_use) 2628 if (!mul_use)
diff --git a/src/modules/evas/engines/software_generic/ector_cairo_software_surface.eo b/src/modules/evas/engines/software_generic/ector_cairo_software_surface.eo
index 2c470425b8..8d4e789bfe 100644
--- a/src/modules/evas/engines/software_generic/ector_cairo_software_surface.eo
+++ b/src/modules/evas/engines/software_generic/ector_cairo_software_surface.eo
@@ -1,18 +1,11 @@
1class Ector.Cairo_Software.Surface (Ector.Cairo.Surface) 1class Ector.Cairo_Software.Surface (Ector.Cairo.Surface, Ector.Software.Buffer.Base)
2{ 2{
3 eo_prefix: ector_cairo_software_surface; 3 eo_prefix: ector_cairo_software_surface;
4 legacy_prefix: null; 4 legacy_prefix: null;
5 methods { 5 methods {}
6 @property surface { 6 implements {
7 set { 7 Ector.Generic.Buffer.pixels_set;
8 } 8 Eo.Base.constructor;
9 get { 9 Eo.Base.destructor;
10 }
11 values {
12 pixels: void *;
13 width: uint;
14 height: uint;
15 }
16 }
17 } 10 }
18} 11}
diff --git a/src/modules/evas/engines/software_generic/ector_surface.c b/src/modules/evas/engines/software_generic/ector_surface.c
index ffa32313b6..2d4658abaf 100644
--- a/src/modules/evas/engines/software_generic/ector_surface.c
+++ b/src/modules/evas/engines/software_generic/ector_surface.c
@@ -10,6 +10,9 @@
10#include "evas_common_private.h" 10#include "evas_common_private.h"
11#include "evas_private.h" 11#include "evas_private.h"
12#include "ector_cairo_software_surface.eo.h" 12#include "ector_cairo_software_surface.eo.h"
13#include "ector_buffer.h"
14
15#define MY_CLASS ECTOR_CAIRO_SOFTWARE_SURFACE_CLASS
13 16
14#define USE(Obj, Sym, Error) \ 17#define USE(Obj, Sym, Error) \
15 if (!Sym) Sym = _ector_cairo_symbol_get(Obj, #Sym); \ 18 if (!Sym) Sym = _ector_cairo_symbol_get(Obj, #Sym); \
@@ -49,57 +52,76 @@ typedef struct _Ector_Cairo_Software_Surface_Data Ector_Cairo_Software_Surface_D
49struct _Ector_Cairo_Software_Surface_Data 52struct _Ector_Cairo_Software_Surface_Data
50{ 53{
51 cairo_surface_t *surface; 54 cairo_surface_t *surface;
52 55 Ector_Software_Buffer_Base_Data *base;
53 void *pixels;
54
55 unsigned int width;
56 unsigned int height;
57}; 56};
58 57
59void 58EOLIAN static Eina_Bool
60_ector_cairo_software_surface_surface_set(Eo *obj, Ector_Cairo_Software_Surface_Data *pd, void *pixels, unsigned int width, unsigned int height) 59_ector_cairo_software_surface_ector_generic_buffer_pixels_set(Eo *obj, Ector_Cairo_Software_Surface_Data *pd,
60 void *pixels, int width, int height, int stride,
61 Efl_Gfx_Colorspace cspace, Eina_Bool writable,
62 unsigned char l, unsigned char r, unsigned char t, unsigned char b)
61{ 63{
62 cairo_t *ctx = NULL; 64 cairo_t *ctx = NULL;
65 Eina_Bool ok = EINA_FALSE;
63 66
64 USE(obj, cairo_image_surface_create_for_data, ); 67 if ((cspace != EFL_GFX_COLORSPACE_ARGB8888) || !writable)
65 USE(obj, cairo_surface_destroy, ); 68 {
66 USE(obj, cairo_create, ); 69 ERR("Unsupported surface type!");
67 USE(obj, cairo_destroy, ); 70 return EINA_FALSE;
71 }
68 72
69 if (pd->surface) cairo_surface_destroy(pd->surface); pd->surface = NULL; 73 USE(obj, cairo_image_surface_create_for_data, EINA_FALSE);
74 USE(obj, cairo_surface_destroy, EINA_FALSE);
75 USE(obj, cairo_create, EINA_FALSE);
76 USE(obj, cairo_destroy, EINA_FALSE);
70 77
71 pd->pixels = NULL; 78 if (pd->surface)
72 pd->width = 0; 79 cairo_surface_destroy(pd->surface);
73 pd->height = 0; 80 pd->surface = NULL;
74 81
75 if (pixels) 82 eo_do_super(obj, MY_CLASS,
83 ok = ector_buffer_pixels_set(pixels, width, height, stride,
84 cspace, writable, l, r, t, b));
85
86 if (ok && pixels)
76 { 87 {
77 pd->surface = cairo_image_surface_create_for_data(pixels, 88 pd->surface = cairo_image_surface_create_for_data(pixels,
78 CAIRO_FORMAT_ARGB32, 89 CAIRO_FORMAT_ARGB32,
79 width, height, width * sizeof (int)); 90 width, height, pd->base->stride);
80 if (!pd->surface) goto end; 91 if (!pd->surface) goto end;
81 92
82 ctx = cairo_create(pd->surface); 93 ctx = cairo_create(pd->surface);
83 } 94 }
84 95
85 pd->pixels = pixels;
86 pd->width = width;
87 pd->height = height;
88
89 end: 96 end:
90 evas_common_cpu_end_opt(); 97 evas_common_cpu_end_opt();
91 98 eo_do(obj, ector_cairo_surface_context_set(ctx));
92 eo_do(obj, 99 return ok;
93 ector_cairo_surface_context_set(ctx),
94 ector_surface_size_set(pd->width, pd->height));
95} 100}
96 101
97void 102void
98_ector_cairo_software_surface_surface_get(Eo *obj EINA_UNUSED, Ector_Cairo_Software_Surface_Data *pd, void **pixels, unsigned int *width, unsigned int *height) 103_ector_cairo_software_surface_surface_get(Eo *obj EINA_UNUSED, Ector_Cairo_Software_Surface_Data *pd, void **pixels, unsigned int *width, unsigned int *height)
99{ 104{
100 if (pixels) *pixels = pd->pixels; 105 if (pixels) *pixels = pd->base->pixels.u8;
101 if (width) *width = pd->width; 106 if (width) *width = pd->base->generic->w;
102 if (height) *height = pd->height; 107 if (height) *height = pd->base->generic->h;
108}
109
110static Eo_Base *
111_ector_cairo_software_surface_eo_base_constructor(Eo *obj, Ector_Cairo_Software_Surface_Data *pd)
112{
113 eo_do_super(obj, MY_CLASS, obj = eo_constructor());
114 pd->base = eo_data_ref(obj, ECTOR_SOFTWARE_BUFFER_BASE_MIXIN);
115 pd->base->generic = eo_data_ref(obj, ECTOR_GENERIC_BUFFER_MIXIN);
116 pd->base->generic->eo = obj;
117 return obj;
118}
119
120EOLIAN static void
121_ector_cairo_software_surface_eo_base_destructor(Eo *obj, Ector_Cairo_Software_Surface_Data *pd)
122{
123 eo_data_unref(obj, pd->base);
124 eo_do_super(obj, MY_CLASS, eo_destructor());
103} 125}
104 126
105#include "ector_cairo_software_surface.eo.c" 127#include "ector_cairo_software_surface.eo.c"
diff --git a/src/modules/evas/engines/software_generic/evas_engine.c b/src/modules/evas/engines/software_generic/evas_engine.c
index e148813c89..d1a48f8630 100644
--- a/src/modules/evas/engines/software_generic/evas_engine.c
+++ b/src/modules/evas/engines/software_generic/evas_engine.c
@@ -406,7 +406,7 @@ struct _Evas_Thread_Command_Ector
406struct _Evas_Thread_Command_Ector_Surface 406struct _Evas_Thread_Command_Ector_Surface
407{ 407{
408 Ector_Surface *ector; 408 Ector_Surface *ector;
409 void *surface; 409 void *pixels;
410 int x, y; 410 int x, y;
411}; 411};
412 412
@@ -3884,7 +3884,7 @@ static void
3884_draw_thread_ector_surface_set(void *data) 3884_draw_thread_ector_surface_set(void *data)
3885{ 3885{
3886 Evas_Thread_Command_Ector_Surface *ector_surface = data; 3886 Evas_Thread_Command_Ector_Surface *ector_surface = data;
3887 RGBA_Image *surface = ector_surface->surface; 3887 RGBA_Image *surface = ector_surface->pixels;
3888 void *pixels = NULL; 3888 void *pixels = NULL;
3889 unsigned int w = 0; 3889 unsigned int w = 0;
3890 unsigned int h = 0; 3890 unsigned int h = 0;
@@ -3903,18 +3903,10 @@ _draw_thread_ector_surface_set(void *data)
3903 y = ector_surface->y; 3903 y = ector_surface->y;
3904 } 3904 }
3905 3905
3906 if (use_cairo) 3906 eo_do(ector_surface->ector,
3907 { 3907 ector_buffer_pixels_set(pixels, w, h, 0, EFL_GFX_COLORSPACE_ARGB8888,
3908 eo_do(ector_surface->ector, 3908 EINA_TRUE, 0, 0, 0, 0),
3909 ector_cairo_software_surface_set(pixels, w, h), 3909 ector_surface_reference_point_set(x, y));
3910 ector_surface_reference_point_set(x, y));
3911 }
3912 else
3913 {
3914 eo_do(ector_surface->ector,
3915 ector_software_surface_set(pixels, w, h),
3916 ector_surface_reference_point_set(x, y));
3917 }
3918 3910
3919 eina_mempool_free(_mp_command_ector_surface, ector_surface); 3911 eina_mempool_free(_mp_command_ector_surface, ector_surface);
3920} 3912}
@@ -3941,7 +3933,7 @@ eng_ector_begin(void *data EINA_UNUSED, void *context EINA_UNUSED, Ector_Surface
3941 if (!nes) return ; 3933 if (!nes) return ;
3942 3934
3943 nes->ector = ector; 3935 nes->ector = ector;
3944 nes->surface = surface; 3936 nes->pixels = surface;
3945 nes->x = x; 3937 nes->x = x;
3946 nes->y = y; 3938 nes->y = y;
3947 3939
@@ -3958,18 +3950,10 @@ eng_ector_begin(void *data EINA_UNUSED, void *context EINA_UNUSED, Ector_Surface
3958 w = sf->cache_entry.w; 3950 w = sf->cache_entry.w;
3959 h = sf->cache_entry.h; 3951 h = sf->cache_entry.h;
3960 3952
3961 if (use_cairo) 3953 eo_do(ector,
3962 { 3954 ector_buffer_pixels_set(pixels, w, h, 0, EFL_GFX_COLORSPACE_ARGB8888,
3963 eo_do(ector, 3955 EINA_TRUE, 0, 0, 0, 0),
3964 ector_cairo_software_surface_set(pixels, w, h), 3956 ector_surface_reference_point_set(x, y));
3965 ector_surface_reference_point_set(x, y));
3966 }
3967 else
3968 {
3969 eo_do(ector,
3970 ector_software_surface_set(pixels, w, h),
3971 ector_surface_reference_point_set(x, y));
3972 }
3973 } 3957 }
3974} 3958}
3975 3959
@@ -3984,23 +3968,13 @@ eng_ector_end(void *data EINA_UNUSED, void *context EINA_UNUSED, Ector_Surface *
3984 if (!nes) return ; 3968 if (!nes) return ;
3985 3969
3986 nes->ector = ector; 3970 nes->ector = ector;
3987 nes->surface = NULL; 3971 nes->pixels = NULL;
3988 3972
3989 QCMD(_draw_thread_ector_surface_set, nes); 3973 QCMD(_draw_thread_ector_surface_set, nes);
3990 } 3974 }
3991 else 3975 else
3992 { 3976 {
3993 if (use_cairo) 3977 eo_do(ector, ector_renderer_surface_set(NULL));
3994 {
3995 eo_do(ector,
3996 ector_cairo_software_surface_set(NULL, 0, 0));
3997 }
3998 else
3999 {
4000 eo_do(ector,
4001 ector_software_surface_set(NULL, 0, 0));
4002 }
4003
4004 evas_common_cpu_end_opt(); 3978 evas_common_cpu_end_opt();
4005 } 3979 }
4006} 3980}