summaryrefslogtreecommitdiff
path: root/src/lib/ector/software/ector_software_surface.c
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/lib/ector/software/ector_software_surface.c
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/lib/ector/software/ector_software_surface.c')
-rw-r--r--src/lib/ector/software/ector_software_surface.c52
1 files changed, 7 insertions, 45 deletions
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());