forked from enlightenment/efl
vg ector: Call a pair of ector begin/end for ector buffer drawing.
While we render vector drawing on ector,it uses ector buffers for subsequent compositions. In this sequence, it switches ector buffer with a composition target, while resuing the global ector context. Previously, it trickly switched ector buffer, it broke the ector begin/end pair. Now, it needs to recover global ector buffer once the composition finished. Thus ector buffer need to return the current pixels information for this.
This commit is contained in:
parent
562ae738cc
commit
19ef155526
|
@ -81,6 +81,16 @@ mixin @beta Ector.Buffer
|
|||
}
|
||||
return: bool; [[True if pixels_set was successful]]
|
||||
}
|
||||
pixels_get @pure_virtual {
|
||||
[[Gets the source pixels for the current buffer]]
|
||||
params {
|
||||
@out pixels: void_ptr; [[Returns buffer pixel pointer]]
|
||||
@out width: int; [[Returns buffer width]]
|
||||
@out height: int; [[Returns buffer height]]
|
||||
@out stride: int; [[Returns buffer stride size]]
|
||||
}
|
||||
return: bool; [[True if returned pixels is writable]]
|
||||
}
|
||||
@property flags {
|
||||
[[The capabilities of this buffer]]
|
||||
get {}
|
||||
|
|
|
@ -5,10 +5,10 @@ mixin @beta Ector.Surface extends Ector.Buffer
|
|||
c_prefix: ector_surface;
|
||||
data: null;
|
||||
methods {
|
||||
@property reference_point {
|
||||
@property reference_point @pure_virtual {
|
||||
[[This defines where (0,0) is in pixel coordinates inside the surface]]
|
||||
set @pure_virtual {
|
||||
}
|
||||
set {}
|
||||
get {}
|
||||
values {
|
||||
x: int; [[X coordinate for reference point]]
|
||||
y: int; [[Y coordinate for reference point]]
|
||||
|
|
|
@ -63,6 +63,17 @@ _ector_software_buffer_base_pixels_clear(Eo *obj EINA_UNUSED, Ector_Software_Buf
|
|||
pd->nofree = EINA_FALSE;
|
||||
}
|
||||
|
||||
EOLIAN static Eina_Bool
|
||||
_ector_software_buffer_base_ector_buffer_pixels_get(Eo *obj, Ector_Software_Buffer_Base_Data *pd,
|
||||
void **pixels, int* width, int* height, int* stride)
|
||||
{
|
||||
if (*pixels) *pixels = pd->pixels.u8;
|
||||
if (*width) *width = pd->generic->w;
|
||||
if (*height) *height = pd->generic->h;
|
||||
if (*stride) *stride = pd->stride;
|
||||
return pd->writable;
|
||||
}
|
||||
|
||||
EOLIAN static Eina_Bool
|
||||
_ector_software_buffer_base_ector_buffer_pixels_set(Eo *obj, Ector_Software_Buffer_Base_Data *pd,
|
||||
void *pixels, int width, int height, int stride,
|
||||
|
|
|
@ -10,6 +10,7 @@ mixin @beta Ector.Software.Buffer.Base extends Ector.Buffer
|
|||
implements {
|
||||
Ector.Buffer.flags { get; }
|
||||
Ector.Buffer.pixels_set;
|
||||
Ector.Buffer.pixels_get;
|
||||
Ector.Buffer.map;
|
||||
Ector.Buffer.unmap;
|
||||
}
|
||||
|
|
|
@ -238,6 +238,15 @@ _ector_software_surface_efl_object_destructor(Eo *obj, Ector_Software_Surface_Da
|
|||
_ector_software_shutdown();
|
||||
}
|
||||
|
||||
static void
|
||||
_ector_software_surface_ector_surface_reference_point_get(const Eo *obj EINA_UNUSED,
|
||||
Ector_Software_Surface_Data *pd,
|
||||
int* x, int* y)
|
||||
{
|
||||
if (x) *x = pd->x;
|
||||
if (y) *y = pd->y;
|
||||
}
|
||||
|
||||
static void
|
||||
_ector_software_surface_ector_surface_reference_point_set(Eo *obj EINA_UNUSED,
|
||||
Ector_Software_Surface_Data *pd,
|
||||
|
|
|
@ -5,7 +5,7 @@ class @beta Ector.Software.Surface extends Ector.Software.Buffer implements Ecto
|
|||
methods {}
|
||||
implements {
|
||||
Ector.Surface.renderer_factory_new;
|
||||
Ector.Surface.reference_point { set; }
|
||||
Ector.Surface.reference_point { set; get; }
|
||||
Ector.Surface.draw_image;
|
||||
Efl.Object.destructor;
|
||||
Efl.Object.constructor;
|
||||
|
|
|
@ -440,6 +440,15 @@ _evas_vg_render(Evas_Object_Protected_Data *obj, Efl_Canvas_Vg_Object_Data *pd,
|
|||
memset(cd->blend.pixels, 0, cd->blend.length);
|
||||
}
|
||||
|
||||
//For recovery context
|
||||
int px, py, pw, ph, pstride;
|
||||
void *ppixels;
|
||||
ector_buffer_size_get(ector, &pw, &ph);
|
||||
ector_buffer_pixels_get(ector, &ppixels, &px, &ph, &pstride);
|
||||
Efl_Gfx_Colorspace pcspace = ector_buffer_cspace_get(ector);
|
||||
ector_surface_reference_point_get(ector, &px, &py);
|
||||
ERR("buffer = %p, %d %d %d %d, stride = %d, color = %d", ppixels, px,py, pw, ph, pstride, pcspace);
|
||||
|
||||
// Buffer change
|
||||
ector_buffer_pixels_set(ector, cd->blend.pixels,
|
||||
w, h, cd->blend.stride,
|
||||
|
@ -450,8 +459,9 @@ _evas_vg_render(Evas_Object_Protected_Data *obj, Efl_Canvas_Vg_Object_Data *pd,
|
|||
EINA_LIST_FOREACH(cd->children, l, child)
|
||||
_evas_vg_render(obj, pd, engine, output, context, child, clips, w, h, ector, do_async);
|
||||
|
||||
// Re-set original surface
|
||||
ENFN->ector_begin(engine, output, context, ector, 0, 0, EINA_FALSE, do_async);
|
||||
// Recover original surface
|
||||
ector_buffer_pixels_set(ector, ppixels, pw, ph, pstride, pcspace, EINA_TRUE);
|
||||
ector_surface_reference_point_set(ector, px, py);
|
||||
|
||||
// Draw buffer to original surface.(Ector_Surface)
|
||||
ector_surface_draw_image(ector, cd->blend.buffer, 0, 0, alpha);
|
||||
|
@ -501,12 +511,10 @@ _render_to_buffer(Evas_Object_Protected_Data *obj, Efl_Canvas_Vg_Object_Data *pd
|
|||
evas_common_draw_context_set_color(context, 255, 255, 255, 255);
|
||||
|
||||
//ector begin - end for drawing composite images.
|
||||
//ENFN->ector_begin(engine, buffer, context, ector, 0, 0, EINA_FALSE, EINA_FALSE);
|
||||
_evas_vg_render_pre(obj, root, engine, buffer, context, ector, NULL, 255, NULL, 0);
|
||||
//ENFN->ector_end(engine, buffer, context, ector, EINA_FALSE);
|
||||
|
||||
//Actual content drawing
|
||||
ENFN->ector_begin(engine, buffer, context, ector, 0, 0, EINA_TRUE, do_async);
|
||||
ENFN->ector_begin(engine, buffer, context, ector, 0, 0, do_async);
|
||||
|
||||
//draw on buffer
|
||||
_evas_vg_render(obj, pd,
|
||||
|
|
|
@ -1514,7 +1514,7 @@ struct _Evas_Func
|
|||
void (*ector_destroy) (void *engine, Ector_Surface *surface);
|
||||
Ector_Buffer *(*ector_buffer_wrap) (void *engine, Evas *e, void *engine_image);
|
||||
Ector_Buffer *(*ector_buffer_new) (void *engine, Evas *e, int width, int height, Efl_Gfx_Colorspace cspace, Ector_Buffer_Flag flags);
|
||||
void (*ector_begin) (void *engine, void *output, void *context, Ector_Surface *ector, int x, int y, Eina_Bool clear, Eina_Bool do_async);
|
||||
void (*ector_begin) (void *engine, void *output, void *context, Ector_Surface *ector, int x, int y, Eina_Bool do_async);
|
||||
void (*ector_renderer_draw) (void *engine, void *output, void *context, Ector_Renderer *r, Eina_Array *clips, Eina_Bool do_async);
|
||||
void (*ector_end) (void *engine, void *output, void *context, Ector_Surface *ector, Eina_Bool do_async);
|
||||
|
||||
|
|
|
@ -2715,7 +2715,7 @@ eng_ector_surface_cache_drop(void *engine, void *key)
|
|||
static void
|
||||
eng_ector_begin(void *engine, void *surface,
|
||||
void *context EINA_UNUSED, Ector_Surface *ector,
|
||||
int x, int y, Eina_Bool clear, Eina_Bool do_async EINA_UNUSED)
|
||||
int x, int y, Eina_Bool do_async EINA_UNUSED)
|
||||
{
|
||||
if (use_gl)
|
||||
{
|
||||
|
@ -2732,7 +2732,7 @@ eng_ector_begin(void *engine, void *surface,
|
|||
eng_image_stride_get(engine, glim, &stride);
|
||||
eng_image_size_get(engine, glim, &w, &h);
|
||||
|
||||
if (clear) memset(pixels, 0, stride * h);
|
||||
memset(pixels, 0, stride * h);
|
||||
|
||||
// it just uses the software backend to draw for now
|
||||
ector_buffer_pixels_set(ector, pixels, w, h, stride, EFL_GFX_COLORSPACE_ARGB8888, EINA_TRUE);
|
||||
|
|
Loading…
Reference in New Issue