typedef struct _cairo_surface_t cairo_surface_t;
+static void (*cairo_translate)(cairo_t *cr, double tx, double ty) = NULL;
static void (*cairo_destroy)(cairo_t *cr) = NULL;
static cairo_surface_t *(*cairo_image_surface_create)(int format,
int width,
return pd->cairo;
}
+static void
+_ector_cairo_surface_ector_generic_surface_reference_point_set(Eo *obj EINA_UNUSED,
+ Ector_Cairo_Surface_Data *pd,
+ int x, int y)
+{
+ if (pd->cairo)
+ {
+ USE(obj, cairo_translate, );
+ cairo_translate(pd->cairo, x, y);
+ }
+}
+
static void
_ector_cairo_surface_eo_base_constructor(Eo *obj,
Ector_Cairo_Surface_Data *pd)
}
implements {
Ector.Generic.Surface.renderer_factory_new;
+ Ector.Generic.Surface.reference_point.set;
Eo.Base.destructor;
Eo.Base.constructor;
}
Ector_Renderer_Cairo_Base_Data *pd,
Ector_Rop op,
Eina_Array *clips EINA_UNUSED,
- int x, int y,
unsigned int mul_col)
{
double r, g, b, a;
static Eina_Bool
_ector_renderer_cairo_gradient_linear_ector_renderer_generic_base_draw(Eo *obj,
Ector_Renderer_Cairo_Gradient_Linear_Data *pd,
- Ector_Rop op, Eina_Array *clips, int x, int y, unsigned int mul_col)
+ Ector_Rop op, Eina_Array *clips, unsigned int mul_col)
{
Ector_Renderer_Generic_Gradient_Linear_Data *gld;
gld = eo_data_scope_get(obj, ECTOR_RENDERER_GENERIC_GRADIENT_LINEAR_MIXIN);
if (!pd->pat || !gld) return EINA_FALSE;
- eo_do_super(obj, ECTOR_RENDERER_CAIRO_GRADIENT_LINEAR_CLASS, ector_renderer_draw(op, clips, x, y, mul_col));
+ eo_do_super(obj, ECTOR_RENDERER_CAIRO_GRADIENT_LINEAR_CLASS, ector_renderer_draw(op, clips, mul_col));
USE(obj, cairo_rectangle, EINA_FALSE);
USE(obj, cairo_fill, EINA_FALSE);
// Clearly duplicated and should be in a common place...
static Eina_Bool
-_ector_renderer_cairo_gradient_radial_ector_renderer_generic_base_draw(Eo *obj, Ector_Renderer_Cairo_Gradient_Radial_Data *pd, Ector_Rop op, Eina_Array *clips, int x, int y, unsigned int mul_col)
+_ector_renderer_cairo_gradient_radial_ector_renderer_generic_base_draw(Eo *obj, Ector_Renderer_Cairo_Gradient_Radial_Data *pd, Ector_Rop op, Eina_Array *clips, unsigned int mul_col)
{
Ector_Renderer_Generic_Gradient_Radial_Data *gld;
gld = eo_data_scope_get(obj, ECTOR_RENDERER_GENERIC_GRADIENT_RADIAL_MIXIN);
if (!pd->pat || !gld) return EINA_FALSE;
- eo_do_super(obj, ECTOR_RENDERER_CAIRO_GRADIENT_RADIAL_CLASS, ector_renderer_draw(op, clips, x, y, mul_col));
+ eo_do_super(obj, ECTOR_RENDERER_CAIRO_GRADIENT_RADIAL_CLASS, ector_renderer_draw(op, clips, mul_col));
USE(obj, cairo_arc, EINA_FALSE);
USE(obj, cairo_fill, EINA_FALSE);
}
static Eina_Bool
-_ector_renderer_cairo_shape_ector_renderer_generic_base_draw(Eo *obj, Ector_Renderer_Cairo_Shape_Data *pd, Ector_Rop op, Eina_Array *clips, int x, int y, unsigned int mul_col)
+_ector_renderer_cairo_shape_ector_renderer_generic_base_draw(Eo *obj, Ector_Renderer_Cairo_Shape_Data *pd, Ector_Rop op, Eina_Array *clips, unsigned int mul_col)
{
if (pd->path == NULL) return EINA_FALSE;
// FIXME: find a way to set multiple clips
- eo_do_super(obj, ECTOR_RENDERER_CAIRO_SHAPE_CLASS, ector_renderer_draw(op, clips, x, y, mul_col));
+ eo_do_super(obj, ECTOR_RENDERER_CAIRO_SHAPE_CLASS, ector_renderer_draw(op, clips, mul_col));
USE(obj, cairo_new_path, EINA_FALSE);
USE(obj, cairo_append_path, EINA_FALSE);
int h; /*@ in */
}
}
+ reference_point {
+ set {
+ /*@ This define where is (0,0) in pixels coordinate inside the surface */
+ }
+ values {
+ int x;
+ int y;
+ }
+ }
}
methods {
renderer_factory_new {
}
implements {
@virtual .renderer_factory_new;
+ @virtual .reference_point.set;
}
}
params {
@in Ector_Rop op;
@in array<Eina_Rectangle *> *clips; /*@ array of Eina_Rectangle clip */
- @in int x;
- @in int y;
@in uint mul_col;
}
}
_ector_renderer_software_gradient_linear_ector_renderer_generic_base_draw(Eo *obj EINA_UNUSED,
Ector_Renderer_Software_Gradient_Data *pd EINA_UNUSED,
Ector_Rop op EINA_UNUSED, Eina_Array *clips EINA_UNUSED,
- int x EINA_UNUSED, int y EINA_UNUSED, unsigned int mul_col EINA_UNUSED)
+ unsigned int mul_col EINA_UNUSED)
{
return EINA_TRUE;
}
_ector_renderer_software_gradient_radial_ector_renderer_generic_base_draw(Eo *obj EINA_UNUSED,
Ector_Renderer_Software_Gradient_Data *pd EINA_UNUSED,
Ector_Rop op EINA_UNUSED, Eina_Array *clips EINA_UNUSED,
- int x EINA_UNUSED, int y EINA_UNUSED, unsigned int mul_col EINA_UNUSED)
+ unsigned int mul_col EINA_UNUSED)
{
return EINA_TRUE;
}
}
static Eina_Bool
-_ector_renderer_software_shape_ector_renderer_generic_base_draw(Eo *obj EINA_UNUSED, Ector_Renderer_Software_Shape_Data *pd, Ector_Rop op, Eina_Array *clips, int x, int y, unsigned int mul_col)
+_ector_renderer_software_shape_ector_renderer_generic_base_draw(Eo *obj EINA_UNUSED, Ector_Renderer_Software_Shape_Data *pd, Ector_Rop op, Eina_Array *clips, unsigned int mul_col)
{
+ int x, y;
+
// adjust the offset
- x = x + (int)pd->base->origin.x;
- y = y + (int)pd->base->origin.y;
+ x = pd->surface->x + (int)pd->base->origin.x;
+ y = pd->surface->y + (int)pd->base->origin.y;
// fill the span_data structure
ector_software_rasterizer_clip_rect_set(pd->surface->software, clips);
struct _Ector_Software_Surface_Data
{
Software_Rasterizer *software;
+ int x;
+ int y;
};
eo_do_super(obj, ECTOR_SOFTWARE_SURFACE_CLASS, eo_destructor());
}
+static void
+_ector_software_surface_ector_generic_surface_reference_point_set(Eo *obj EINA_UNUSED,
+ Ector_Software_Surface_Data *pd,
+ int x, int y)
+{
+ pd->x = x;
+ pd->y = y;
+}
+
#include "ector_software_surface.eo.c"
#include "ector_renderer_software_base.eo.c"
implements {
Ector.Generic.Surface.renderer_factory_new;
+ Ector.Generic.Surface.reference_point.set;
Eo.Base.destructor;
Eo.Base.constructor;
}
static void
_evas_vg_render(Evas_Object_Protected_Data *obj,
void *output, void *context, void *surface, Efl_VG *n,
- Eina_Array *clips, int x, int y, Eina_Bool do_async)
+ Eina_Array *clips, Eina_Bool do_async)
{
Efl_VG_Container_Data *vd = eo_data_scope_get(n, EFL_VG_CONTAINER_CLASS);
EINA_LIST_FOREACH(vd->children, l, child)
_evas_vg_render(obj,
output, context, surface, child,
- clips, x, y, do_async);
+ clips, do_async);
}
else
{
nd = eo_data_scope_get(n, EFL_VG_BASE_CLASS);
- obj->layer->evas->engine.func->ector_renderer_draw(output, context, surface, nd->renderer, clips, x, y, do_async);
+ obj->layer->evas->engine.func->ector_renderer_draw(output, context, surface, nd->renderer, clips, do_async);
}
}
context);
obj->layer->evas->engine.func->context_render_op_set(output, context,
obj->cur->render_op);
- obj->layer->evas->engine.func->ector_begin(output, context, surface, do_async);
+ obj->layer->evas->engine.func->ector_begin(output, context, surface,
+ obj->cur->geometry.x + x, obj->cur->geometry.y + y,
+ do_async);
_evas_vg_render(obj, output, context, surface, vd->root, NULL,
- obj->cur->geometry.x + x, obj->cur->geometry.y + y,
do_async);
obj->layer->evas->engine.func->ector_end(output, context, surface, do_async);
}
void (*texture_image_set) (void *data, void *texture, void *image);
Ector_Surface *(*ector_get) (void *data);
- void (*ector_begin) (void *data, void *context, void *surface, Eina_Bool do_async);
- void (*ector_renderer_draw) (void *data, void *context, void *surface, Ector_Renderer *r, Eina_Array *clips, int x, int y, Eina_Bool do_async);
+ void (*ector_begin) (void *data, void *context, void *surface, int x, int y, Eina_Bool do_async);
+ void (*ector_renderer_draw) (void *data, void *context, void *surface, Ector_Renderer *r, Eina_Array *clips, Eina_Bool do_async);
void (*ector_end) (void *data, void *context, void *surface, Eina_Bool do_async);
};
}
static void
-eng_ector_renderer_draw(void *data, void *context EINA_UNUSED, void *surface, Ector_Renderer *renderer, Eina_Array *clips, int x, int y, Eina_Bool do_async EINA_UNUSED)
+eng_ector_renderer_draw(void *data, void *context EINA_UNUSED, void *surface, Ector_Renderer *renderer, Eina_Array *clips, Eina_Bool do_async EINA_UNUSED)
{
Evas_GL_Image *dst = surface;
Evas_Engine_GL_Context *gc;
eo_do(renderer,
ector_renderer_draw(_evas_render_op_to_ector_rop(gc->dc->render_op),
c,
- x,
- y,
// mul_col will be applied by GL during ector_end
0xffffffff));
static void *software_buffer = NULL;
static void
-eng_ector_begin(void *data EINA_UNUSED, void *context EINA_UNUSED, void *surface, Eina_Bool do_async EINA_UNUSED)
+eng_ector_begin(void *data EINA_UNUSED, void *context EINA_UNUSED, void *surface, int x, int y, Eina_Bool do_async EINA_UNUSED)
{
Evas_Engine_GL_Context *gl_context;
Render_Engine_GL_Generic *re = data;
if (use_cairo)
{
eo_do(_software_ector,
- ector_cairo_software_surface_set(software_buffer, w, h));
+ ector_cairo_software_surface_set(software_buffer, w, h),
+ ector_surface_reference_point_set(x, y));
}
else
{
eo_do(_software_ector,
- ector_software_surface_set(software_buffer, w, h));
+ ector_software_surface_set(software_buffer, w, h),
+ ector_surface_reference_point_set(x, y));
}
}
DATA32 mul_col;
Ector_Rop render_op;
- int x, y;
Eina_Bool free_it;
};
struct _Evas_Thread_Command_Ector_Surface
{
void *surface;
+ int x, y;
};
Eina_Mempool *_mp_command_rect = NULL;
eo_do(ector->r,
ector_renderer_draw(ector->render_op,
ector->clips,
- ector->x,
- ector->y,
ector->mul_col));
_draw_thread_ector_cleanup(ector);
}
static void
-eng_ector_renderer_draw(void *data EINA_UNUSED, void *context, void *surface, Ector_Renderer *renderer, Eina_Array *clips, int x, int y, Eina_Bool do_async)
+eng_ector_renderer_draw(void *data EINA_UNUSED, void *context, void *surface, Ector_Renderer *renderer, Eina_Array *clips, Eina_Bool do_async)
{
RGBA_Image *dst = surface;
RGBA_Draw_Context *dc = context;
ector.render_op = _evas_render_op_to_ector_rop(dc->render_op);
ector.mul_col = ector_color_multiply(dc->mul.use ? dc->mul.col : 0xffffffff,
dc->col.col);;
- ector.x = x;
- ector.y = y;
ector.free_it = EINA_FALSE;
if (do_async)
void *pixels = NULL;
unsigned int w = 0;
unsigned int h = 0;
+ unsigned int x = 0;
+ unsigned int y = 0;
if (surface)
{
pixels = evas_cache_image_pixels(&surface->cache_entry);
w = surface->cache_entry.w;
h = surface->cache_entry.h;
+ x = ector_surface->x;
+ y = ector_surface->y;
}
if (use_cairo)
{
eo_do(_software_ector,
- ector_cairo_software_surface_set(pixels, w, h));
+ ector_cairo_software_surface_set(pixels, w, h),
+ ector_surface_reference_point_set(x, y));
}
else
{
eo_do(_software_ector,
- ector_software_surface_set(pixels, w, h));
+ ector_software_surface_set(pixels, w, h),
+ ector_surface_reference_point_set(x, y));
}
evas_common_cpu_end_opt();
}
static void
-eng_ector_begin(void *data EINA_UNUSED, void *context EINA_UNUSED, void *surface, Eina_Bool do_async)
+eng_ector_begin(void *data EINA_UNUSED, void *context EINA_UNUSED, void *surface, int x, int y, Eina_Bool do_async)
{
if (do_async)
{
if (!nes) return ;
nes->surface = surface;
+ nes->x = x;
+ nes->y = y;
evas_thread_cmd_enqueue(_draw_thread_ector_surface_set, nes);
}
w = sf->cache_entry.w;
h = sf->cache_entry.h;
- eo_do(_software_ector,
- ector_cairo_software_surface_set(pixels, w, h));
+ if (use_cairo)
+ {
+ eo_do(_software_ector,
+ ector_cairo_software_surface_set(pixels, w, h),
+ ector_surface_reference_point_set(x, y));
+ }
+ else
+ {
+ eo_do(_software_ector,
+ ector_software_surface_set(pixels, w, h),
+ ector_surface_reference_point_set(x, y));
+ }
}
}