summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Makefile_Ector.am9
-rw-r--r--src/lib/ector/ector_generic_buffer.c50
-rw-r--r--src/lib/ector/ector_generic_buffer.eo132
-rw-r--r--src/lib/ector/ector_private.h40
-rw-r--r--src/lib/ector/ector_renderer.h1
-rw-r--r--src/lib/ector/ector_renderer_base.c2
-rw-r--r--src/lib/ector/ector_renderer_generic_buffer.c68
-rw-r--r--src/lib/ector/ector_renderer_generic_buffer.eo22
-rw-r--r--src/lib/ector/ector_renderer_shape.c6
-rw-r--r--src/lib/ector/ector_surface.h1
-rw-r--r--src/lib/ector/software/Ector_Software.h2
-rw-r--r--src/lib/ector/software/ector_renderer_software_buffer.c72
-rw-r--r--src/lib/ector/software/ector_renderer_software_buffer.eo19
-rw-r--r--src/lib/ector/software/ector_software_buffer.c248
-rw-r--r--src/lib/ector/software/ector_software_buffer.eo19
-rw-r--r--src/lib/ector/software/ector_software_private.h19
-rw-r--r--src/lib/ector/software/ector_software_rasterizer.c60
-rw-r--r--src/lib/ector/software/ector_software_surface.c3
-rw-r--r--src/lib/efl/interfaces/efl_gfx_base.eo5
19 files changed, 767 insertions, 11 deletions
diff --git a/src/Makefile_Ector.am b/src/Makefile_Ector.am
index f6fe1e1..b6cda51 100644
--- a/src/Makefile_Ector.am
+++ b/src/Makefile_Ector.am
@@ -2,8 +2,10 @@
2### Library 2### Library
3ector_eolian_files_generic = \ 3ector_eolian_files_generic = \
4 lib/ector/ector_generic_surface.eo \ 4 lib/ector/ector_generic_surface.eo \
5 lib/ector/ector_generic_buffer.eo \
5 lib/ector/ector_renderer_generic_base.eo \ 6 lib/ector/ector_renderer_generic_base.eo \
6 lib/ector/ector_renderer_generic_shape.eo \ 7 lib/ector/ector_renderer_generic_shape.eo \
8 lib/ector/ector_renderer_generic_buffer.eo \
7 lib/ector/ector_renderer_generic_gradient.eo \ 9 lib/ector/ector_renderer_generic_gradient.eo \
8 lib/ector/ector_renderer_generic_gradient_radial.eo \ 10 lib/ector/ector_renderer_generic_gradient_radial.eo \
9 lib/ector/ector_renderer_generic_gradient_linear.eo 11 lib/ector/ector_renderer_generic_gradient_linear.eo
@@ -21,8 +23,10 @@ ector_eolian_cairo_h = $(ector_eolian_files_cairo:%.eo=%.eo.h)
21# Handle default software backend 23# Handle default software backend
22ector_eolian_files_software = \ 24ector_eolian_files_software = \
23 lib/ector/software/ector_software_surface.eo \ 25 lib/ector/software/ector_software_surface.eo \
26 lib/ector/software/ector_software_buffer.eo \
24 lib/ector/software/ector_renderer_software_base.eo \ 27 lib/ector/software/ector_renderer_software_base.eo \
25 lib/ector/software/ector_renderer_software_shape.eo \ 28 lib/ector/software/ector_renderer_software_shape.eo \
29 lib/ector/software/ector_renderer_software_buffer.eo \
26 lib/ector/software/ector_renderer_software_gradient_radial.eo \ 30 lib/ector/software/ector_renderer_software_gradient_radial.eo \
27 lib/ector/software/ector_renderer_software_gradient_linear.eo 31 lib/ector/software/ector_renderer_software_gradient_linear.eo
28ector_eolian_software_h = $(ector_eolian_files_software:%.eo=%.eo.h) 32ector_eolian_software_h = $(ector_eolian_files_software:%.eo=%.eo.h)
@@ -64,8 +68,10 @@ lib/ector/software/Ector_Software.h
64lib_ector_libector_la_SOURCES = \ 68lib_ector_libector_la_SOURCES = \
65lib/ector/ector_main.c \ 69lib/ector/ector_main.c \
66lib/ector/ector_surface.c \ 70lib/ector/ector_surface.c \
71lib/ector/ector_generic_buffer.c \
67lib/ector/ector_renderer_shape.c \ 72lib/ector/ector_renderer_shape.c \
68lib/ector/ector_renderer_base.c \ 73lib/ector/ector_renderer_base.c \
74lib/ector/ector_renderer_generic_buffer.c \
69lib/ector/ector_renderer_gradient.c \ 75lib/ector/ector_renderer_gradient.c \
70lib/ector/ector_renderer_gradient_radial.c \ 76lib/ector/ector_renderer_gradient_radial.c \
71lib/ector/ector_renderer_gradient_linear.c 77lib/ector/ector_renderer_gradient_linear.c
@@ -89,9 +95,11 @@ lib_ector_libector_la_SOURCES += \
89lib/ector/software/ector_renderer_software_gradient_linear.c \ 95lib/ector/software/ector_renderer_software_gradient_linear.c \
90lib/ector/software/ector_renderer_software_gradient_radial.c \ 96lib/ector/software/ector_renderer_software_gradient_radial.c \
91lib/ector/software/ector_renderer_software_shape.c \ 97lib/ector/software/ector_renderer_software_shape.c \
98lib/ector/software/ector_renderer_software_buffer.c \
92lib/ector/software/ector_software_gradient.c \ 99lib/ector/software/ector_software_gradient.c \
93lib/ector/software/ector_software_rasterizer.c \ 100lib/ector/software/ector_software_rasterizer.c \
94lib/ector/software/ector_software_surface.c \ 101lib/ector/software/ector_software_surface.c \
102lib/ector/software/ector_software_buffer.c \
95static_libs/freetype/sw_ft_math.c \ 103static_libs/freetype/sw_ft_math.c \
96static_libs/freetype/sw_ft_raster.c \ 104static_libs/freetype/sw_ft_raster.c \
97static_libs/freetype/sw_ft_stroker.c \ 105static_libs/freetype/sw_ft_stroker.c \
@@ -150,6 +158,7 @@ endif
150 158
151EXTRA_DIST += \ 159EXTRA_DIST += \
152lib/ector/ector_private.h \ 160lib/ector/ector_private.h \
161lib/ector/ector_buffer.h \
153lib/ector/cairo/ector_cairo_private.h \ 162lib/ector/cairo/ector_cairo_private.h \
154lib/ector/software/ector_drawhelper_private.h \ 163lib/ector/software/ector_drawhelper_private.h \
155lib/ector/software/ector_software_private.h \ 164lib/ector/software/ector_software_private.h \
diff --git a/src/lib/ector/ector_generic_buffer.c b/src/lib/ector/ector_generic_buffer.c
new file mode 100644
index 0000000..ba5955b
--- /dev/null
+++ b/src/lib/ector/ector_generic_buffer.c
@@ -0,0 +1,50 @@
1#ifdef HAVE_CONFIG_H
2# include "config.h"
3#else
4# define EFL_BETA_API_SUPPORT
5#endif
6
7#include <Eo.h>
8#include "ector_private.h"
9#include "ector_generic_buffer.eo.h"
10
11#define MY_CLASS ECTOR_GENERIC_BUFFER_CLASS
12
13EOLIAN static Efl_Gfx_Colorspace
14_ector_generic_buffer_cspace_get(Eo *obj EINA_UNUSED, Ector_Generic_Buffer_Data *pd)
15{
16 return pd->cspace;
17}
18
19EOLIAN static void
20_ector_generic_buffer_border_get(Eo *obj EINA_UNUSED, Ector_Generic_Buffer_Data *pd EINA_UNUSED, int *l, int *r, int *t, int *b)
21{
22 if (l) *l = pd->l;
23 if (r) *r = pd->r;
24 if (t) *t = pd->t;
25 if (b) *b = pd->b;
26}
27
28EOLIAN static void
29_ector_generic_buffer_size_get(Eo *obj EINA_UNUSED, Ector_Generic_Buffer_Data *pd, int *w, int *h)
30{
31 if (w) *w = pd->w;
32 if (h) *h = pd->h;
33}
34
35EOLIAN static Ector_Buffer_Flag
36_ector_generic_buffer_flags_get(Eo *obj EINA_UNUSED, Ector_Generic_Buffer_Data *pd EINA_UNUSED)
37{
38 return ECTOR_BUFFER_FLAG_NONE;
39}
40
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"
diff --git a/src/lib/ector/ector_generic_buffer.eo b/src/lib/ector/ector_generic_buffer.eo
new file mode 100644
index 0000000..f0f1566
--- /dev/null
+++ b/src/lib/ector/ector_generic_buffer.eo
@@ -0,0 +1,132 @@
1enum Ector.Buffer.Flag {
2 none = 0x00, [[Buffer may not have any backing]]
3 cpu_readable = 0x01, [[Can be read from the CPU after map. Reading may still be very slow.]]
4 cpu_writable = 0x02, [[Can be written to by the CPU after map. Writing may still be very slow.]]
5 renderable = 0x04, [[Can be rendered to, ie CPU memory for SW rendering, or an FBO for GL engine]]
6 cpu_readable_fast = 0x08, [[Can be read by the CPU at high speed, ie no need for glReadPixels]]
7 cpu_writable_fast = 0x0A, [[Can be written by the CPU at high speed, ie no need for GPU texture upload]]
8 uncached = 0x10, [[Backed by uncached memory, ie. slow-ish reads but faster than glReadPixels]]
9/* non_coherent = 0x20, [[Memory may be mapped but will not be coherent between GPU and CPU. Call flush or invalidate to synchronize it.]] */
10}
11
12enum Ector.Buffer.Access_Flag {
13 none = 0x0,
14 read = 0x1,
15 write = 0x2,
16}
17
18abstract Ector.Generic.Buffer (Eo.Base)
19{
20 [[2D pixel buffer interface for Ector
21 @since 1.17
22 ]]
23 eo_prefix: ector_buffer;
24 legacy_prefix: null;
25 methods {
26 @property size {
27 get {
28 [[Retrieves the (rectangular) size of the pixel buffer.]]
29 }
30 values {
31 w: int;
32 h: int;
33 }
34 }
35 @property cspace {
36 get {}
37 values {
38 cspace: Efl.Gfx.Colorspace;
39 }
40 }
41 map {
42 [[Map a region of this buffer for read or write access by the CPU,
43 fetch data from the GPU if needed.
44 ]]
45 params {
46 @out offset: int; [[Byte offset to the first requested pixel]]
47 @out length: uint; [[Accessible buffer size in bytes]]
48 @in mode: Ector.Buffer.Access_Flag;
49 @in x: uint;
50 @in y: uint;
51 @in w: uint; [[If 0, defaults to the buffer width]]
52 @in h: uint; [[If 0, defaults to the buffer height]]
53 @in cspace: Efl.Gfx.Colorspace; [[Requested colorspace. If difference from the internal cspace, map may either fail or convert slowly]]
54 @out stride: uint; [[Optional]]
55 }
56 return: uint8* @warn_unused; [[Top-left pixel is at offset bytes after this address. Returns $null in case of failure]]
57 }
58 unmap {
59 [[Unmap a region of this buffer, and upload data to the GPU (if needed).]]
60 params {
61 @in data: void*; [[Data pointer returned by a previous call to map]]
62 @in offset: int;
63 @in length: uint;
64 }
65 }
66 pixels_set {
67 [[Set the source pixels for this buffer, or allocate a new memory region]]
68 params {
69 @in pixels: void*; [[If $null, allocates an empty buffer]]
70 @in width: int;
71 @in height: int;
72 @in stride: int; [[Can be 0]]
73 @in cspace: Efl.Gfx.Colorspace;
74 @in writable: bool;
75 @in l: ubyte; [[Left border pixels, usually 0 or 1]]
76 @in r: ubyte; [[Right border pixels, usually 0 or 1]]
77 @in t: ubyte; [[Top border pixels, usually 0 or 1]]
78 @in b: ubyte; [[Bottom border pixels, usually 0 or 1]]
79 }
80 return: bool;
81 }
82 span_get {
83 [[Get a single horizontal span of length w starting from (x,y)
84
85 Call span_free() to release it. This function will try not to
86 allocate any new buffer, whenever possible. This means the data
87 might be mapped directly from the backing memory buffer.
88 ]]
89 params {
90 @in x: int; [[Ranges from -l to w+r-1]]
91 @in y: int; [[Ranges from -t to h+b-1]]
92 @in w: uint; [[Ranges from 1 to w+l+r]]
93 @in cspace: Efl.Gfx.Colorspace; [[Requested colorspace, may trigger conversion on the fly.]]
94 @out length: uint; [[Length in bytes of the returned buffer]]
95 }
96 return: uint8*; [[A temporary memory buffer containing the pixels requested.]]
97 }
98 span_free {
99 [[Must be called as soon as possible after span_get]]
100 params {
101 data: uint8*;
102 }
103 }
104 @property flags {
105 get { [[Get the capabilities of this buffer]] }
106 values {
107 flag: Ector.Buffer.Flag; [[A bitmask of capability flags]]
108 }
109 }
110 @property border {
111 [[Duplicated pixel borders of this buffer, used for GL scaling]]
112 get {}
113 values {
114 l: int;
115 r: int;
116 t: int;
117 b: int;
118 }
119 }
120 }
121 events {
122 detached; [[Emitted whenever the previously attached pixels are detached during pixels_set]]
123 }
124 implements {
125 Eo.Base.constructor;
126 @virtual .pixels_set;
127 @virtual .span_get;
128 @virtual .span_free;
129 @virtual .map;
130 @virtual .unmap;
131 }
132}
diff --git a/src/lib/ector/ector_private.h b/src/lib/ector/ector_private.h
index 8d0b9fe..13cfc7e 100644
--- a/src/lib/ector/ector_private.h
+++ b/src/lib/ector/ector_private.h
@@ -1,6 +1,8 @@
1#ifndef ECTOR_PRIVATE_H_ 1#ifndef ECTOR_PRIVATE_H_
2#define ECTOR_PRIVATE_H_ 2#define ECTOR_PRIVATE_H_
3 3
4#include "Ector.h"
5
4/* 6/*
5 * variable and macros used for the eina_log module 7 * variable and macros used for the eina_log module
6 */ 8 */
@@ -65,13 +67,22 @@ typedef unsigned short DATA16;
65#define ARGB_JOIN(a,r,g,b) \ 67#define ARGB_JOIN(a,r,g,b) \
66 (((a) << 24) + ((r) << 16) + ((g) << 8) + (b)) 68 (((a) << 24) + ((r) << 16) + ((g) << 8) + (b))
67 69
68static inline void 70static inline Eo *
69_ector_renderer_replace(Ector_Renderer **d, const Ector_Renderer *s) 71_eo_refplace(Eo **d, const Eo *s)
70{ 72{
71 Ector_Renderer *tmp = *d; 73 Eo *tmp = *d;
72
73 *d = eo_ref(s); 74 *d = eo_ref(s);
74 eo_unref(tmp); 75 if (tmp) eo_unref(tmp);
76 return *d;
77}
78
79static inline Eo *
80_eo_xrefplace(Eo **d, Eo *s, const Eo *ref_obj)
81{
82 Eo *tmp = *d;
83 *d = eo_xref(s, ref_obj);
84 if (tmp) eo_xunref(tmp, ref_obj);
85 return *d;
75} 86}
76 87
77typedef struct _Ector_Renderer_Generic_Base_Data Ector_Renderer_Generic_Base_Data; 88typedef struct _Ector_Renderer_Generic_Base_Data Ector_Renderer_Generic_Base_Data;
@@ -79,6 +90,8 @@ typedef struct _Ector_Renderer_Generic_Gradient_Data Ector_Renderer_Generic_Grad
79typedef struct _Ector_Renderer_Generic_Gradient_Linear_Data Ector_Renderer_Generic_Gradient_Linear_Data; 90typedef struct _Ector_Renderer_Generic_Gradient_Linear_Data Ector_Renderer_Generic_Gradient_Linear_Data;
80typedef 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;
81typedef 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;
94typedef struct _Ector_Generic_Buffer_Data Ector_Generic_Buffer_Data;
82 95
83struct _Ector_Renderer_Generic_Base_Data 96struct _Ector_Renderer_Generic_Base_Data
84{ 97{
@@ -132,6 +145,23 @@ struct _Ector_Renderer_Generic_Shape_Data
132 } stroke; 145 } stroke;
133}; 146};
134 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
157{
158 Ector_Generic_Buffer *eo_buffer;
159 struct {
160 Efl_Gfx_Fill_Spread spread;
161 int x, y, w, h;
162 } fill;
163};
164
135static inline unsigned int 165static inline unsigned int
136_renderer_crc_get(Eo *obj, unsigned int crc) 166_renderer_crc_get(Eo *obj, unsigned int crc)
137{ 167{
diff --git a/src/lib/ector/ector_renderer.h b/src/lib/ector/ector_renderer.h
index 4c69a41..30b9bd2 100644
--- a/src/lib/ector/ector_renderer.h
+++ b/src/lib/ector/ector_renderer.h
@@ -3,6 +3,7 @@
3 3
4#include "ector_renderer_generic_base.eo.h" 4#include "ector_renderer_generic_base.eo.h"
5#include "ector_renderer_generic_shape.eo.h" 5#include "ector_renderer_generic_shape.eo.h"
6#include "ector_renderer_generic_buffer.eo.h"
6#include "ector_renderer_generic_gradient.eo.h" 7#include "ector_renderer_generic_gradient.eo.h"
7#include "ector_renderer_generic_gradient_linear.eo.h" 8#include "ector_renderer_generic_gradient_linear.eo.h"
8#include "ector_renderer_generic_gradient_radial.eo.h" 9#include "ector_renderer_generic_gradient_radial.eo.h"
diff --git a/src/lib/ector/ector_renderer_base.c b/src/lib/ector/ector_renderer_base.c
index b2b08c5..2b9a594 100644
--- a/src/lib/ector/ector_renderer_base.c
+++ b/src/lib/ector/ector_renderer_base.c
@@ -114,7 +114,7 @@ _ector_renderer_generic_base_mask_set(Eo *obj EINA_UNUSED,
114 Ector_Renderer_Generic_Base_Data *pd, 114 Ector_Renderer_Generic_Base_Data *pd,
115 Ector_Renderer *r) 115 Ector_Renderer *r)
116{ 116{
117 _ector_renderer_replace(&pd->mask, r); 117 _eo_refplace(&pd->mask, r);
118} 118}
119 119
120static Ector_Renderer * 120static Ector_Renderer *
diff --git a/src/lib/ector/ector_renderer_generic_buffer.c b/src/lib/ector/ector_renderer_generic_buffer.c
new file mode 100644
index 0000000..0814ded
--- /dev/null
+++ b/src/lib/ector/ector_renderer_generic_buffer.c
@@ -0,0 +1,68 @@
1#ifdef HAVE_CONFIG_H
2# include "config.h"
3#else
4# define EFL_BETA_API_SUPPORT
5#endif
6
7#include <Eo.h>
8#include "ector_private.h"
9#include "ector_renderer_generic_buffer.eo.h"
10
11#define MY_CLASS ECTOR_RENDERER_GENERIC_BUFFER_MIXIN
12
13EOLIAN static Efl_Gfx_Fill_Spread
14_ector_renderer_generic_buffer_efl_gfx_fill_fill_spread_get(Eo *obj EINA_UNUSED, Ector_Renderer_Generic_Buffer_Data *pd)
15{
16 return pd->fill.spread;
17}
18
19EOLIAN static void
20_ector_renderer_generic_buffer_efl_gfx_fill_fill_spread_set(Eo *obj EINA_UNUSED, Ector_Renderer_Generic_Buffer_Data *pd, Efl_Gfx_Fill_Spread spread)
21{
22 pd->fill.spread = spread;
23}
24
25EOLIAN static void
26_ector_renderer_generic_buffer_efl_gfx_fill_fill_get(Eo *obj EINA_UNUSED, Ector_Renderer_Generic_Buffer_Data *pd, int *x, int *y, int *w, int *h)
27{
28 if (x) *x = pd->fill.x;
29 if (y) *y = pd->fill.y;
30 if (w) *w = pd->fill.w;
31 if (h) *h = pd->fill.h;
32}
33
34EOLIAN static void
35_ector_renderer_generic_buffer_efl_gfx_fill_fill_set(Eo *obj EINA_UNUSED, Ector_Renderer_Generic_Buffer_Data *pd, int x, int y, int w, int h)
36{
37 if (w < 0) w = 0;
38 if (h < 0) h = 0;
39 pd->fill.x = x;
40 pd->fill.y = y;
41 pd->fill.w = w;
42 pd->fill.h = h;
43}
44
45EOLIAN static void
46_ector_renderer_generic_buffer_buffer_set(Eo *obj EINA_UNUSED, Ector_Renderer_Generic_Buffer_Data *pd, Ector_Generic_Buffer *buf)
47{
48 _eo_xrefplace(&pd->eo_buffer, buf, obj);
49}
50
51EOLIAN static Ector_Generic_Buffer *
52_ector_renderer_generic_buffer_buffer_get(Eo *obj EINA_UNUSED, Ector_Renderer_Generic_Buffer_Data *pd)
53{
54 return pd->eo_buffer;
55}
56
57EOLIAN static Eo_Base *
58_ector_renderer_generic_buffer_eo_base_constructor(Eo *obj, Ector_Renderer_Generic_Buffer_Data *pd)
59{
60 Eo_Base *ret;
61
62 eo_do_super(obj, MY_CLASS, ret = eo_constructor());
63 pd->fill.spread = EFL_GFX_FILL_REPEAT;
64
65 return ret;
66}
67
68#include "ector_renderer_generic_buffer.eo.c"
diff --git a/src/lib/ector/ector_renderer_generic_buffer.eo b/src/lib/ector/ector_renderer_generic_buffer.eo
new file mode 100644
index 0000000..94e1ef2
--- /dev/null
+++ b/src/lib/ector/ector_renderer_generic_buffer.eo
@@ -0,0 +1,22 @@
1mixin Ector.Renderer.Generic.Buffer (Eo.Base, Efl.Gfx.Fill)
2{
3 [[Ector buffers have a default fill set to repeat]]
4 eo_prefix: ector_renderer_buffer;
5 legacy_prefix: null;
6 methods {
7 @property buffer {
8 set {}
9 get {}
10 values {
11 buf: Ector.Generic.Buffer*;
12 }
13 }
14 }
15 implements {
16 Eo.Base.constructor;
17 Efl.Gfx.Fill.fill_spread.get;
18 Efl.Gfx.Fill.fill_spread.set;
19 Efl.Gfx.Fill.fill.get;
20 Efl.Gfx.Fill.fill.set;
21 }
22}
diff --git a/src/lib/ector/ector_renderer_shape.c b/src/lib/ector/ector_renderer_shape.c
index c5b09e0..76e67bb 100644
--- a/src/lib/ector/ector_renderer_shape.c
+++ b/src/lib/ector/ector_renderer_shape.c
@@ -12,7 +12,7 @@ _ector_renderer_generic_shape_fill_set(Eo *obj EINA_UNUSED,
12 Ector_Renderer_Generic_Shape_Data *pd, 12 Ector_Renderer_Generic_Shape_Data *pd,
13 const Ector_Renderer *r) 13 const Ector_Renderer *r)
14{ 14{
15 _ector_renderer_replace(&pd->fill, r); 15 _eo_refplace(&pd->fill, r);
16} 16}
17 17
18static const Ector_Renderer * 18static const Ector_Renderer *
@@ -27,7 +27,7 @@ _ector_renderer_generic_shape_stroke_fill_set(Eo *obj EINA_UNUSED,
27 Ector_Renderer_Generic_Shape_Data *pd, 27 Ector_Renderer_Generic_Shape_Data *pd,
28 const Ector_Renderer *r) 28 const Ector_Renderer *r)
29{ 29{
30 _ector_renderer_replace(&pd->stroke.fill, r); 30 _eo_refplace(&pd->stroke.fill, r);
31} 31}
32 32
33static const Ector_Renderer * 33static const Ector_Renderer *
@@ -42,7 +42,7 @@ _ector_renderer_generic_shape_stroke_marker_set(Eo *obj EINA_UNUSED,
42 Ector_Renderer_Generic_Shape_Data *pd, 42 Ector_Renderer_Generic_Shape_Data *pd,
43 const Ector_Renderer *r) 43 const Ector_Renderer *r)
44{ 44{
45 _ector_renderer_replace(&pd->stroke.marker, r); 45 _eo_refplace(&pd->stroke.marker, r);
46} 46}
47 47
48static const Ector_Renderer * 48static const Ector_Renderer *
diff --git a/src/lib/ector/ector_surface.h b/src/lib/ector/ector_surface.h
index 424726a..0cc5a32 100644
--- a/src/lib/ector/ector_surface.h
+++ b/src/lib/ector/ector_surface.h
@@ -1,6 +1,7 @@
1#ifndef ECTOR_SURFACE_H 1#ifndef ECTOR_SURFACE_H
2#define ECTOR_SURFACE_H 2#define ECTOR_SURFACE_H
3 3
4#include "ector_generic_buffer.eo.h"
4#include "ector_generic_surface.eo.h" 5#include "ector_generic_surface.eo.h"
5 6
6#endif 7#endif
diff --git a/src/lib/ector/software/Ector_Software.h b/src/lib/ector/software/Ector_Software.h
index ec074be..8e2a921 100644
--- a/src/lib/ector/software/Ector_Software.h
+++ b/src/lib/ector/software/Ector_Software.h
@@ -13,8 +13,10 @@ typedef Eo Ector_Software_Surface;
13typedef struct _Software_Rasterizer Software_Rasterizer; 13typedef 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_renderer_software_base.eo.h" 17#include "software/ector_renderer_software_base.eo.h"
17#include "software/ector_renderer_software_shape.eo.h" 18#include "software/ector_renderer_software_shape.eo.h"
19#include "software/ector_renderer_software_buffer.eo.h"
18#include "software/ector_renderer_software_gradient_linear.eo.h" 20#include "software/ector_renderer_software_gradient_linear.eo.h"
19#include "software/ector_renderer_software_gradient_radial.eo.h" 21#include "software/ector_renderer_software_gradient_radial.eo.h"
20 22
diff --git a/src/lib/ector/software/ector_renderer_software_buffer.c b/src/lib/ector/software/ector_renderer_software_buffer.c
new file mode 100644
index 0000000..2cda712
--- /dev/null
+++ b/src/lib/ector/software/ector_renderer_software_buffer.c
@@ -0,0 +1,72 @@
1#ifdef HAVE_CONFIG_H
2# include "config.h"
3#else
4# define EFL_BETA_API_SUPPORT
5#endif
6
7#include <Eo.h>
8#include "Ector_Software.h"
9#include "ector_private.h"
10#include "ector_software_private.h"
11
12#define MY_CLASS ECTOR_RENDERER_SOFTWARE_BUFFER_CLASS
13
14typedef struct
15{
16 Ector_Renderer_Generic_Base_Data *base;
17 Software_Rasterizer *surface;
18 Ector_Generic_Buffer *eo_buffer;
19} Ector_Renderer_Software_Buffer_Data;
20
21
22EOLIAN static void
23_ector_renderer_software_buffer_buffer_set(Eo *obj, Ector_Renderer_Software_Buffer_Data *pd, Ector_Generic_Buffer *buf)
24{
25 _eo_xrefplace(&pd->eo_buffer, buf, obj);
26}
27
28EOLIAN static Ector_Generic_Buffer *
29_ector_renderer_software_buffer_buffer_get(Eo *obj EINA_UNUSED, Ector_Renderer_Software_Buffer_Data *pd)
30{
31 return pd->eo_buffer;
32}
33
34EOLIAN static Eina_Bool
35_ector_renderer_software_buffer_ector_renderer_software_base_fill(Eo *obj, Ector_Renderer_Software_Buffer_Data *pd)
36{
37 Ector_Software_Buffer *buffer = eo_data_scope_get(obj, ECTOR_SOFTWARE_BUFFER_CLASS);
38 ector_software_rasterizer_buffer_set(pd->surface, buffer);
39 return EINA_TRUE;
40}
41
42EOLIAN static Eina_Bool
43_ector_renderer_software_buffer_ector_renderer_generic_base_prepare(Eo *obj, Ector_Renderer_Software_Buffer_Data *pd)
44{
45 if (!pd->surface)
46 pd->surface = eo_data_xref(pd->base->surface, ECTOR_SOFTWARE_SURFACE_CLASS, obj);
47
48 return EINA_TRUE;
49}
50
51EOLIAN static unsigned int
52_ector_renderer_software_buffer_ector_renderer_generic_base_crc_get(Eo *obj, Ector_Renderer_Software_Buffer_Data *pd)
53{
54 Ector_Software_Buffer_Data *buffer = eo_data_scope_get(pd->eo_buffer, ECTOR_SOFTWARE_BUFFER_CLASS);
55 unsigned int crc;
56
57 eo_do_super(obj, MY_CLASS, crc = ector_renderer_crc_get());
58 crc = eina_crc((const char *) buffer, sizeof(*buffer), crc, EINA_FALSE);
59 if (pd->surface)
60 crc = eina_crc((const char *) pd->surface, sizeof(*pd->surface), crc, EINA_FALSE);
61
62 return crc;
63}
64
65EOLIAN static void
66_ector_renderer_software_buffer_eo_base_destructor(Eo *obj, Ector_Renderer_Software_Buffer_Data *pd)
67{
68 eo_data_xunref(pd->base->surface, pd->surface, obj);
69 eo_do_super(obj, MY_CLASS, eo_destructor());
70}
71
72#include "ector_renderer_software_buffer.eo.c"
diff --git a/src/lib/ector/software/ector_renderer_software_buffer.eo b/src/lib/ector/software/ector_renderer_software_buffer.eo
new file mode 100644
index 0000000..14c45ad
--- /dev/null
+++ b/src/lib/ector/software/ector_renderer_software_buffer.eo
@@ -0,0 +1,19 @@
1class Ector.Renderer.Software.Buffer (Ector.Renderer.Software.Base, Ector.Renderer.Generic.Buffer)
2{
3 legacy_prefix: null;
4 methods {
5 @property buffer {
6 set {}
7 get {}
8 values {
9 buf: Ector.Generic.Buffer *;
10 }
11 }
12 }
13 implements {
14 Ector.Renderer.Generic.Base.prepare;
15 Ector.Renderer.Generic.Base.crc.get;
16 Ector.Renderer.Software.Base.fill;
17 Eo.Base.destructor;
18 }
19}
diff --git a/src/lib/ector/software/ector_software_buffer.c b/src/lib/ector/software/ector_software_buffer.c
new file mode 100644
index 0000000..4fdbcde
--- /dev/null
+++ b/src/lib/ector/software/ector_software_buffer.c
@@ -0,0 +1,248 @@
1#ifdef HAVE_CONFIG_H
2# include "config.h"
3#else
4# define EFL_BETA_API_SUPPORT
5#endif
6
7#include <Eo.h>
8#include "Ector_Software.h"
9#include "ector_private.h"
10#include "ector_software_private.h"
11#include "ector_generic_buffer.eo.h"
12
13#define fail(fmt, ...) do { ERR(fmt, ##__VA_ARGS__); goto on_fail; } while (0)
14
15static inline int
16_min_stride_calc(int width, Efl_Gfx_Colorspace cspace)
17{
18 switch (cspace)
19 {
20 case EFL_GFX_COLORSPACE_ARGB8888: return width * 4;
21 case EFL_GFX_COLORSPACE_GRY8: return width;
22 default: return 0;
23 }
24}
25
26/* FIXME: Conversion routines don't belong here */
27static inline void
28_pixels_argb_to_gry8_convert(uint8_t *dst, const uint32_t *src, int len)
29{
30 int k;
31 for (k = 0; k < len; k++)
32 {
33 const uint32_t *s = src++;
34 *dst++ = A_VAL(s);
35 }
36}
37
38static inline void
39_pixels_gry8_to_argb_convert(uint32_t *dst, const uint8_t *src, int len)
40{
41 int k;
42 for (k = 0; k < len; k++)
43 {
44 uint8_t s = *src++;
45 *dst++ = ARGB_JOIN(s, s, s, s);
46 }
47}
48
49EOLIAN static void
50_ector_software_buffer_pixels_clear(Eo *obj, Ector_Software_Buffer_Data *pd)
51{
52 if (!pd->pixels.u8)
53 return;
54
55 eo_do(obj, eo_event_callback_call(ECTOR_GENERIC_BUFFER_EVENT_DETACHED, pd->pixels.u8));
56 if (!pd->nofree)
57 {
58 free(pd->pixels.u8);
59 }
60 pd->pixels.u8 = NULL;
61 pd->nofree = EINA_FALSE;
62}
63
64EOLIAN static Eina_Bool
65_ector_software_buffer_ector_generic_buffer_pixels_set(Eo *obj, Ector_Software_Buffer_Data *pd,
66 void *pixels, int width, int height, int stride,
67 Efl_Gfx_Colorspace cspace, Eina_Bool writable,
68 unsigned char l, unsigned char r,
69 unsigned char t, unsigned char b)
70{
71 // safety check
72 unsigned px = _min_stride_calc(1, cspace);
73 if (px && ((unsigned long long)(uintptr_t)pixels) & (px - 1))
74 ERR("Pixel data is not aligned to %u bytes!", px);
75
76 if ((cspace != EFL_GFX_COLORSPACE_ARGB8888) &&
77 (cspace != EFL_GFX_COLORSPACE_GRY8))
78 {
79 ERR("Unsupported colorspace: %u", cspace);
80 return EINA_FALSE;
81 }
82
83 if (!stride)
84 stride = _min_stride_calc(width + l + r, cspace);
85 else if (stride < _min_stride_calc(width + l + r, cspace))
86 {
87 ERR("Invalid stride %u for width %u (+%u+%u) cspace %u. pixels_set failed.",
88 stride, width, l, r, cspace);
89 _ector_software_buffer_pixels_clear(obj, pd);
90 return EINA_FALSE;
91 }
92
93 if (pd->pixels.u8 && (pd->pixels.u8 != pixels))
94 _ector_software_buffer_pixels_clear(obj, pd);
95
96 if (pixels)
97 {
98 pd->pixels.u8 = pixels;
99 pd->nofree = EINA_TRUE;
100 pd->writable = !!writable;
101 }
102 else
103 {
104 pd->pixels.u8 = malloc(stride * (height + t + b));
105 pd->nofree = EINA_FALSE;
106 pd->writable = EINA_TRUE;
107 }
108 pd->generic.w = width;
109 pd->generic.h = height;
110 pd->generic.l = l;
111 pd->generic.r = r;
112 pd->generic.t = t;
113 pd->generic.b = b;
114 pd->generic.cspace = cspace;
115 pd->stride = stride;
116 return EINA_TRUE;
117}
118
119EOLIAN static uint8_t *
120_ector_software_buffer_ector_generic_buffer_map(Eo *obj EINA_UNUSED, Ector_Software_Buffer_Data *pd,
121 int *offset, unsigned int *length,
122 Ector_Buffer_Access_Flag mode EINA_UNUSED,
123 unsigned int x, unsigned int y, unsigned int w, unsigned int h,
124 Efl_Gfx_Colorspace cspace EINA_UNUSED, unsigned int *stride)
125{
126 int off;
127
128 if (!pd->pixels.u8 || !pd->stride)
129 fail("Buffer has no pixel data yet");
130 if (cspace != pd->generic.cspace)
131 fail("Invalid colorspace");
132 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",
134 x, y, w, h, pd->generic.w, pd->generic.h);
135
136 pd->map_count++;
137 off = _min_stride_calc(x + pd->generic.l, pd->generic.cspace) + (pd->stride * (y + pd->generic.t));
138 if (offset) *offset = off;
139 if (length) *length = (pd->stride * pd->generic.h) - off;
140 if (stride) *stride = pd->stride;
141 return pd->pixels.u8;
142
143on_fail:
144 if (offset) *offset = 0;
145 if (length) *length = 0;
146 if (stride) *stride = 0;
147 return NULL;
148}
149
150EOLIAN 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)
152{
153 if (!data) return;
154 if (data != pd->pixels.u8)
155 {
156 CRI("Trying to unmap a non-mapped region!");
157 return;
158 }
159 if (pd->map_count == 0)
160 {
161 CRI("Unmapped too many times! Check your code!");
162 return;
163 }
164 pd->map_count--;
165}
166
167EOLIAN uint8_t *
168_ector_software_buffer_ector_generic_buffer_span_get(Eo *obj EINA_UNUSED, Ector_Software_Buffer_Data *pd,
169 int x, int y, unsigned int w, Efl_Gfx_Colorspace cspace,
170 unsigned int *length)
171{
172 uint8_t *src;
173 int len, px;
174
175 if (!pd->pixels.u8)
176 fail("No pixel data");
177 if ((x < -pd->generic.l) || (y < -pd->generic.t) ||
178 ((unsigned) x > pd->generic.w) || ((unsigned) y > pd->generic.h))
179 fail("Out of bounds");
180 if (((unsigned) x + w) > (pd->generic.w + pd->generic.l + pd->generic.r))
181 fail("Requested span too large");
182
183 px = _min_stride_calc(1, pd->generic.cspace);
184 len = _min_stride_calc(w, cspace);
185 if (length) *length = len;
186
187 src = pd->pixels.u8 + ((pd->generic.t + y) * pd->stride) + (px * (pd->generic.l + x));
188
189 if (cspace == pd->generic.cspace)
190 {
191 pd->span_free = EINA_FALSE;
192 return src;
193 }
194 else if ((cspace == EFL_GFX_COLORSPACE_ARGB8888) &&
195 (pd->generic.cspace == EFL_GFX_COLORSPACE_GRY8))
196 {
197 uint32_t *buf = malloc(len);
198 _pixels_gry8_to_argb_convert(buf, src, w);
199 pd->span_free = EINA_TRUE;
200 return (uint8_t *) buf;
201 }
202 else if ((cspace == EFL_GFX_COLORSPACE_GRY8) &&
203 (pd->generic.cspace == EFL_GFX_COLORSPACE_ARGB8888))
204 {
205 uint8_t *buf = malloc(len);
206 _pixels_argb_to_gry8_convert(buf, (uint32_t *) src, w);
207 pd->span_free = EINA_TRUE;
208 return buf;
209 }
210 else
211 fail("Unsupported colorspace %u", cspace);
212
213on_fail:
214 if (length) *length = 0;
215 return NULL;
216}
217
218EOLIAN void
219_ector_software_buffer_ector_generic_buffer_span_free(Eo *obj EINA_UNUSED, Ector_Software_Buffer_Data *pd,
220 uint8_t *data)
221{
222 if (pd->span_free) free(data);
223 pd->span_free = EINA_FALSE;
224}
225
226EOLIAN static Ector_Buffer_Flag
227_ector_software_buffer_ector_generic_buffer_flags_get(Eo *obj EINA_UNUSED, Ector_Software_Buffer_Data *pd)
228{
229 return ECTOR_BUFFER_FLAG_CPU_READABLE |
230 ECTOR_BUFFER_FLAG_CPU_READABLE_FAST |
231 ECTOR_BUFFER_FLAG_RENDERABLE |
232 (pd->writable ? (ECTOR_BUFFER_FLAG_CPU_WRITABLE |
233 ECTOR_BUFFER_FLAG_CPU_WRITABLE_FAST)
234 : 0);
235}
236
237EOLIAN static void
238_ector_software_buffer_eo_base_destructor(Eo *obj, Ector_Software_Buffer_Data *pd)
239{
240 _ector_software_buffer_pixels_clear(obj, pd);
241 eo_do_super(obj, ECTOR_SOFTWARE_BUFFER_CLASS, eo_destructor());
242 if (pd->map_count)
243 {
244 ERR("Pixel data is still mapped during destroy! Check your code!");
245 }
246}
247
248#include "ector_software_buffer.eo.c"
diff --git a/src/lib/ector/software/ector_software_buffer.eo b/src/lib/ector/software/ector_software_buffer.eo
new file mode 100644
index 0000000..a2e365a
--- /dev/null
+++ b/src/lib/ector/software/ector_software_buffer.eo
@@ -0,0 +1,19 @@
1class Ector.Software.Buffer (Ector.Generic.Buffer)
2{
3 [[A buffer in Ector Software is a readable & optionally writable image]]
4 legacy_prefix: null;
5 methods {
6 pixels_clear @protected {
7 [[Clear internal pixel buffer]]
8 }
9 }
10 implements {
11 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 }
19}
diff --git a/src/lib/ector/software/ector_software_private.h b/src/lib/ector/software/ector_software_private.h
index a4d1221..d0ec132 100644
--- a/src/lib/ector/software/ector_software_private.h
+++ b/src/lib/ector/software/ector_software_private.h
@@ -3,6 +3,7 @@
3 3
4#include "sw_ft_raster.h" 4#include "sw_ft_raster.h"
5#include "sw_ft_stroker.h" 5#include "sw_ft_stroker.h"
6#include "../ector_private.h"
6 7
7#ifndef DATA32 8#ifndef DATA32
8typedef unsigned int DATA32; 9typedef unsigned int DATA32;
@@ -48,6 +49,7 @@ typedef struct _Ector_Renderer_Software_Gradient_Data
48 49
49 50
50// Rasterizer related structure 51// Rasterizer related structure
52// FIXME: Merge with Ector_Software_Buffer
51typedef struct _Raster_Buffer 53typedef struct _Raster_Buffer
52{ 54{
53 int width; 55 int width;
@@ -55,6 +57,20 @@ typedef struct _Raster_Buffer
55 DATA32 *buffer; 57 DATA32 *buffer;
56} Raster_Buffer; 58} Raster_Buffer;
57 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
58typedef struct _Shape_Rle_Data 74typedef struct _Shape_Rle_Data
59{ 75{
60 Eina_Rectangle bbox; 76 Eina_Rectangle bbox;
@@ -98,7 +114,7 @@ typedef struct _Span_Data
98 union { 114 union {
99 DATA32 color; 115 DATA32 color;
100 Ector_Renderer_Software_Gradient_Data *gradient; 116 Ector_Renderer_Software_Gradient_Data *gradient;
101 //ImageData texture; 117 Ector_Software_Buffer_Data *buffer;
102 }; 118 };
103} Span_Data; 119} Span_Data;
104 120
@@ -131,6 +147,7 @@ void ector_software_rasterizer_transform_set(Software_Rasterizer *rasterizer, Ei
131void ector_software_rasterizer_color_set(Software_Rasterizer *rasterizer, int r, int g, int b, int a); 147void ector_software_rasterizer_color_set(Software_Rasterizer *rasterizer, int r, int g, int b, int a);
132void ector_software_rasterizer_linear_gradient_set(Software_Rasterizer *rasterizer, Ector_Renderer_Software_Gradient_Data *linear); 148void ector_software_rasterizer_linear_gradient_set(Software_Rasterizer *rasterizer, Ector_Renderer_Software_Gradient_Data *linear);
133void ector_software_rasterizer_radial_gradient_set(Software_Rasterizer *rasterizer, Ector_Renderer_Software_Gradient_Data *radial); 149void ector_software_rasterizer_radial_gradient_set(Software_Rasterizer *rasterizer, Ector_Renderer_Software_Gradient_Data *radial);
150void ector_software_rasterizer_buffer_set(Software_Rasterizer *rasterizer, Ector_Software_Buffer *image);
134void ector_software_rasterizer_clip_rect_set(Software_Rasterizer *rasterizer, Eina_Array *clips); 151void ector_software_rasterizer_clip_rect_set(Software_Rasterizer *rasterizer, Eina_Array *clips);
135void ector_software_rasterizer_clip_shape_set(Software_Rasterizer *rasterizer, Shape_Rle_Data *clip); 152void ector_software_rasterizer_clip_shape_set(Software_Rasterizer *rasterizer, Shape_Rle_Data *clip);
136 153
diff --git a/src/lib/ector/software/ector_software_rasterizer.c b/src/lib/ector/software/ector_software_rasterizer.c
index eb6ba8c..e58d611 100644
--- a/src/lib/ector/software/ector_software_rasterizer.c
+++ b/src/lib/ector/software/ector_software_rasterizer.c
@@ -74,6 +74,54 @@ _blend_gradient(int count, const SW_FT_Span *spans, void *user_data)
74 } 74 }
75} 75}
76 76
77static void
78_blend_image_gry8(int count, const SW_FT_Span *spans, void *user_data)
79{
80 Span_Data *data = user_data;
81
82#warning Need drawhelper here (no alpha support yet)
83
84 while (count--)
85 {
86 spans++;
87 }
88}
89
90static void
91_blend_image_argb(int count, const SW_FT_Span *spans, void *user_data)
92{
93 Span_Data *data = user_data;
94 RGBA_Comp_Func comp_func;
95 DATA32 *buffer, *target;
96 DATA8 *src8;
97 unsigned int l, length, sy = 0;
98
99#warning FIXME: Image scaling, anyone?
100#warning FIXME: Optimize eo call with early call resolution
101
102 comp_func = ector_comp_func_span_get(data->op, data->mul_col, EINA_TRUE);
103
104 buffer = data->raster_buffer.buffer + ((data->raster_buffer.width * data->offy) + data->offx);
105
106 while (count--)
107 {
108 target = buffer + ((data->raster_buffer.width * spans->y) + spans->x);
109 length = spans->len;
110 while (length)
111 {
112 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));
114 comp_func(target, (DATA32 *) src8, l, data->mul_col, spans->coverage);
115 eo_do(data->buffer->generic.eo, ector_buffer_span_free(src8));
116 target += l;
117 length -= l;
118 }
119 ++spans;
120 ++sy;
121 if (sy >= data->buffer->generic.h)
122 sy = 0;
123 }
124}
77 125
78/*! 126/*!
79 \internal 127 \internal
@@ -279,7 +327,10 @@ _adjust_span_fill_methods(Span_Data *spdata)
279 spdata->unclipped_blend = &_blend_gradient; 327 spdata->unclipped_blend = &_blend_gradient;
280 break; 328 break;
281 case Image: 329 case Image:
282 spdata->unclipped_blend = 0;//&_blend_image; 330 if (spdata->buffer->generic.cspace == EFL_GFX_COLORSPACE_GRY8)
331 spdata->unclipped_blend = &_blend_image_gry8;
332 else
333 spdata->unclipped_blend = &_blend_image_argb;
283 break; 334 break;
284 } 335 }
285 336
@@ -516,6 +567,13 @@ void ector_software_rasterizer_radial_gradient_set(Software_Rasterizer *rasteriz
516 rasterizer->fill_data.type = RadialGradient; 567 rasterizer->fill_data.type = RadialGradient;
517} 568}
518 569
570void ector_software_rasterizer_buffer_set(Software_Rasterizer *rasterizer,
571 Ector_Software_Buffer *buffer)
572{
573 rasterizer->fill_data.buffer = eo_data_scope_get(buffer, ECTOR_SOFTWARE_BUFFER_CLASS);
574 rasterizer->fill_data.type = Image;
575}
576
519void ector_software_rasterizer_draw_rle_data(Software_Rasterizer *rasterizer, 577void ector_software_rasterizer_draw_rle_data(Software_Rasterizer *rasterizer,
520 int x, int y, uint mul_col, 578 int x, int y, uint mul_col,
521 Ector_Rop op, Shape_Rle_Data* rle) 579 Ector_Rop op, Shape_Rle_Data* rle)
diff --git a/src/lib/ector/software/ector_software_surface.c b/src/lib/ector/software/ector_software_surface.c
index 0422920..4767e4e 100644
--- a/src/lib/ector/software/ector_software_surface.c
+++ b/src/lib/ector/software/ector_software_surface.c
@@ -27,6 +27,9 @@ _ector_software_surface_ector_generic_surface_renderer_factory_new(Eo *obj,
27 else if (type == ECTOR_RENDERER_GENERIC_GRADIENT_RADIAL_MIXIN) 27 else if (type == ECTOR_RENDERER_GENERIC_GRADIENT_RADIAL_MIXIN)
28 return eo_add(ECTOR_RENDERER_SOFTWARE_GRADIENT_RADIAL_CLASS, NULL, 28 return eo_add(ECTOR_RENDERER_SOFTWARE_GRADIENT_RADIAL_CLASS, NULL,
29 ector_renderer_surface_set(obj)); 29 ector_renderer_surface_set(obj));
30 else if (type == ECTOR_RENDERER_GENERIC_BUFFER_MIXIN)
31 return eo_add(ECTOR_RENDERER_SOFTWARE_BUFFER_CLASS, NULL,
32 ector_renderer_surface_set(obj));
30 ERR("Couldn't find class for type: %s\n", eo_class_name_get(type)); 33 ERR("Couldn't find class for type: %s\n", eo_class_name_get(type));
31 return NULL; 34 return NULL;
32} 35}
diff --git a/src/lib/efl/interfaces/efl_gfx_base.eo b/src/lib/efl/interfaces/efl_gfx_base.eo
index 8142533..566ef4f 100644
--- a/src/lib/efl/interfaces/efl_gfx_base.eo
+++ b/src/lib/efl/interfaces/efl_gfx_base.eo
@@ -1,3 +1,8 @@
1enum Efl.Gfx.Colorspace {
2 argb8888 = 0, [[ARGB 32 bits per pixel, high-byte is Alpha, accessed one 32-bit word at a time]]
3 gry8 = 4, [[8-bit gray image, or alpha only]]
4}
5
1interface Efl.Gfx.Base { 6interface Efl.Gfx.Base {
2 legacy_prefix: null; 7 legacy_prefix: null;
3 eo_prefix: efl_gfx; 8 eo_prefix: efl_gfx;