summaryrefslogtreecommitdiff
path: root/src/lib/ector/software/ector_software_surface.c
diff options
context:
space:
mode:
authorSubhransu Sekhar Mohanty <sub.mohanty@samsung.com>2015-04-03 16:31:45 +0200
committerCedric BAIL <cedric@osg.samsung.com>2015-04-03 16:31:45 +0200
commit891ec145857c717105deb2481d224174b1c966ac (patch)
tree57b2caa588b66f531cbb28b90be14acae6c7ad67 /src/lib/ector/software/ector_software_surface.c
parente99774946cf596b4527dcba92bbf17798eee9260 (diff)
ector: add software backend using FreeType rasterizer.
Diffstat (limited to 'src/lib/ector/software/ector_software_surface.c')
-rw-r--r--src/lib/ector/software/ector_software_surface.c94
1 files changed, 94 insertions, 0 deletions
diff --git a/src/lib/ector/software/ector_software_surface.c b/src/lib/ector/software/ector_software_surface.c
new file mode 100644
index 0000000000..e32477ecc0
--- /dev/null
+++ b/src/lib/ector/software/ector_software_surface.c
@@ -0,0 +1,94 @@
1#ifdef HAVE_CONFIG_H
2# include "config.h"
3#endif
4
5#include <Ector.h>
6#include <software/Ector_Software.h>
7
8#include "ector_private.h"
9#include "ector_software_private.h"
10
11static unsigned int _software_count = 0;
12
13typedef struct _Ector_Renderer_Software_Base_Data Ector_Renderer_Software_Base_Data;
14struct _Ector_Renderer_Software_Base_Data
15{
16};
17
18static Ector_Renderer *
19_ector_software_surface_ector_generic_surface_renderer_factory_new(Eo *obj,
20 Ector_Software_Surface_Data *pd EINA_UNUSED,
21 const Eo_Class *type)
22{
23 if (type == ECTOR_RENDERER_GENERIC_SHAPE_MIXIN)
24 return eo_add(ECTOR_RENDERER_SOFTWARE_SHAPE_CLASS, obj);
25 else if (type == ECTOR_RENDERER_GENERIC_GRADIENT_LINEAR_MIXIN)
26 return eo_add(ECTOR_RENDERER_SOFTWARE_GRADIENT_LINEAR_CLASS, obj);
27 else if (type == ECTOR_RENDERER_GENERIC_GRADIENT_RADIAL_MIXIN)
28 return eo_add(ECTOR_RENDERER_SOFTWARE_GRADIENT_RADIAL_CLASS, obj);
29 ERR("Couldn't find class for type: %s\n", eo_class_name_get(type));
30 return NULL;
31}
32
33static void
34_ector_software_surface_context_set(Eo *obj EINA_UNUSED,
35 Ector_Software_Surface_Data *pd,
36 Software_Rasterizer *ctx)
37{
38 pd->software = ctx;
39}
40
41static Software_Rasterizer *
42_ector_software_surface_context_get(Eo *obj EINA_UNUSED,
43 Ector_Software_Surface_Data *pd)
44{
45 return pd->software;
46}
47
48void
49_ector_software_surface_surface_set(Eo *obj EINA_UNUSED,
50 Ector_Software_Surface_Data *pd,
51 void *pixels, unsigned int width, unsigned int height)
52{
53 pd->software->fillData.raster_buffer.buffer = pixels;
54 pd->software->fillData.raster_buffer.width = width;
55 pd->software->fillData.raster_buffer.height = height;
56}
57
58void
59_ector_software_surface_surface_get(Eo *obj EINA_UNUSED,
60 Ector_Software_Surface_Data *pd,
61 void **pixels, unsigned int *width, unsigned int *height)
62{
63 *pixels = pd->software->fillData.raster_buffer.buffer;
64 *width = pd->software->fillData.raster_buffer.width;
65 *height = pd->software->fillData.raster_buffer.height;
66}
67
68static void
69_ector_software_surface_eo_base_constructor(Eo *obj,
70 Ector_Software_Surface_Data *pd EINA_UNUSED)
71{
72 eo_do_super(obj, ECTOR_SOFTWARE_SURFACE_CLASS, eo_constructor());
73 if(_software_count == 0)
74 {
75 pd->software = (Software_Rasterizer *) calloc(1, sizeof(Software_Rasterizer));
76 ector_software_rasterizer_init(pd->software);
77 }
78 _software_count++;
79}
80
81static void
82_ector_software_surface_eo_base_destructor(Eo *obj EINA_UNUSED,
83 Ector_Software_Surface_Data *pd EINA_UNUSED)
84{
85 --_software_count;
86 if (_software_count > 0) return;
87 ector_software_rasterizer_done(pd->software);
88 free(pd->software);
89 pd->software = NULL;
90 eo_do_super(obj, ECTOR_SOFTWARE_SURFACE_CLASS, eo_destructor());
91}
92
93#include "ector_software_surface.eo.c"
94#include "ector_renderer_software_base.eo.c"