Merge branch 'master' into devs/hermet/lottie

This commit is contained in:
Hermet Park 2019-07-24 10:23:34 +09:00
commit 188dddd86c
51 changed files with 914 additions and 129 deletions

View File

@ -3,6 +3,12 @@
<h1 id="{{id}}" data-uid="{{uid}}" class="text-break">{{>partials/title}}</h1>
<div class="markdown level0 summary">{{{summary}}}</div>
<div class="markdown level0 conceptual">{{{conceptual}}}</div>
{{#remarks}}
<div class="remarks">
<h5 id="{{id}}_remarks"><strong>{{__global.remarks}}</strong></h5>
{{{remarks}}}
</div>
{{/remarks}}
{{#inClass}}
<div class="inheritance">
<h5>{{__global.inheritance}}</h5>
@ -82,10 +88,6 @@
</tbody>
</table>
{{/syntax.typeParameters.0}}
{{#remarks}}
<h5 id="{{id}}_remarks"><strong>{{__global.remarks}}</strong></h5>
<div class="markdown level0 remarks">{{{remarks}}}</div>
{{/remarks}}
{{#example.0}}
<h5 id="{{id}}_examples"><strong>{{__global.examples}}</strong></h5>
{{/example.0}}

View File

@ -143,10 +143,6 @@
<h5 class="overrides">{{__global.overrides}}</h5>
<div><xref uid="{{uid}}" altProperty="fullName" displayProperty="nameWithType"/></div>
{{/overridden}}
{{#remarks}}
<h5 id="{{id}}_remarks">{{__global.remarks}}</h5>
<div class="markdown level1 remarks">{{{remarks}}}</div>
{{/remarks}}
{{#example.0}}
<h5 id="{{id}}_examples">{{__global.examples}}</h5>
{{/example.0}}

View File

@ -995,3 +995,9 @@ div.embeddedvideo iframe {
.mainContainer[dir='rtl'] main ul[role="tablist"] {
margin: 0; }
.remarks {
background-color: #c0c0ff;
border-radius: 6px;
padding: 6px;
}

View File

@ -30,6 +30,7 @@ const Ecore_Getopt optdesc = {
ECORE_GETOPT_STORE_INT('q', "quality", "define encoding quality in percent."),
ECORE_GETOPT_STORE_TRUE('c', "compress", "define if data should be compressed."),
ECORE_GETOPT_STORE_STR('e', "encoding", "define the codec (for TGV files: 'etc1', 'etc2', 'etc1+alpha')"),
ECORE_GETOPT_STORE_STR('m', "max-geometry", "define the max size in pixels (WidthxHeight) of any converted image, splitting the image as necessary in a grid pattern ('_XxY' will be appended to the file name)"),
ECORE_GETOPT_LICENSE('L', "license"),
ECORE_GETOPT_COPYRIGHT('C', "copyright"),
ECORE_GETOPT_VERSION('V', "version"),
@ -40,24 +41,50 @@ const Ecore_Getopt optdesc = {
typedef struct _Save_Job {
const char *output;
const char *extension;
const char *flags;
Evas_Object *im;
int ret;
} Save_Job;
static Save_Job job = { NULL, NULL, NULL, -1 };
static Save_Job job = { NULL, NULL, NULL, NULL, -1 };
static unsigned int width = 0, height = 0;
static unsigned int x = 0, y = 0;
static int image_w, image_h;
static void
_save_do(void *data EINA_UNUSED)
{
const char *output = job.output;
job.ret = 0;
if (!evas_object_image_save(job.im, job.output, NULL, job.flags))
if (width || height)
{
Eina_Slstr *str;
str = eina_slstr_printf("%s_%ux%u.%s", output, x / width, y / height, job.extension);
output = str;
evas_object_image_load_region_set(job.im, x, y, width, height);
x += width;
if ((int)x > image_w)
{
y += height;
x = 0;
}
}
fprintf(stderr, "Saving image '%s'\n", output);
if (!evas_object_image_save(job.im, output, NULL, job.flags))
{
EINA_LOG_ERR("Could not convert file to '%s'.", job.output);
job.ret = 1;
}
ecore_main_loop_quit();
if (!width || ((int)y > image_h)) ecore_main_loop_quit();
else ecore_job_add(_save_do, NULL);
}
#ifndef NO_SIGNAL
@ -81,6 +108,7 @@ main(int argc, char *argv[])
int quality = -1;
int r = -1;
char *encoding = NULL;
char *maxgeometry = NULL;
Eina_Bool compress = 1;
Eina_Bool quit_option = EINA_FALSE;
Eina_Strbuf *flags = NULL;
@ -89,6 +117,7 @@ main(int argc, char *argv[])
ECORE_GETOPT_VALUE_INT(quality),
ECORE_GETOPT_VALUE_BOOL(compress),
ECORE_GETOPT_VALUE_STR(encoding),
ECORE_GETOPT_VALUE_STR(maxgeometry),
ECORE_GETOPT_VALUE_BOOL(quit_option),
ECORE_GETOPT_VALUE_BOOL(quit_option),
ECORE_GETOPT_VALUE_BOOL(quit_option),
@ -116,6 +145,20 @@ main(int argc, char *argv[])
goto end;
}
if (maxgeometry)
{
if (sscanf(maxgeometry, "%ux%u", &width, &height) != 2)
{
EINA_LOG_ERR("max-geometry should be specified as WidthxHeight, like 1920x1280.");
goto end;
}
if (width == 0 || height == 0)
{
EINA_LOG_ERR("max-geometry width and height must be greater than 0.");
goto end;
}
}
ee = ecore_evas_buffer_new(1, 1);
e = ecore_evas_get(ee);
if (!e)
@ -142,11 +185,22 @@ main(int argc, char *argv[])
goto end;
}
evas_object_image_size_get(im, &image_w, &image_h);
#ifndef NO_SIGNAL
// Brutal way of
signal(SIGINT, _sigint);
#endif
// Find the extension and remove it
if (width || height)
{
char *tmp = strrchr(argv[arg_index + 1], '.');
if (tmp) *tmp = '\0';
if (tmp) job.extension = tmp + 1;
}
job.output = argv[arg_index + 1];
job.flags = eina_strbuf_string_get(flags);
job.im = im;

View File

@ -6,8 +6,6 @@
#include <Efl_Ui.h>
#include <Elementary.h>
#define CX 180
#define CY 150
#define CR 100
#define TEST_UI_TEXTPATH_LONG_TEXT "This text follows the path which you defined. This is a &lt;long&gt; text designed to make it ellipsis."
@ -31,7 +29,7 @@ _direction_changed_cb(void *data, const Efl_Event *event)
Eina_Bool val = elm_check_selected_get(event->object);
Efl_Ui_Textpath_Direction dir = val ? EFL_UI_TEXTPATH_DIRECTION_CW :
EFL_UI_TEXTPATH_DIRECTION_CCW;
efl_ui_textpath_circle_set(txtpath, CX, CY, CR, angle, dir);
efl_ui_textpath_circular_set(txtpath, CR, angle, dir);
}
static void
@ -43,7 +41,7 @@ _angle_changed_cb(void *data, const Efl_Event *event)
Eina_Bool val = elm_check_selected_get(dir_chk);
Efl_Ui_Textpath_Direction dir = val ? EFL_UI_TEXTPATH_DIRECTION_CW :
EFL_UI_TEXTPATH_DIRECTION_CCW;
efl_ui_textpath_circle_set(txtpath, CX, CY, CR, angle, dir);
efl_ui_textpath_circular_set(txtpath, CR, angle, dir);
}
static void
@ -76,7 +74,7 @@ _change_shape_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA
Eina_Bool val = elm_check_selected_get(dir_chk);
Efl_Ui_Textpath_Direction dir = val ? EFL_UI_TEXTPATH_DIRECTION_CW :
EFL_UI_TEXTPATH_DIRECTION_CCW;
efl_ui_textpath_circle_set(txtpath, CX, CY, CR, angle, dir);
efl_ui_textpath_circular_set(txtpath, CR, angle, dir);
}
}
@ -109,7 +107,7 @@ test_ui_textpath(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *eve
efl_text_set(txtpath, TEST_UI_TEXTPATH_LONG_TEXT);
efl_ui_textpath_circle_set(txtpath, CX, CY, CR, 0, EFL_UI_TEXTPATH_DIRECTION_CCW);
efl_ui_textpath_circular_set(txtpath, CR, 0, EFL_UI_TEXTPATH_DIRECTION_CCW);
efl_gfx_entity_visible_set(txtpath, EINA_TRUE);
path_type = 0;

View File

@ -35,6 +35,8 @@ _gen_param(Eina_Strbuf *buf, Eolian_Function_Parameter *pr,
eina_strbuf_append(buf, _get_add_star(ftype, eolian_parameter_direction_get(pr)));
eina_strbuf_append(buf, prn);
eina_stringshare_del(prtn);
if (eolian_type_is_owned(eolian_parameter_type_get(pr)))
eina_strbuf_append(buf, " EFL_TRANSFER_OWNERSHIP");
*rpid = 0;
return 1;
}
@ -166,6 +168,8 @@ _gen_func(const Eolian_State *state, const Eolian_Function *fid,
flagbuf = eina_strbuf_new();
eina_strbuf_prepend(flagbuf, " EINA_WARN_UNUSED_RESULT");
}
if (rtp && eolian_type_is_owned(rtp))
eina_strbuf_append(buf, " EFL_TRANSFER_OWNERSHIP");
if (flagbuf)
{
eina_strbuf_append(buf, eina_strbuf_string_get(flagbuf));

View File

@ -12,6 +12,9 @@
#include <Eina.h>
static const std::string BETA_REF_SUFFIX = " (object still in beta stage)";
static const std::string BETA_CLASS_REMARK = "This is a \\<b\\>BETA\\</b\\> class. It can be modified or removed in the future. Do not use it for product development.";
static const std::string BETA_PROPERTY_REMARK = "\n\n\\<b\\>This is a BETA property\\</b\\>. It can be modified or removed in the future. Do not use it for product development.";
static const std::string BETA_METHOD_REMARK = "\n\n\\<b\\>This is a BETA method\\</b\\>. It can be modified or removed in the future. Do not use it for product development.";
namespace eolian_mono {
@ -390,6 +393,11 @@ struct documentation_generator
{
if (!generate(sink, klass.documentation, context)) return false;
if (klass.is_beta)
{
if (!generate_tag(sink, "remarks", BETA_CLASS_REMARK, context)) return false;
}
std::string klass_name = name_helpers::klass_full_concrete_or_interface_name(klass);
return generate_tag_example(sink, klass_name, context);
}
@ -397,7 +405,17 @@ struct documentation_generator
template<typename OutputIterator, typename Context>
bool generate(OutputIterator sink, attributes::property_def const& prop, Context const& context) const
{
if (!generate(sink, prop.documentation, context))
std::string tail_text = "";
if (!prop.klass.is_beta)
{
if ((prop.setter.is_engaged() && prop.setter->is_beta) ||
(prop.getter.is_engaged() && prop.getter->is_beta))
{
tail_text = BETA_PROPERTY_REMARK;
}
}
if (!generate(sink, prop.documentation, context, tail_text))
return false;
std::string text;
@ -428,16 +446,21 @@ struct documentation_generator
template<typename OutputIterator, typename Context>
bool generate_property(OutputIterator sink, attributes::function_def const& func, Context const& context) const
{
std::string tail_text = "";
if (!func.klass.is_beta && func.is_beta)
{
tail_text = BETA_METHOD_REMARK;
}
// First, try the get/set specific documentation
if (!func.documentation.summary.empty())
{
if (!generate(sink, func.documentation, context))
if (!generate(sink, func.documentation, context, tail_text))
return false;
}
else // fallback to common property documentation
{
if (!generate(sink, func.property_documentation, context))
if (!generate(sink, func.property_documentation, context, tail_text))
return false;
}
@ -457,7 +480,13 @@ struct documentation_generator
template<typename OutputIterator, typename Context>
bool generate_function(OutputIterator sink, attributes::function_def const& func, Context const& context) const
{
if (!generate(sink, func.documentation, context))
std::string tail_text = "";
if (!func.klass.is_beta && func.is_beta)
{
tail_text = BETA_METHOD_REMARK;
}
if (!generate(sink, func.documentation, context, tail_text))
return false;
for (auto&& param : func.parameters)
@ -480,11 +509,12 @@ struct documentation_generator
}
template<typename OutputIterator, typename Context>
bool generate(OutputIterator sink, attributes::documentation_def const& doc, Context const& context) const
bool generate(OutputIterator sink, attributes::documentation_def const& doc, Context const& context, std::string tail_text = "") const
{
std::string str = doc.full_text;
if (!doc.since.empty())
str += "\n(Since EFL " + doc.since + ")";
str += tail_text;
return generate_tag_summary(sink, str, context);
}

View File

@ -103,6 +103,20 @@ struct marshall_type_visitor_generate
r.namespaces.clear();
return r;
}}
, {"binbuf", nullptr, [&]
{
regular_type_def r = regular;
r.base_type = "System.IntPtr";
r.namespaces.clear();
return r;
}}
, {"event", nullptr, [&]
{
regular_type_def r = regular;
r.base_type = "Efl.Event.NativeStruct";
r.namespaces.clear();
return r;
}}
, {"any_value", true, [&]
{
regular_type_def r = regular;

View File

@ -214,6 +214,14 @@ struct visitor_generate
{
return regular_type_def{"Eina.Strbuf", regular.base_qualifier, {}};
}}
, {"binbuf", nullptr, [&]
{
return regular_type_def{"Eina.Binbuf", regular.base_qualifier, {}};
}}
, {"event", nullptr, [&]
{
return regular_type_def{"Efl.Event", regular.base_qualifier, {}};
}}
, {"any_value", true, [&]
{ return regular_type_def{"Eina.Value", regular.base_qualifier, {}};
}}

View File

@ -30,9 +30,9 @@
#include "evas-common.h"
#define WIDTH 400
#define HEIGHT 400
#define HEIGHT 600
static Eo *gvg[4];
static Eo *gvg[5];
static void
running_cb(void *data EINA_UNUSED, const Efl_Event *event)
@ -41,7 +41,7 @@ running_cb(void *data EINA_UNUSED, const Efl_Event *event)
double progress = event_running->progress;
int i;
for (i = 0; i < 4; i++)
for (i = 0; i < 5; i++)
{
double frameCnt = (double) (efl_gfx_frame_controller_frame_count_get(gvg[i]) - 1);
int frame = (int) (frameCnt * progress);
@ -58,6 +58,9 @@ _on_delete(Ecore_Evas *ee EINA_UNUSED)
int
main(void)
{
//Cairo backend is not supported.
setenv("ECTOR_BACKEND", "default", 1);
if (!ecore_evas_init())
return EXIT_FAILURE;
@ -109,6 +112,14 @@ main(void)
efl_gfx_entity_size_set(vg4, EINA_SIZE2D(200, 200));
efl_gfx_entity_visible_set(vg4, EINA_TRUE);
//5
Eo* vg5 = gvg[4] = efl_add(EFL_CANVAS_VG_OBJECT_CLASS, evas);
snprintf(buf, sizeof(buf), "%s/image_embedded.json", PACKAGE_EXAMPLES_DIR EVAS_VG_FOLDER);
efl_file_simple_load(vg5, buf, NULL);
efl_gfx_entity_position_set(vg5, EINA_POSITION2D(0, 400));
efl_gfx_entity_size_set(vg5, EINA_SIZE2D(200, 200));
efl_gfx_entity_visible_set(vg5, EINA_TRUE);
//Play custom animation
Eo *anim = efl_add(EFL_CANVAS_ANIMATION_CLASS, evas);
efl_animation_duration_set(anim, efl_gfx_frame_controller_frame_duration_get(vg, 0, 0));

File diff suppressed because one or more lines are too long

View File

@ -176,14 +176,17 @@ _ecore_evas_buffer_prepare(Ecore_Evas *ee)
evas_object_image_size_get(bdata->image, &w, &h);
if ((w != ee->w) || (h != ee->h))
_ecore_evas_resize(ee, w, h);
bdata->pixels = evas_object_image_data_get(bdata->image, 1);
if (evas_changed_get(ee->evas) && !bdata->lock_data)
{
bdata->pixels = evas_object_image_data_get(bdata->image, 1);
bdata->lock_data = EINA_TRUE;
}
}
else if (bdata->resized)
{
if (ee->func.fn_resize) ee->func.fn_resize(ee);
bdata->resized = 0;
}
return EINA_TRUE;
}
@ -200,6 +203,8 @@ _ecore_evas_buffer_update_image(void *data, Evas *e EINA_UNUSED, void *event_inf
EINA_LIST_FOREACH(post->updated_area, l, r)
evas_object_image_data_update_add(bdata->image,
r->x, r->y, r->w, r->h);
bdata->lock_data = EINA_FALSE;
}
EAPI int

View File

@ -9,7 +9,7 @@ struct _Ecore_Evas_Engine_Buffer_Data {
void (*free_func) (void *data, void *pix);
void *(*alloc_func) (void *data, int size);
void *data;
Eina_Bool in_render : 1;
Eina_Bool lock_data : 1;
Eina_Bool resized : 1;
};

View File

@ -47,6 +47,7 @@ typedef struct _Ector_Renderer_Gradient_Data Ector_Renderer_Gradient_Data;
typedef struct _Ector_Renderer_Gradient_Linear_Data Ector_Renderer_Gradient_Linear_Data;
typedef struct _Ector_Renderer_Gradient_Radial_Data Ector_Renderer_Gradient_Radial_Data;
typedef struct _Ector_Renderer_Shape_Data Ector_Renderer_Shape_Data;
typedef struct _Ector_Renderer_Image_Data Ector_Renderer_Image_Data;
typedef struct _Ector_Renderer_Buffer_Data Ector_Renderer_Buffer_Data;
struct _Ector_Renderer_Data
@ -99,6 +100,11 @@ struct _Ector_Renderer_Shape_Data
} stroke;
};
struct _Ector_Renderer_Image_Data
{
Ector_Buffer *buffer;
};
struct _Ector_Renderer_Buffer_Data
{
Ector_Buffer *eo_buffer;

View File

@ -3,6 +3,7 @@
#include "ector_renderer.eo.h"
#include "ector_renderer_shape.eo.h"
#include "ector_renderer_image.eo.h"
#include "ector_renderer_gradient.eo.h"
#include "ector_renderer_gradient_linear.eo.h"
#include "ector_renderer_gradient_radial.eo.h"

View File

@ -0,0 +1,22 @@
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <Eina.h>
#include <Ector.h>
#include "ector_private.h"
#define MY_CLASS ECTOR_RENDERER_IMAGE_MIXIN
static void
_ector_renderer_image_buffer_set(Eo *obj EINA_UNUSED,
Ector_Renderer_Image_Data *pd,
Ector_Buffer *buffer)
{
pd->buffer = buffer;
}
#include "ector_renderer_image.eo.c"

View File

@ -0,0 +1,16 @@
import ector_renderer;
mixin @beta Ector.Renderer.Image
{
[[Ector image renderer mixin]]
c_prefix: ector_renderer_image;
methods {
@property buffer {
set {
}
values {
buffer : Ector.Buffer; [[Image buffer]]
}
}
}
}

View File

@ -14,6 +14,7 @@ ector_src = [
'ector_gl_internal.h',
'ector_buffer.c',
'ector_renderer_shape.c',
'ector_renderer_image.c',
'ector_renderer.c',
'ector_renderer_gradient.c',
'ector_renderer_gradient_radial.c',
@ -25,6 +26,7 @@ pub_eo_files = [
'ector_buffer.eo',
'ector_renderer.eo',
'ector_renderer_shape.eo',
'ector_renderer_image.eo',
'ector_renderer_gradient.eo',
'ector_renderer_gradient_radial.eo',
'ector_renderer_gradient_linear.eo'

View File

@ -36,6 +36,7 @@
#include "software/ector_software_buffer_base.eo.h"
#include "software/ector_renderer_software.eo.h"
#include "software/ector_renderer_software_shape.eo.h"
#include "software/ector_renderer_software_image.eo.h"
#include "software/ector_renderer_software_gradient_linear.eo.h"
#include "software/ector_renderer_software_gradient_radial.eo.h"

View File

@ -0,0 +1,194 @@
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <math.h>
#include <float.h>
#include <Eina.h>
#include <Ector.h>
#include <software/Ector_Software.h>
#include "ector_private.h"
#include "ector_software_private.h"
#define MY_CLASS ECTOR_RENDERER_SOFTWARE_IMAGE_CLASS
typedef struct _Ector_Renderer_Software_Image_Data Ector_Renderer_Software_Image_Data;
struct _Ector_Renderer_Software_Image_Data
{
Ector_Software_Surface_Data *surface;
Ector_Renderer_Image_Data *image;
Ector_Renderer_Data *base;
Ector_Buffer *mask;
int mask_op;
int opacity;
Eina_Matrix3 inv_m;
struct {
int x1, y1, x2, y2;
} boundary;
};
static Eina_Bool
_ector_renderer_software_image_ector_renderer_prepare(Eo *obj,
Ector_Renderer_Software_Image_Data *pd)
{
if (!pd->surface)
pd->surface = efl_data_xref(pd->base->surface, ECTOR_SOFTWARE_SURFACE_CLASS, obj);
if (!pd->image->buffer || !pd->surface->rasterizer->fill_data.raster_buffer)
return EINA_FALSE;
Eina_Matrix3 m;
double m11, m12, m21, m22, m31, m32;
int x = pd->surface->x + (int)pd->base->origin.x;
int y = pd->surface->y + (int)pd->base->origin.y;
int image_w, image_h;
ector_buffer_size_get(pd->image->buffer, &image_w, &image_h);
double px[4] = {x, x + image_w, x, x + image_w};
double py[4] = {y, y, y + image_h, y + image_h};
//Only use alpha color
pd->opacity = pd->base->color.a;
/*ector_software_rasterizer_color_set(pd->surface->rasterizer,
pd->base->color.r,
pd->base->color.g,
pd->base->color.b,
pd->base->color.a);*/
if (!pd->base->m)
{
eina_matrix3_identity(&m);
eina_matrix3_scale(&m, (double)pd->surface->rasterizer->fill_data.raster_buffer->generic->w / (double)image_w,
(double)pd->surface->rasterizer->fill_data.raster_buffer->generic->h / (double)image_h);
}
else
eina_matrix3_copy(&m, pd->base->m);
eina_matrix3_values_get(&m, &m11, &m12, NULL,
&m21, &m22, NULL,
&m31, &m32, NULL);
//Calc draw boundbox
pd->boundary.x1 = MAX(pd->surface->rasterizer->fill_data.raster_buffer->generic->w , (unsigned int)image_w);
pd->boundary.y1 = MAX(pd->surface->rasterizer->fill_data.raster_buffer->generic->h , (unsigned int)image_h);
pd->boundary.x2 = 0; pd->boundary.y2 = 0;
for (int i = 0; i < 4; i++)
{
pd->boundary.x1 = MIN(pd->boundary.x1, (int)(((px[i] * m11) + (py[i] * m21) + m31) + 0.5));
pd->boundary.y1 = MIN(pd->boundary.y1, (int)(((px[i] * m12) + (py[i] * m22) + m32) + 0.5));
pd->boundary.x2 = MAX(pd->boundary.x2, (int)(((px[i] * m11) + (py[i] * m21) + m31) + 0.5));
pd->boundary.y2 = MAX(pd->boundary.y2, (int)(((px[i] * m12) + (py[i] * m22) + m32) + 0.5));
}
eina_matrix3_inverse(&m, &pd->inv_m);
return EINA_TRUE;
}
//FIXME: We need to implement that apply op, clips and mul_col.
static Eina_Bool
_ector_renderer_software_image_ector_renderer_draw(Eo *obj EINA_UNUSED,
Ector_Renderer_Software_Image_Data *pd,
Efl_Gfx_Render_Op op EINA_UNUSED, Eina_Array *clips EINA_UNUSED,
unsigned int mul_col EINA_UNUSED)
{
if (!pd->image->buffer || !pd->surface->rasterizer->fill_data.raster_buffer->pixels.u32)
return EINA_FALSE;
if (pd->opacity == 0)
return EINA_TRUE;
const int pix_stride = pd->surface->rasterizer->fill_data.raster_buffer->stride / 4;
Ector_Software_Buffer_Base_Data *mask = pd->mask ? efl_data_scope_get(pd->mask, ECTOR_SOFTWARE_BUFFER_BASE_MIXIN) : NULL;
Ector_Software_Buffer_Base_Data *bpd = efl_data_scope_get(pd->image->buffer, ECTOR_SOFTWARE_BUFFER_BASE_MIXIN);
double im11, im12, im21, im22, im31, im32;
uint32_t *dst_buf, *src_buf;
int image_w, image_h;
ector_buffer_size_get(pd->image->buffer, &image_w, &image_h);
dst_buf = pd->surface->rasterizer->fill_data.raster_buffer->pixels.u32;
src_buf = bpd->pixels.u32;
eina_matrix3_values_get(&pd->inv_m, &im11, &im12, NULL,
&im21, &im22, NULL,
&im31, &im32, NULL);
//Draw
for (int local_y = pd->boundary.y1; local_y < pd->boundary.y2; local_y++)
{
for (int local_x = pd->boundary.x1; local_x < pd->boundary.x2; local_x++)
{
uint32_t *dst = dst_buf + ((int)local_x + ((int)local_y * pix_stride));
int rx, ry;
rx = (int)(((double)local_x * im11) + ((double)local_y * im21) + im31 + 0.5);
ry = (int)(((double)local_x * im12) + ((double)local_y * im22) + im32 + 0.5);
if (rx < 0 || rx >= image_w || ry < 0 || ry >= image_h)
continue;
uint32_t *src = src_buf + (rx + (ry * image_w)); //FIXME: use to stride
uint32_t temp = 0x0;
if (mask)
{
uint32_t *m = mask->pixels.u32 + ((int)local_x + ((int)local_y * mask->generic->w));
//FIXME : This masking can work only matte case.
// We need consider to inverse matte case.
temp = draw_mul_256((((*m)>>24) * pd->opacity)>>8, *src);
}
else
{
temp = draw_mul_256(pd->opacity, *src);
}
int inv_alpha = 255 - ((temp) >> 24);
*dst = temp + draw_mul_256(inv_alpha, *dst);
}
}
return EINA_TRUE;
}
static Eo *
_ector_renderer_software_image_efl_object_constructor(Eo *obj, Ector_Renderer_Software_Image_Data *pd)
{
obj = efl_constructor(efl_super(obj, MY_CLASS));
if (!obj) return NULL;
pd->image = efl_data_xref(obj, ECTOR_RENDERER_IMAGE_MIXIN, obj);
pd->base = efl_data_xref(obj, ECTOR_RENDERER_CLASS, obj);
return obj;
}
static void
_ector_renderer_software_image_efl_object_destructor(Eo *obj, Ector_Renderer_Software_Image_Data *pd)
{
efl_data_xunref(pd->base->surface, pd->surface, obj);
efl_data_xunref(obj, pd->base, obj);
efl_data_xunref(obj, pd->image, obj);
efl_destructor(efl_super(obj, MY_CLASS));
}
unsigned int
_ector_renderer_software_image_ector_renderer_crc_get(const Eo *obj,
Ector_Renderer_Software_Image_Data *pd)
{
unsigned int crc;
crc = ector_renderer_crc_get(efl_super(obj, MY_CLASS));
crc = eina_crc((void*) pd->image, sizeof (Ector_Renderer_Image_Data), crc, EINA_FALSE);
return crc;
}
static void
_ector_renderer_software_image_ector_renderer_mask_set(Eo *obj EINA_UNUSED,
Ector_Renderer_Software_Image_Data *pd,
Ector_Buffer *mask,
int op)
{
pd->mask = mask;
pd->mask_op = op;
}
#include "ector_renderer_software_image.eo.c"

View File

@ -0,0 +1,13 @@
class @beta Ector.Renderer.Software.Image extends Ector.Renderer.Software implements Ector.Renderer.Image
{
[[Ector software renderer image class]]
c_prefix: ector_renderer_software_image;
implements {
Ector.Renderer.prepare;
Ector.Renderer.draw;
Ector.Renderer.mask { set; }
Ector.Renderer.crc { get; }
Efl.Object.constructor;
Efl.Object.destructor;
}
}

View File

@ -204,6 +204,8 @@ _ector_software_surface_ector_surface_renderer_factory_new(Eo *obj,
{
if (type == ECTOR_RENDERER_SHAPE_MIXIN)
return efl_add_ref(ECTOR_RENDERER_SOFTWARE_SHAPE_CLASS, NULL, ector_renderer_surface_set(efl_added, obj));
else if (type == ECTOR_RENDERER_IMAGE_MIXIN)
return efl_add_ref(ECTOR_RENDERER_SOFTWARE_IMAGE_CLASS, NULL, ector_renderer_surface_set(efl_added, obj));
else if (type == ECTOR_RENDERER_GRADIENT_LINEAR_MIXIN)
return efl_add_ref(ECTOR_RENDERER_SOFTWARE_GRADIENT_LINEAR_CLASS, NULL, ector_renderer_surface_set(efl_added, obj));
else if (type == ECTOR_RENDERER_GRADIENT_RADIAL_MIXIN)

View File

@ -3,6 +3,7 @@ ector_src += files([
'ector_renderer_software_gradient_linear.c',
'ector_renderer_software_gradient_radial.c',
'ector_renderer_software_shape.c',
'ector_renderer_software_image.c',
'ector_software_gradient.c',
'ector_software_rasterizer.c',
'ector_software_surface.c',
@ -16,6 +17,7 @@ pub_eo_files = [
'ector_software_buffer_base.eo',
'ector_renderer_software.eo',
'ector_renderer_software_shape.eo',
'ector_renderer_software_image.eo',
'ector_renderer_software_gradient_radial.eo',
'ector_renderer_software_gradient_linear.eo',
]

View File

@ -129,6 +129,19 @@ _efl_ui_check_efl_ui_widget_on_access_activate(Eo *obj EINA_UNUSED, Efl_Ui_Check
return EINA_TRUE;
}
EOLIAN static void
_efl_ui_check_elm_layout_sizing_eval(Eo *obj, Efl_Ui_Check_Data *_pd EINA_UNUSED)
{
Evas_Coord minw = -1, minh = -1;
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
elm_coords_finger_size_adjust(1, &minw, 1, &minh);
edje_object_size_min_restricted_calc
(wd->resize_obj, &minw, &minh, minw, minh);
evas_object_size_hint_min_set(obj, minw, minh);
evas_object_size_hint_max_set(obj, -1, -1);
}
static Eina_Bool
_key_action_activate(Evas_Object *obj, const char *params EINA_UNUSED)
{
@ -396,7 +409,8 @@ ELM_LAYOUT_TEXT_ALIASES_IMPLEMENT(MY_CLASS_PFX)
#define EFL_UI_CHECK_EXTRA_OPS \
ELM_LAYOUT_CONTENT_ALIASES_OPS(MY_CLASS_PFX), \
ELM_LAYOUT_TEXT_ALIASES_OPS(MY_CLASS_PFX)
ELM_LAYOUT_TEXT_ALIASES_OPS(MY_CLASS_PFX), \
ELM_LAYOUT_SIZING_EVAL_OPS(efl_ui_check)
#include "efl_ui_check.eo.c"

View File

@ -756,7 +756,9 @@ _scroll_wheel_post_event_go(Efl_Ui_Scroll_Manager_Data *sd, int x, int y)
else
{
cur = efl_ui_pan_position_get(sd->pan_obj);
_scroll_manager_scrollto_animator_add(sd, cur.x, cur.y, x, y, 0.5, 0.5, INTERP_LINEAR);
_scroll_manager_scrollto_animator_add(sd, cur.x, cur.y, x, y,
_elm_config->bring_in_scroll_friction,
_elm_config->bring_in_scroll_friction, INTERP_DECEL);
}
}

View File

@ -70,6 +70,7 @@ struct _Efl_Ui_Textpath_Data
#ifdef EFL_UI_TEXTPATH_LINE_DEBUG
Eina_List *lines;
#endif
Eina_Bool circular : 1; //TODO: Remove this flag when elm_textpath_circle_set() is removed.
};
#define EFL_UI_TEXTPATH_DATA_GET(o, sd) \
@ -407,7 +408,7 @@ _path_data_get(Eo *obj, Efl_Ui_Textpath_Data *pd)
const Efl_Gfx_Path_Command_Type *cmd;
const double *points;
Efl_Ui_Textpath_Segment *seg;
Eina_Position2D opos;
Eina_Position2D obj_pos;
EINA_INLIST_FREE(pd->segments, seg)
{
@ -415,7 +416,16 @@ _path_data_get(Eo *obj, Efl_Ui_Textpath_Data *pd)
free(seg);
}
opos = efl_gfx_entity_position_get(obj);
obj_pos = efl_gfx_entity_position_get(obj);
/* textpath calculates boundary with the middle of text height.
this has better precise boundary than circle_set() behavior. */
if (pd->circular)
{
Eina_Size2D text_size = efl_gfx_entity_size_get(pd->text_obj);
obj_pos.x += (text_size.h / 2);
obj_pos.y += (text_size.h / 2);
}
pd->total_length = 0;
efl_gfx_path_get(obj, &cmd, &points);
@ -430,9 +440,9 @@ _path_data_get(Eo *obj, Efl_Ui_Textpath_Data *pd)
if (*cmd == EFL_GFX_PATH_COMMAND_TYPE_MOVE_TO)
{
pos++;
px0 = points[pos] + opos.x;
px0 = points[pos] + obj_pos.x;
pos++;
py0 = points[pos] + opos.y;
py0 = points[pos] + obj_pos.y;
}
else if (*cmd == EFL_GFX_PATH_COMMAND_TYPE_CUBIC_TO)
{
@ -441,17 +451,17 @@ _path_data_get(Eo *obj, Efl_Ui_Textpath_Data *pd)
Eina_Rect brect;
pos++;
ctrl_x0 = points[pos] + opos.x;
ctrl_x0 = points[pos] + obj_pos.x;
pos++;
ctrl_y0 = points[pos] + opos.y;
ctrl_y0 = points[pos] + obj_pos.y;
pos++;
ctrl_x1 = points[pos] + opos.x;
ctrl_x1 = points[pos] + obj_pos.x;
pos++;
ctrl_y1 = points[pos] + opos.y;
ctrl_y1 = points[pos] + obj_pos.y;
pos++;
px1 = points[pos] + opos.x;
px1 = points[pos] + obj_pos.x;
pos++;
py1 = points[pos] + opos.y;
py1 = points[pos] + obj_pos.y;
eina_bezier_values_set(&bz, px0, py0, ctrl_x0, ctrl_y0, ctrl_x1, ctrl_y1, px1, py1);
seg = malloc(sizeof(Efl_Ui_Textpath_Segment));
@ -481,9 +491,9 @@ _path_data_get(Eo *obj, Efl_Ui_Textpath_Data *pd)
Eina_Rect lrect;
pos++;
px1 = points[pos] + opos.x;
px1 = points[pos] + obj_pos.x;
pos++;
py1 = points[pos] + opos.y;
py1 = points[pos] + obj_pos.y;
seg = malloc(sizeof(Efl_Ui_Textpath_Segment));
if (!seg)
@ -612,6 +622,7 @@ _path_start_angle_adjust(Eo *obj, Efl_Ui_Textpath_Data *pd)
offset_angle /= 2.0;
efl_gfx_path_reset(obj);
if (pd->direction == EFL_UI_TEXTPATH_DIRECTION_CW_CENTER)
{
efl_gfx_path_append_arc(obj,
@ -753,21 +764,22 @@ _efl_ui_textpath_efl_ui_widget_theme_apply(Eo *obj, Efl_Ui_Textpath_Data *pd)
EOLIAN static void
_efl_ui_textpath_efl_gfx_entity_position_set(Eo *obj, Efl_Ui_Textpath_Data *pd, Eina_Position2D pos)
{
Eina_Position2D opos, diff;
Eina_Position2D ppos, diff;
Efl_Ui_Textpath_Segment *seg;
double sx, sy, csx, csy, cex, cey, ex, ey;
opos = efl_gfx_entity_position_get(obj);
diff.x = pos.x - opos.x;
diff.y = pos.y - opos.y;
ppos = efl_gfx_entity_position_get(obj);
efl_gfx_entity_position_set(efl_super(obj, MY_CLASS), pos);
if (ppos.x == pos.x && ppos.y == pos.y) return;
diff.x = pos.x - ppos.x;
diff.y = pos.y - ppos.y;
EINA_INLIST_FOREACH(pd->segments, seg)
{
eina_bezier_values_get(&seg->bezier, &sx, &sy, &csx, &csy,
&cex, &cey, &ex, &ey);
&cex, &cey, &ex, &ey);
sx += diff.x;
sy += diff.y;
csx += diff.x;
@ -778,53 +790,99 @@ _efl_ui_textpath_efl_gfx_entity_position_set(Eo *obj, Efl_Ui_Textpath_Data *pd,
ey += diff.y;
eina_bezier_values_set(&seg->bezier, sx, sy, csx, csy,
cex, cey, ex, ey);
cex, cey, ex, ey);
}
_text_draw(pd);
}
EOLIAN static void
_efl_ui_textpath_efl_gfx_entity_size_set(Eo *obj, Efl_Ui_Textpath_Data *pd EINA_UNUSED, Eina_Size2D sz)
_efl_ui_textpath_efl_gfx_entity_size_set(Eo *obj, Efl_Ui_Textpath_Data *pd EINA_UNUSED, Eina_Size2D size)
{
Eina_Size2D psize = efl_gfx_entity_size_get(obj);
efl_gfx_entity_size_set(efl_super(obj, MY_CLASS), sz);
if (psize.w != sz.w || psize.h != sz.h) _text_draw(pd);
Eina_Size2D psize, diff;
Efl_Ui_Textpath_Segment *seg;
double sx, sy, csx, csy, cex, cey, ex, ey;
psize = efl_gfx_entity_size_get(obj);
efl_gfx_entity_size_set(efl_super(obj, MY_CLASS), size);
if (psize.w == size.w && psize.h == size.h) return;
//TODO: Remove this condition if circle_set() is removed
if (pd->circle.radius > 0 && !pd->circular) return;
diff.w = (size.w - psize.w) * 0.5;
diff.h = (size.h - psize.h) * 0.5;
EINA_INLIST_FOREACH(pd->segments, seg)
{
eina_bezier_values_get(&seg->bezier, &sx, &sy, &csx, &csy,
&cex, &cey, &ex, &ey);
sx += diff.w;
sy += diff.h;
csx += diff.w;
csy += diff.h;
cex += diff.w;
cey += diff.h;
ex += diff.w;
ey += diff.h;
eina_bezier_values_set(&seg->bezier, sx, sy, csx, csy,
cex, cey, ex, ey);
}
_text_draw(pd);
}
EOLIAN static void
_efl_ui_textpath_circle_set(Eo *obj, Efl_Ui_Textpath_Data *pd, double x, double y, double radius, double start_angle, Efl_Ui_Textpath_Direction direction)
_efl_ui_textpath_circular_set(Eo *obj, Efl_Ui_Textpath_Data *pd, double radius, double start_angle, Efl_Ui_Textpath_Direction direction)
{
double sweep_length;
Eina_Size2D text_size;
double sweep_length, x, y;
if (pd->circle.x == x && pd->circle.y == y &&
pd->circle.radius == radius &&
if (pd->circle.radius == radius &&
pd->circle.start_angle == start_angle &&
pd->direction == direction &&
_map_point_calc(pd) > 0)
return;
pd->circle.x = x;
pd->circle.y = y;
Eina_Size2D obj_size = efl_gfx_entity_size_get(obj);
//textpath min size is same to circle bounadary */
text_size = efl_gfx_entity_size_get(pd->text_obj);
x = (obj_size.w - text_size.h - (2 * radius)) * 0.5;
y = (obj_size.h - text_size.h - (2 * radius)) * 0.5;
/* User leaves center position to textpath itself.
Now textpath automatically updates circle text according to
object position. */
pd->circle.x = radius + x;
pd->circle.y = radius + y;
pd->circle.radius = radius;
pd->circle.start_angle = start_angle;
pd->direction = direction;
pd->circular = EINA_TRUE;
efl_gfx_path_reset(obj);
if (direction == EFL_UI_TEXTPATH_DIRECTION_CW ||
direction == EFL_UI_TEXTPATH_DIRECTION_CW_CENTER)
sweep_length = -360;
else
sweep_length = 360;
else
sweep_length = -360;
efl_gfx_path_append_arc(obj, x - radius, y - radius, radius * 2,
efl_gfx_path_append_arc(obj,
pd->circle.x - pd->circle.radius,
pd->circle.y - pd->circle.radius,
radius * 2,
radius * 2, start_angle, sweep_length);
_path_data_get(obj, pd);
_path_start_angle_adjust(obj, pd);
_sizing_eval(pd);
efl_gfx_hint_size_min_set(obj, EINA_SIZE2D(x * 2, y * 2));
efl_gfx_hint_size_min_set(obj, EINA_SIZE2D((radius * 2) + text_size.h, (radius * 2) + text_size.h));
}
EOLIAN static int
@ -907,5 +965,44 @@ elm_textpath_add(Evas_Object *parent)
return elm_legacy_add(EFL_UI_TEXTPATH_LEGACY_CLASS, parent);
}
EAPI void
elm_textpath_circle_set(Eo *obj, double x, double y, double radius, double start_angle, Efl_Ui_Textpath_Direction direction)
{
double sweep_length;
EFL_UI_TEXTPATH_DATA_GET(obj, pd);
if (pd->circle.x == x && pd->circle.y == y &&
pd->circle.radius == radius &&
pd->circle.start_angle == start_angle &&
pd->direction == direction &&
_map_point_calc(pd) > 0)
return;
pd->circle.x = x;
pd->circle.y = y;
pd->circle.radius = radius;
pd->circle.start_angle = start_angle;
pd->direction = direction;
pd->circular = EINA_FALSE;
efl_gfx_path_reset(obj);
if (direction == EFL_UI_TEXTPATH_DIRECTION_CW ||
direction == EFL_UI_TEXTPATH_DIRECTION_CW_CENTER)
sweep_length = - 360;
else
sweep_length = 360;
efl_gfx_path_append_arc(obj, x - radius, y - radius, radius * 2,
radius * 2, start_angle, sweep_length);
_path_data_get(obj, pd);
_path_start_angle_adjust(obj, pd);
_sizing_eval(pd);
efl_gfx_hint_size_min_set(obj, EINA_SIZE2D(x * 2, y * 2));
}
#include "efl_ui_textpath_legacy_eo.c"

View File

@ -10,11 +10,10 @@ class @beta Efl.Ui.Textpath extends Efl.Ui.Layout_Base implements Efl.Text, Efl.
{
[[Efl Ui Textpath class]]
methods {
circle_set {
[[Set a circle with given center, radius, and start angle.]]
circular_set {
[[Set a circle with given radius and start angle.
The center of the circle will be decided by the object center position.]]
params {
@in x: double; [[X coordinate of center]]
@in y: double; [[Y coordinate of center]]
@in radius: double; [[Radius of the circle]]
@in start_angle: double; [[Start angle of the circle]]
@in direction: Efl.Ui.Textpath_Direction; [[Textpath direction]]

View File

@ -1,8 +1,8 @@
EAPI void
elm_textpath_circle_set(Efl_Ui_Textpath *obj, double x, double y, double radius, double start_angle, Efl_Ui_Textpath_Direction direction)
elm_textpath_circular_set(Efl_Ui_Textpath *obj, double radius, double start_angle, Efl_Ui_Textpath_Direction direction)
{
efl_ui_textpath_circle_set(obj, x, y, radius, start_angle, direction);
efl_ui_textpath_circular_set(obj, radius, start_angle, direction);
}
EAPI void
@ -23,6 +23,7 @@ elm_textpath_ellipsis_set(Efl_Ui_Textpath *obj, Eina_Bool ellipsis)
efl_ui_textpath_ellipsis_set(obj, ellipsis);
}
EAPI Eina_Bool
elm_textpath_ellipsis_get(const Efl_Ui_Textpath *obj)
{

View File

@ -27,18 +27,18 @@ typedef enum
#endif
/**
* @brief Set a circle with given center, radius, and start angle.
* @brief Set a circle with given radius, and start angle.
* The circle center will be decided by the object center position.
*
* @param[in] obj The object.
* @param[in] x X coordinate of center
* @param[in] y Y coordinate of center
* @param[in] radius Radius of the circle
* @param[in] start_angle Start angle of the circle
* @param[in] direction Textpath direction
*
* @since 1.23
* @ingroup Elm_Textpath_Group
*/
EAPI void elm_textpath_circle_set(Efl_Ui_Textpath *obj, double x, double y, double radius, double start_angle, Efl_Ui_Textpath_Direction direction);
EAPI void elm_textpath_circular_set(Efl_Ui_Textpath *obj, double radius, double start_angle, Efl_Ui_Textpath_Direction direction);
/**
* @brief The number of slices. The larger the number of slice_num is, The

View File

@ -301,7 +301,7 @@ _candidacy_exam(Eo *obj)
static void _full_eval(Eo *obj, Elm_Widget_Smart_Data *pd);
static Efl_Ui_Focus_Object*
_focus_manager_eval(Eo *obj, Elm_Widget_Smart_Data *pd, Eina_Bool want, Eina_Bool should)
_focus_manager_eval(Eo *obj, Elm_Widget_Smart_Data *pd)
{
Evas_Object *provider = NULL;
Evas_Object *parent;
@ -525,7 +525,7 @@ _full_eval(Eo *obj, Elm_Widget_Smart_Data *pd)
}
_focus_manager_eval(obj, pd, want_full, should);
_focus_manager_eval(obj, pd);
old_registered_parent = pd->focus.parent;
old_registered_manager = pd->focus.manager;
@ -1406,6 +1406,11 @@ _efl_ui_widget_widget_parent_set(Eo *obj, Elm_Widget_Smart_Data *pd, Efl_Ui_Widg
{
ELM_WIDGET_DATA_GET_OR_RETURN(parent, ppd);
EINA_SAFETY_ON_FALSE_RETURN(eina_list_data_find(ppd->subobjs, obj));
if (ppd->parent_obj == parent)
{
CRI("ATTEMPTING TO SET CHILD OF PARENT AS PARENT OF ITS OWN PARENT. THIS IS A BUG.");
return;
}
}
/* NOTE: In the following two lines, 'obj' is correct. Do not change it.
@ -1495,6 +1500,12 @@ _efl_ui_widget_widget_sub_object_add(Eo *obj, Elm_Widget_Smart_Data *sd, Evas_Ob
if (parent == obj) return EINA_TRUE;
if (parent)
{
if (sd->parent_obj == sobj)
{
CRI("ATTEMPTING TO SET CHILD OF PARENT AS PARENT OF ITS OWN PARENT. THIS IS A BUG.");
return EINA_FALSE;
}
if (!efl_ui_widget_sub_object_del(parent, sobj))
return EINA_FALSE;
}

View File

@ -1668,3 +1668,19 @@ EINA_DEPRECATED EAPI char *elm_access_external_info_get(const Evas_Object *obj);
// elm_win
EINA_DEPRECATED EAPI void elm_win_type_set(Evas_Object *obj, Elm_Win_Type type);
EINA_DEPRECATED EAPI void elm_win_name_set(Evas_Object *obj, const char *name);
/**
* @brief Set a circle with given center, radius, and start angle.
*
* @param[in] obj The object.
* @param[in] x X coordinate of center
* @param[in] y Y coordinate of center
* @param[in] radius Radius of the circle
* @param[in] start_angle Start angle of the circle
* @param[in] direction Textpath direction
*
* @deprecated Use elm_textpath_circluar_set() instead.
*
* @ingroup Elm_Textpath_Group
*/
EINA_DEPRECATED EAPI void elm_textpath_circle_set(Efl_Ui_Textpath *obj, double x, double y, double radius, double start_angle, Efl_Ui_Textpath_Direction direction);

View File

@ -212,6 +212,19 @@ EAPI extern unsigned int _efl_object_init_generation;
*/
typedef void (*Efl_Del_Intercept) (Eo *obj_id);
/**
* This is a no-operation. Its presence behind a function parameter indicates that
* ownership of the parameter is transferred to the callee.
* When present after a method, it indicates that the return value of the method is
* transferred to the caller.
* For objects, ownership transfer means that exactly one reference is transferred.
* If you transfer ownership without owning a reference in the first place, you will
* get unexpected behavior.
* For non-Objects, ownership transfer means that the responsibility of freeing a
* segment of memory is passed on.
*/
#define EFL_TRANSFER_OWNERSHIP
#include "efl_object_override.eo.h"
#include "efl_object.eo.h"
@ -2369,6 +2382,7 @@ EAPI Eina_Iterator *eo_objects_iterator_new(void);
* @return EINA_TRUE if the object is ownable. EINA_FALSE if not.
*/
EAPI Eina_Bool efl_ownable_get(const Eo *obj);
/**
* @}
*/

View File

@ -26,6 +26,7 @@ struct html_escaped_string_generator
case '\'': out.append("&apos;"); break;
case '<': out.append("&lt;"); break;
case '>': out.append("&gt;"); break;
case '\\': if (pos < input.size() - 1) pos++; // Deliberate fallthrough
default: out.append(&input[pos], 1); break;
}
}

View File

@ -452,6 +452,7 @@ typedef void (Evas_Canvas3D_Surface_Func)(Evas_Real *out_x,
#include "canvas/efl_canvas_vg_node.eo.h"
#include "canvas/efl_canvas_vg_container.eo.h"
#include "canvas/efl_canvas_vg_shape.eo.h"
#include "canvas/efl_canvas_vg_image.eo.h"
#include "canvas/efl_canvas_vg_gradient.eo.h"
#include "canvas/efl_canvas_vg_gradient_linear.eo.h"
#include "canvas/efl_canvas_vg_gradient_radial.eo.h"

View File

@ -0,0 +1,114 @@
#include "evas_common_private.h"
#include "evas_private.h"
#include "evas_vg_private.h"
#define MY_CLASS EFL_CANVAS_VG_IMAGE_CLASS
typedef struct _Efl_Canvas_Vg_Image_Data Efl_Canvas_Vg_Image_Data;
struct _Efl_Canvas_Vg_Image_Data
{
Ector_Buffer *buffer;
void *image;
int w;
int h;
};
static void
_efl_canvas_vg_image_render_pre(Evas_Object_Protected_Data *vg_pd,
Efl_VG *obj EINA_UNUSED,
Efl_Canvas_Vg_Node_Data *nd,
void *engine EINA_UNUSED, void *output EINA_UNUSED, void *context EINA_UNUSED,
Ector_Surface *surface,
Eina_Matrix3 *ptransform,
Ector_Buffer *mask,
int mask_op,
void *data)
{
Efl_Canvas_Vg_Image_Data *pd = data;
if (nd->flags == EFL_GFX_CHANGE_FLAG_NONE) return;
nd->flags = EFL_GFX_CHANGE_FLAG_NONE;
EFL_CANVAS_VG_COMPUTE_MATRIX(ctransform, ptransform, nd);
if (!nd->renderer)
{
efl_domain_current_push(EFL_ID_DOMAIN_SHARED);
nd->renderer = ector_surface_renderer_factory_new(surface, ECTOR_RENDERER_IMAGE_MIXIN);
efl_domain_current_pop();
}
if (!pd->buffer && pd->image)
{
Evas_Object_Protected_Data *obj = vg_pd;
if (pd->buffer) efl_unref(pd->buffer);
pd->buffer = ENFN->ector_buffer_new(ENC, obj->layer->evas->evas,
pd->w, pd->h,
EFL_GFX_COLORSPACE_ARGB8888,
ECTOR_BUFFER_FLAG_DRAWABLE |
ECTOR_BUFFER_FLAG_CPU_READABLE |
ECTOR_BUFFER_FLAG_CPU_WRITABLE);
ector_buffer_pixels_set(pd->buffer, pd->image,
pd->w, pd->h, 0,
EFL_GFX_COLORSPACE_ARGB8888, EINA_TRUE);
}
ector_renderer_image_buffer_set(nd->renderer, pd->buffer);
ector_renderer_transformation_set(nd->renderer, ctransform);
ector_renderer_origin_set(nd->renderer, nd->x, nd->y);
ector_renderer_color_set(nd->renderer, nd->r, nd->g, nd->b, nd->a);
ector_renderer_visibility_set(nd->renderer, nd->visibility);
ector_renderer_mask_set(nd->renderer, mask, mask_op);
ector_renderer_prepare(nd->renderer);
}
static Eo *
_efl_canvas_vg_image_efl_object_constructor(Eo *obj, Efl_Canvas_Vg_Image_Data *pd)
{
Efl_Canvas_Vg_Node_Data *nd;
obj = efl_constructor(efl_super(obj, MY_CLASS));
nd = efl_data_scope_get(obj, EFL_CANVAS_VG_NODE_CLASS);
nd->render_pre = _efl_canvas_vg_image_render_pre;
nd->data = pd;
efl_gfx_color_set(obj , 255, 255, 255, 255);
return obj;
}
static void
_efl_canvas_vg_image_efl_object_destructor(Eo *obj, Efl_Canvas_Vg_Image_Data *pd EINA_UNUSED)
{
efl_destructor(efl_super(obj, MY_CLASS));
if (pd->buffer)
{
efl_unref(pd->buffer);
pd->buffer = NULL;
}
}
static void
_efl_canvas_vg_image_data_set(Eo *obj EINA_UNUSED, Efl_Canvas_Vg_Image_Data *pd, void *data, Eina_Size2D size)
{
if (!data || size.w <= 0 || size.h <= 0)
return;
if ((pd->image != data || pd->w != size.w || pd->h != size.h) && pd->buffer)
{
efl_unref(pd->buffer);
pd->buffer= NULL;
}
pd->image = data;
pd->w = size.w;
pd->h = size.h;
}
#include "efl_canvas_vg_image.eo.c"

View File

@ -0,0 +1,19 @@
class @beta Efl.Canvas.Vg.Image extends Efl.Canvas.Vg.Node implements Efl.Gfx.Image
{
[[Efl vector graphics image class]]
methods {
@property data {
[[Set image data]]
set {
}
values {
pixels: void_ptr; [[Image pixels data. The pixel data type is 32bit RGBA]]
size: Eina.Size2D; [[The size in pixels.]]
}
}
}
implements {
Efl.Object.constructor;
Efl.Object.destructor;
}
}

View File

@ -43,6 +43,7 @@ pub_eo_files = [
'efl_canvas_vg_node.eo',
'efl_canvas_vg_container.eo',
'efl_canvas_vg_shape.eo',
'efl_canvas_vg_image.eo',
'efl_canvas_vg_gradient.eo',
'efl_canvas_vg_gradient_radial.eo',
'efl_canvas_vg_gradient_linear.eo',
@ -184,6 +185,7 @@ evas_src += files([
'efl_canvas_vg_gradient_radial.c',
'efl_canvas_vg_utils.c',
'efl_canvas_vg_shape.c',
'efl_canvas_vg_image.c',
'evas_filter_mixin.c',
'evas_canvas3d_object.c',
'evas_canvas3d_scene.c',

View File

@ -42,6 +42,31 @@ _construct_drawable_nodes(Efl_Canvas_Vg_Container *parent, const LOTLayerNode *l
LOTNode *node = layer->mNodeList.ptr[i];
if (!node) continue;
//Image object
if (node->mImageInfo.data)
{
char *key = _get_key_val(node);
Efl_Canvas_Vg_Image *image = efl_key_data_get(parent, key);
if (!image)
{
image = efl_add(EFL_CANVAS_VG_IMAGE_CLASS, parent);
efl_key_data_set(parent, key, image);
}
efl_gfx_entity_visible_set(image, EINA_TRUE);
Eina_Matrix3 m;
eina_matrix3_identity(&m);
eina_matrix3_values_set( &m,
node->mImageInfo.mMatrix.m11, node->mImageInfo.mMatrix.m12, node->mImageInfo.mMatrix.m13,
node->mImageInfo.mMatrix.m21, node->mImageInfo.mMatrix.m22, node->mImageInfo.mMatrix.m23,
node->mImageInfo.mMatrix.m31, node->mImageInfo.mMatrix.m32, node->mImageInfo.mMatrix.m33);
efl_canvas_vg_node_transformation_set(image, &m);
efl_canvas_vg_image_data_set(image, node->mImageInfo.data, EINA_SIZE2D(node->mImageInfo.width, node->mImageInfo.height));
continue;
}
//Skip Invisible Stroke?
if (node->mStroke.enable && node->mStroke.width == 0)
{
@ -64,7 +89,7 @@ _construct_drawable_nodes(Efl_Canvas_Vg_Container *parent, const LOTLayerNode *l
else
efl_gfx_path_reset(shape);
efl_gfx_entity_visible_set(shape, EINA_TRUE);
efl_gfx_entity_visible_set(shape, EINA_TRUE);
#if DEBUG
for (int i = 0; i < depth; i++) printf(" ");
printf("%s (%p)\n", efl_class_name_get(efl_class_get(shape)), shape);

View File

@ -15,7 +15,7 @@ EFL_START_TEST(wl2_display_create)
{
Ecore_Wl2_Display *disp;
disp = ECORE_WL2_TEST_DISPLAY_SETUP();
disp = _display_setup();
ck_assert(disp != NULL);
}
EFL_END_TEST
@ -24,7 +24,7 @@ EFL_START_TEST(wl2_display_destroy)
{
Ecore_Wl2_Display *disp;
disp = ECORE_WL2_TEST_DISPLAY_SETUP();
disp = _display_setup();
ck_assert(disp != NULL);
ecore_wl2_display_destroy(disp);
@ -36,7 +36,7 @@ EFL_START_TEST(wl2_display_get)
Ecore_Wl2_Display *disp;
struct wl_display *wdisp;
disp = ECORE_WL2_TEST_DISPLAY_SETUP();
disp = _display_setup();
ck_assert(disp != NULL);
wdisp = ecore_wl2_display_get(disp);
@ -48,7 +48,7 @@ EFL_START_TEST(wl2_display_name_get)
{
Ecore_Wl2_Display *disp;
disp = ECORE_WL2_TEST_DISPLAY_SETUP();
disp = _display_setup();
ck_assert(disp != NULL);
ck_assert(ecore_wl2_display_name_get(disp) != NULL);
@ -59,7 +59,7 @@ EFL_START_TEST(wl2_display_connect)
{
Ecore_Wl2_Display *disp;
disp = ECORE_WL2_TEST_DISPLAY_CONNECT();
disp = _display_connect();
ck_assert(disp != NULL);
}
EFL_END_TEST
@ -68,7 +68,7 @@ EFL_START_TEST(wl2_display_disconnect)
{
Ecore_Wl2_Display *disp;
disp = ECORE_WL2_TEST_DISPLAY_CONNECT();
disp = _display_connect();
ck_assert(disp != NULL);
ecore_wl2_display_disconnect(disp);
@ -79,7 +79,7 @@ EFL_START_TEST(wl2_display_registry_get)
{
Ecore_Wl2_Display *disp;
disp = ECORE_WL2_TEST_DISPLAY_CONNECT();
disp = _display_connect();
ck_assert(disp != NULL);
ck_assert(ecore_wl2_display_registry_get(disp) != NULL);
@ -91,7 +91,7 @@ EFL_START_TEST(wl2_display_shm_get)
Ecore_Wl2_Display *disp;
struct wl_shm *shm;
disp = ECORE_WL2_TEST_DISPLAY_CONNECT();
disp = _display_connect();
ck_assert(disp != NULL);
shm = ecore_wl2_display_shm_get(disp);
@ -104,7 +104,7 @@ EFL_START_TEST(wl2_display_dmabuf_get)
Ecore_Wl2_Display *disp;
void *dma;
disp = ECORE_WL2_TEST_DISPLAY_CONNECT();
disp = _display_connect();
ck_assert(disp != NULL);
dma = ecore_wl2_display_dmabuf_get(disp);
@ -119,7 +119,7 @@ EFL_START_TEST(wl2_display_globals_get)
Eina_Iterator *itr;
void *data;
disp = ECORE_WL2_TEST_DISPLAY_CONNECT();
disp = _display_connect();
ck_assert(disp != NULL);
itr = ecore_wl2_display_globals_get(disp);
@ -140,7 +140,7 @@ EFL_START_TEST(wl2_display_screen_size_get)
Ecore_Wl2_Display *disp;
int w, h;
disp = ECORE_WL2_TEST_DISPLAY_CONNECT();
disp = _display_connect();
ck_assert(disp != NULL);
ecore_wl2_display_screen_size_get(disp, &w, &h);
@ -154,7 +154,7 @@ EFL_START_TEST(wl2_display_inputs_get)
Ecore_Wl2_Display *disp;
Eina_Iterator *itr;
disp = ECORE_WL2_TEST_DISPLAY_CONNECT();
disp = _display_connect();
ck_assert(disp != NULL);
itr = ecore_wl2_display_inputs_get(disp);

View File

@ -41,6 +41,95 @@ EFL_START_TEST(wl2_window_new)
}
EFL_END_TEST
EFL_START_TEST(wl2_window_surface_test)
{
Ecore_Wl2_Display *disp;
Ecore_Wl2_Window *win;
struct wl_surface *surf;
int id = -1;
disp = _display_connect();
ck_assert(disp != NULL);
win = _window_create(disp);
ck_assert(win != NULL);
surf = ecore_wl2_window_surface_get(win);
ck_assert(surf != NULL);
id = ecore_wl2_window_surface_id_get(win);
ck_assert_int_lt(id, 0);
ck_assert_int_eq(wl_proxy_get_id((struct wl_proxy *)surf), id);
}
EFL_END_TEST
EFL_START_TEST(wl2_window_rotation_get)
{
Ecore_Wl2_Display *disp;
Ecore_Wl2_Window *win;
int rot = -1;
disp = _display_connect();
ck_assert(disp != NULL);
win = _window_create(disp);
ck_assert(win != NULL);
rot = ecore_wl2_window_rotation_get(win);
ck_assert_int_lt(rot, 0);
}
EFL_END_TEST
EFL_START_TEST(wl2_window_output_find)
{
Ecore_Wl2_Display *disp;
Ecore_Wl2_Window *win;
Ecore_Wl2_Output *out;
disp = _display_connect();
ck_assert(disp != NULL);
win = _window_create(disp);
ck_assert(win != NULL);
out = ecore_wl2_window_output_find(win);
ck_assert(out != NULL);
}
EFL_END_TEST
EFL_START_TEST(wl2_window_aux_hints_supported_get)
{
Ecore_Wl2_Display *disp;
Ecore_Wl2_Window *win;
Eina_List *l;
disp = _display_connect();
ck_assert(disp != NULL);
win = _window_create(disp);
ck_assert(win != NULL);
l = ecore_wl2_window_aux_hints_supported_get(win);
ck_assert(l != NULL);
}
EFL_END_TEST
EFL_START_TEST(wl2_window_display_get)
{
Ecore_Wl2_Display *disp;
Ecore_Wl2_Window *win;
disp = _display_connect();
ck_assert(disp != NULL);
win = _window_create(disp);
ck_assert(win != NULL);
ck_assert(ecore_wl2_window_display_get(win) != NULL);
}
EFL_END_TEST
void
ecore_wl2_test_window(TCase *tc)
{
@ -48,5 +137,10 @@ ecore_wl2_test_window(TCase *tc)
{
/* window tests can only run if there is an existing compositor */
tcase_add_test(tc, wl2_window_new);
tcase_add_test(tc, wl2_window_surface_test);
tcase_add_test(tc, wl2_window_rotation_get);
tcase_add_test(tc, wl2_window_output_find);
tcase_add_test(tc, wl2_window_aux_hints_supported_get);
tcase_add_test(tc, wl2_window_display_get);
}
}

View File

@ -3,11 +3,8 @@
# include <Ecore_Wl2.h>
# define ECORE_WL2_TEST_DISPLAY_SETUP() _setup_display()
# define ECORE_WL2_TEST_DISPLAY_CONNECT() _connect_display()
static Ecore_Wl2_Display *
_setup_display(void)
_display_setup(void)
{
Ecore_Wl2_Display *disp;
@ -16,7 +13,7 @@ _setup_display(void)
}
static Ecore_Wl2_Display *
_connect_display(void)
_display_connect(void)
{
Ecore_Wl2_Display *disp;

View File

@ -9,7 +9,7 @@ ecore_wl2_suite_src = [
ecore_wl2_suite = executable('ecore_wl2_suite',
ecore_wl2_suite_src,
dependencies: [ecore_wl2, ecore, check],
dependencies: [ecore_wl2, ecore, check, wayland_protocol],
c_args : [
'-DTESTS_BUILD_DIR="'+meson.current_build_dir()+'"',
'-DTESTS_SRC_DIR="'+meson.current_source_dir()+'"']

View File

@ -12,7 +12,6 @@ namespace TestSuite
#if EFL_BETA
/*
class TestEinaBinbuf
{
private static readonly byte[] test_string = System.Text.Encoding.UTF8.GetBytes("0123456789ABCDEF");
@ -309,7 +308,6 @@ class TestEinaBinbuf
Test.Assert(t.binbuf_return_own_no_longer_own());
}
}
*/
#endif

View File

@ -153,7 +153,6 @@ class NativeInheritImpl : Dummy.TestObject
// //
//
#if EFL_BETA
/*
override public bool EinaBinbufIn(Eina.Binbuf binbuf)
{
binbuf_in_flag = true;
@ -282,7 +281,6 @@ class NativeInheritImpl : Dummy.TestObject
binbuf_return_own_binbuf = null;
return r;
}
*/
#endif
}

View File

@ -148,8 +148,8 @@ internal class StructHelpers
complex.Fany_value_ptr = new Eina.Value(Eina.ValueType.String);
complex.Fany_value_ptr.Set("abc");
//complex.Fbinbuf = new Eina.Binbuf();
//complex.Fbinbuf.Append(126);
complex.Fbinbuf = new Eina.Binbuf();
complex.Fbinbuf.Append(126);
complex.Fslice.Length = 1;
complex.Fslice.Mem = Eina.MemoryNative.Alloc(1);
@ -187,8 +187,8 @@ internal class StructHelpers
Test.Assert(complex.Fany_value_ptr.Get(out str_val));
Test.Assert(str_val == "abc");
//Test.Assert(complex.Fbinbuf.Length == 1);
//Test.Assert(complex.Fbinbuf.GetBytes()[0] == 126);
Test.Assert(complex.Fbinbuf.Length == 1);
Test.Assert(complex.Fbinbuf.GetBytes()[0] == 126);
Test.Assert(complex.Fslice.Length == 1);
Test.Assert(complex.Fslice.GetBytes()[0] == 125);
@ -206,7 +206,7 @@ internal class StructHelpers
Test.Assert(complex.Fiterator == null);
Test.Assert(complex.Fany_value == null);
Test.Assert(complex.Fany_value_ptr == null);
//Test.Assert(complex.Fbinbuf == null);
Test.Assert(complex.Fbinbuf == null);
Test.Assert(complex.Fslice.Length == 0);
Test.Assert(complex.Fslice.Mem == IntPtr.Zero);

View File

@ -347,7 +347,6 @@ Eina_Rw_Slice _dummy_test_object_eina_rw_slice_return(EINA_UNUSED Eo *obj, EINA_
return slc;
}
#if 0
Eina_Bool _dummy_test_object_eina_binbuf_in(EINA_UNUSED Eo *obj, EINA_UNUSED Dummy_Test_Object_Data *pd, Eina_Binbuf *binbuf)
{
Eina_Bool r = (0 == memcmp(eina_binbuf_string_get(binbuf), base_seq, eina_binbuf_length_get(binbuf)));
@ -459,7 +458,6 @@ Eina_Binbuf *_dummy_test_object_call_eina_binbuf_return_own(Eo *obj, EINA_UNUSED
{
return dummy_test_object_eina_binbuf_return_own(obj);
}
#endif
static const int base_seq_int[] = {0x0,0x2A,0x42};
@ -4118,8 +4116,8 @@ void struct_complex_with_values(Dummy_StructComplex *complex)
complex->fany_value_ptr = eina_value_new(EINA_VALUE_TYPE_STRING);
eina_value_set(complex->fany_value_ptr, "abc");
//complex->fbinbuf = eina_binbuf_new();
//eina_binbuf_append_char(complex->fbinbuf, 126);
complex->fbinbuf = eina_binbuf_new();
eina_binbuf_append_char(complex->fbinbuf, 126);
complex->fslice.len = 1;
complex->fslice.mem = malloc(1);
@ -4153,10 +4151,8 @@ Eina_Bool check_and_modify_struct_complex(Dummy_StructComplex *complex)
if (!eina_value_get(complex->fany_value_ptr, &str_val) || strcmp(str_val, "abc") != 0)
return EINA_FALSE;
/*
if (eina_binbuf_length_get(complex->fbinbuf) != 1 || eina_binbuf_string_get(complex->fbinbuf)[0] != 126)
return EINA_FALSE;
*/
if (complex->fslice.len != 1 || *(char*)complex->fslice.mem != 125)
return EINA_FALSE;

View File

@ -81,7 +81,7 @@ struct @beta @free(free) Dummy.StructComplex {
fiterator: iterator<string>;
fany_value: any_value;
fany_value_ptr: any_value_ptr;
// fbinbuf: ptr(Eina.Binbuf);
fbinbuf: binbuf;
fslice: slice<ubyte>;
// fslice: ptr(Eina.Slice); // TODO
fobj: Dummy.Numberwrapper;
@ -298,31 +298,30 @@ class Dummy.Test_Object extends Efl.Object implements Dummy.Test_Iface {
}
*/
/*
eina_binbuf_in @beta {
params {
@in binbuf: ptr(Eina.Binbuf);
@in binbuf: binbuf;
}
return: bool;
}
call_eina_binbuf_in @beta {
params {
@in binbuf: ptr(Eina.Binbuf);
@in binbuf: binbuf;
}
return: bool;
}
eina_binbuf_in_own @beta {
params {
@in binbuf: ptr(Eina.Binbuf) @owned;
@in binbuf: binbuf @owned;
}
return: bool;
}
call_eina_binbuf_in_own @beta {
params {
@in str: ptr(Eina.Binbuf) @owned;
@in str: binbuf @owned;
}
return: bool;
}
@ -333,13 +332,13 @@ class Dummy.Test_Object extends Efl.Object implements Dummy.Test_Iface {
eina_binbuf_out @beta {
params {
@out binbuf: ptr(Eina.Binbuf);
@out binbuf: binbuf;
}
return: bool;
}
call_eina_binbuf_out @beta {
return: ptr(Eina.Binbuf);
return: binbuf;
}
check_binbuf_out {
@ -348,21 +347,21 @@ class Dummy.Test_Object extends Efl.Object implements Dummy.Test_Iface {
eina_binbuf_out_own @beta {
params {
@out binbuf: ptr(Eina.Binbuf) @owned;
@out binbuf: binbuf @owned;
}
return: bool;
}
call_eina_binbuf_out_own @beta {
return: ptr(Eina.Binbuf) @owned;
return: binbuf @owned;
}
eina_binbuf_return @beta {
return: ptr(Eina.Binbuf);
return: binbuf;
}
call_eina_binbuf_return @beta {
return: ptr(Eina.Binbuf);
return: binbuf;
}
check_binbuf_return {
@ -370,13 +369,12 @@ class Dummy.Test_Object extends Efl.Object implements Dummy.Test_Iface {
}
eina_binbuf_return_own @beta {
return: ptr(Eina.Binbuf) @owned;
return: binbuf @owned;
}
call_eina_binbuf_return_own @beta {
return: ptr(Eina.Binbuf) @owned;
return: binbuf @owned;
}
*/
/* Eina Array */

View File

@ -19,6 +19,6 @@ EWAPI const Efl_Class *function_as_argument_class_get(void);
EOAPI void function_as_argument_set_cb(Eo *obj, void *cb_data, SimpleFunc cb, Eina_Free_Cb cb_free_cb);
EOAPI char *function_as_argument_call_cb(Eo *obj, int a, double b);
EOAPI char *function_as_argument_call_cb(Eo *obj, int a, double b) EFL_TRANSFER_OWNERSHIP;
#endif

View File

@ -8,7 +8,7 @@ typedef void (*VoidFunc)(void *data);
typedef const char * (*SimpleFunc)(void *data, int a, double b);
typedef double (*ComplexFunc)(void *data, const char *c, char **d);
typedef double (*ComplexFunc)(void *data, const char *c, char **d EFL_TRANSFER_OWNERSHIP);
typedef void (*FuncAsArgFunc)(void *data, void *cb_data, VoidFunc cb, Eina_Free_Cb cb_free_cb, void *another_cb_data, SimpleFunc another_cb, Eina_Free_Cb another_cb_free_cb);

View File

@ -38,7 +38,7 @@ EWAPI const Efl_Class *struct_class_get(void);
*
* @ingroup Struct
*/
EOAPI char *struct_foo(Eo *obj, int idx);
EOAPI char *struct_foo(Eo *obj, int idx) EFL_TRANSFER_OWNERSHIP;
EOAPI Named *struct_bar(Eo *obj);

View File

@ -43,6 +43,6 @@ typedef enum
EWAPI const Efl_Class *typedef_class_get(void);
EOAPI char *typedef_foo(Eo *obj, int idx);
EOAPI char *typedef_foo(Eo *obj, int idx) EFL_TRANSFER_OWNERSHIP;
#endif