forked from enlightenment/efl
Merge branch 'master' into devs/hermet/lottie
This commit is contained in:
commit
75e9a15fc6
|
@ -323,6 +323,12 @@ option('mono-beta',
|
|||
description: 'Flag for enabling @beta Eo methods in the api'
|
||||
)
|
||||
|
||||
option('mono-examples-dir',
|
||||
type: 'string',
|
||||
value: '',
|
||||
description: 'Directory where eolian_mono will search for examples to embed into the documentation'
|
||||
)
|
||||
|
||||
option('lua-interpreter',
|
||||
type: 'combo',
|
||||
choices: ['luajit', 'lua'],
|
||||
|
|
|
@ -104,8 +104,7 @@ struct documentation_generator
|
|||
|
||||
static std::string function_conversion(attributes::function_def const& func)
|
||||
{
|
||||
attributes::klass_def klass(get_klass(func.klass, func.unit), func.unit);
|
||||
std::string name = name_helpers::klass_full_concrete_or_interface_name(klass);
|
||||
std::string name = name_helpers::klass_full_concrete_or_interface_name(func.klass);
|
||||
switch (func.type)
|
||||
{
|
||||
// managed_method_name takes care of reordering the function name so the get/set goes first
|
||||
|
@ -114,8 +113,8 @@ struct documentation_generator
|
|||
case attributes::function_type::prop_set:
|
||||
case attributes::function_type::prop_get:
|
||||
if (blacklist::is_function_blacklisted(func.c_name))return "";
|
||||
name += ".";
|
||||
name += name_helpers::managed_method_name(klass.eolian_name, func.name);
|
||||
if (!name.empty()) name += ".";
|
||||
name += name_helpers::managed_method_name(func.klass.eolian_name, func.name);
|
||||
break;
|
||||
default:
|
||||
// No need to deal with property as function_defs are converted to get/set when building a given klass_def.
|
||||
|
@ -245,7 +244,19 @@ struct documentation_generator
|
|||
|
||||
/// Tag generator helpers
|
||||
template<typename OutputIterator, typename Context>
|
||||
bool generate_tag(OutputIterator sink, std::string const& tag, std::string const &text, Context const& context, std::string tag_params = "") const
|
||||
bool generate_opening_tag(OutputIterator sink, std::string const& tag, Context const& context, std::string tag_params = "") const
|
||||
{
|
||||
return as_generator("<" << tag << tag_params << ">").generate(sink, attributes::unused, context);
|
||||
}
|
||||
|
||||
template<typename OutputIterator, typename Context>
|
||||
bool generate_closing_tag(OutputIterator sink, std::string const& tag, Context const& context) const
|
||||
{
|
||||
return as_generator("</" << tag << ">").generate(sink, attributes::unused, context);
|
||||
}
|
||||
|
||||
template<typename OutputIterator, typename Context>
|
||||
bool generate_escaped_content(OutputIterator sink, std::string const &text, Context const& context) const
|
||||
{
|
||||
std::string new_text;
|
||||
if (!as_generator(html_escaped_string).generate(std::back_inserter(new_text), text, context))
|
||||
|
@ -257,14 +268,24 @@ struct documentation_generator
|
|||
|
||||
std::istringstream ss(new_text);
|
||||
std::string para;
|
||||
std::string final_text = "<" + tag + tag_params + ">";
|
||||
std::string final_text;
|
||||
bool first = true;
|
||||
while (std::getline(ss, para)) {
|
||||
if (first) final_text += para;
|
||||
else final_text += "\n" + tabs + para;
|
||||
first = false;
|
||||
}
|
||||
return as_generator(scope_tab(scope_size) << "/// " << final_text << "</" << tag << ">\n").generate(sink, attributes::unused, context);
|
||||
return as_generator(final_text).generate(sink, attributes::unused, context);
|
||||
}
|
||||
|
||||
template<typename OutputIterator, typename Context>
|
||||
bool generate_tag(OutputIterator sink, std::string const& tag, std::string const &text, Context const& context, std::string tag_params = "") const
|
||||
{
|
||||
if (!as_generator(scope_tab(scope_size) << "/// ").generate(sink, attributes::unused, context)) return false;
|
||||
if (!generate_opening_tag(sink, tag, context, tag_params)) return false;
|
||||
if (!generate_escaped_content(sink, text, context)) return false;
|
||||
if (!generate_closing_tag(sink, tag, context)) return false;
|
||||
return as_generator("\n").generate(sink, attributes::unused, context);
|
||||
}
|
||||
|
||||
template<typename OutputIterator, typename Context>
|
||||
|
@ -291,6 +312,47 @@ struct documentation_generator
|
|||
return generate_tag(sink, "value", text, context);
|
||||
}
|
||||
|
||||
template<typename OutputIterator, typename Context>
|
||||
bool generate_tag_example(OutputIterator sink, std::string const& full_object_name, Context const& context) const
|
||||
{
|
||||
auto options = efl::eolian::grammar::context_find_tag<options_context>(context);
|
||||
// Example embedding not requested
|
||||
if (options.examples_dir.empty()) return true;
|
||||
std::string file_name = options.examples_dir + full_object_name + ".cs";
|
||||
std::ifstream exfile(file_name);
|
||||
// There is no example file for this class or method, just return
|
||||
if (!exfile.good()) return true;
|
||||
std::stringstream example_buff;
|
||||
// Start with a newline so the first line renders with same indentation as the rest
|
||||
example_buff << std::endl << exfile.rdbuf();
|
||||
|
||||
if (!as_generator(scope_tab(scope_size) << "/// ").generate(sink, attributes::unused, context)) return false;
|
||||
if (!generate_opening_tag(sink, "example", context)) return false;
|
||||
if (!generate_opening_tag(sink, "code", context)) return false;
|
||||
if (!generate_escaped_content(sink, example_buff.str(), context)) return false;
|
||||
if (!generate_closing_tag(sink, "code", context)) return false;
|
||||
if (!generate_closing_tag(sink, "example", context)) return false;
|
||||
return as_generator("\n").generate(sink, attributes::unused, context);
|
||||
}
|
||||
|
||||
template<typename OutputIterator, typename Context>
|
||||
bool generate_all_tag_examples(OutputIterator sink, std::string const & full_class_name, std::string const& object_name, Context const& context) const
|
||||
{
|
||||
// Take example from derived class
|
||||
auto derived_klass = efl::eolian::grammar::context_find_tag<class_context>(context);
|
||||
std::string derived_full_name =
|
||||
derived_klass.name.empty() ? object_name : derived_klass.name + "." + object_name;
|
||||
std::string base_full_name =
|
||||
full_class_name.empty() ? object_name : full_class_name + "." + object_name;
|
||||
if (!derived_klass.name.empty())
|
||||
{
|
||||
if (!generate_tag_example(sink, derived_full_name, context)) return false;
|
||||
}
|
||||
if (derived_full_name.compare(base_full_name) == 0) return true;
|
||||
// Take example from base class
|
||||
return generate_tag_example(sink, base_full_name, context);
|
||||
}
|
||||
|
||||
// Actual exported generators
|
||||
template<typename OutputIterator, typename Attribute, typename Context>
|
||||
bool generate(OutputIterator sink, Attribute const& attr, Context const& context) const
|
||||
|
@ -298,6 +360,15 @@ struct documentation_generator
|
|||
return generate(sink, attr.documentation, context);
|
||||
}
|
||||
|
||||
template<typename OutputIterator, typename Context>
|
||||
bool generate(OutputIterator sink, attributes::klass_def const& klass, Context const& context) const
|
||||
{
|
||||
if (!generate(sink, klass.documentation, context)) return false;
|
||||
|
||||
std::string klass_name = name_helpers::klass_full_concrete_or_interface_name(klass);
|
||||
return generate_tag_example(sink, klass_name, context);
|
||||
}
|
||||
|
||||
template<typename OutputIterator, typename Context>
|
||||
bool generate(OutputIterator sink, attributes::property_def const& prop, Context const& context) const
|
||||
{
|
||||
|
@ -310,9 +381,13 @@ struct documentation_generator
|
|||
else if (prop.getter.is_engaged())
|
||||
text = prop.getter->return_documentation.full_text;
|
||||
// If there are no docs at all, do not generate <value> tag
|
||||
else return true;
|
||||
if (!text.empty())
|
||||
if (!generate_tag_value(sink, text, context)) return false;
|
||||
|
||||
return generate_tag_value(sink, text, context);
|
||||
return generate_all_tag_examples(sink,
|
||||
name_helpers::klass_full_concrete_or_interface_name(prop.klass),
|
||||
name_helpers::property_managed_name(prop),
|
||||
context);
|
||||
}
|
||||
|
||||
template<typename OutputIterator, typename Context>
|
||||
|
@ -348,7 +423,10 @@ struct documentation_generator
|
|||
if (!generate_tag_return(sink, func.return_documentation.full_text, context))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
return generate_all_tag_examples(sink,
|
||||
name_helpers::klass_full_concrete_or_interface_name(func.klass),
|
||||
name_helpers::managed_method_name(func.klass.eolian_name, func.name),
|
||||
context);
|
||||
}
|
||||
|
||||
template<typename OutputIterator, typename Context>
|
||||
|
@ -364,7 +442,10 @@ struct documentation_generator
|
|||
if (!generate_tag_return(sink, func.return_documentation.full_text, context))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
return generate_all_tag_examples(sink,
|
||||
name_helpers::klass_full_concrete_or_interface_name(func.klass),
|
||||
name_helpers::managed_method_name(func.klass.eolian_name, func.name),
|
||||
context);
|
||||
}
|
||||
|
||||
template<typename OutputIterator, typename Context>
|
||||
|
|
|
@ -20,6 +20,7 @@ struct class_context
|
|||
variables,
|
||||
};
|
||||
wrapper_kind current_wrapper_kind;
|
||||
std::string name;
|
||||
};
|
||||
|
||||
struct indentation_context
|
||||
|
@ -78,6 +79,7 @@ struct eolian_state_context {
|
|||
|
||||
struct options_context {
|
||||
bool want_beta;
|
||||
std::string examples_dir;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -117,7 +117,9 @@ struct klass
|
|||
// Interface class
|
||||
if(class_type == "interface")
|
||||
{
|
||||
auto iface_cxt = context_add_tag(class_context{class_context::interface}, context);
|
||||
auto iface_cxt = context_add_tag(class_context{class_context::interface,
|
||||
name_helpers::klass_full_concrete_or_interface_name(cls)},
|
||||
context);
|
||||
|
||||
if(!as_generator(documentation).generate(sink, cls, iface_cxt))
|
||||
return false;
|
||||
|
@ -195,7 +197,9 @@ struct klass
|
|||
// Concrete class for interfaces, mixins, etc.
|
||||
if(class_type != "class" && class_type != "abstract class")
|
||||
{
|
||||
auto concrete_cxt = context_add_tag(class_context{class_context::concrete}, context);
|
||||
auto concrete_cxt = context_add_tag(class_context{class_context::concrete,
|
||||
name_helpers::klass_full_concrete_or_interface_name(cls)},
|
||||
context);
|
||||
auto concrete_name = name_helpers::klass_concrete_name(cls);
|
||||
auto interface_name = name_helpers::klass_interface_name(cls);
|
||||
|
||||
|
@ -277,7 +281,9 @@ struct klass
|
|||
// Inheritable class
|
||||
if(class_type == "class" || class_type == "abstract class")
|
||||
{
|
||||
auto inherit_cxt = context_add_tag(class_context{class_context::inherit}, context);
|
||||
auto inherit_cxt = context_add_tag(class_context{class_context::inherit,
|
||||
name_helpers::klass_full_concrete_or_interface_name(cls)},
|
||||
context);
|
||||
|
||||
// Class header
|
||||
if(!as_generator
|
||||
|
@ -351,7 +357,9 @@ struct klass
|
|||
// Native Inherit class
|
||||
//if(class_type == "class")
|
||||
{
|
||||
auto inative_cxt = context_add_tag(class_context{class_context::inherit_native}, context);
|
||||
auto inative_cxt = context_add_tag(class_context{class_context::inherit_native,
|
||||
name_helpers::klass_full_concrete_or_interface_name(cls)},
|
||||
context);
|
||||
auto native_inherit_name = name_helpers::klass_native_inherit_name(cls);
|
||||
auto inherit_name = name_helpers::klass_inherit_name(cls);
|
||||
std::string base_name;
|
||||
|
|
|
@ -43,6 +43,7 @@ struct options_type
|
|||
std::vector<std::string> include_dirs;
|
||||
std::string in_file;
|
||||
std::string out_file;
|
||||
std::string examples_dir;
|
||||
std::string dllimport;
|
||||
mutable Eolian_State* state;
|
||||
mutable Eolian_Unit const* unit;
|
||||
|
@ -145,7 +146,8 @@ run(options_type const& opts)
|
|||
|
||||
auto context = context_add_tag(eolian_mono::indentation_context{0},
|
||||
context_add_tag(eolian_mono::eolian_state_context{opts.state},
|
||||
context_add_tag(eolian_mono::options_context{opts.want_beta},
|
||||
context_add_tag(eolian_mono::options_context{opts.want_beta,
|
||||
opts.examples_dir},
|
||||
context_add_tag(eolian_mono::library_context{opts.dllimport,
|
||||
opts.v_major,
|
||||
opts.v_minor,
|
||||
|
@ -294,6 +296,7 @@ _usage(const char *progname)
|
|||
<< " -r, --recurse Recurse input directories loading .eo files." << std::endl
|
||||
<< " -v, --version Print the version." << std::endl
|
||||
<< " -b, --beta Enable @beta methods." << std::endl
|
||||
<< " -e, --example-dir <dir> Folder to search for example files." << std::endl
|
||||
<< " -h, --help Print this help." << std::endl;
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
@ -324,9 +327,10 @@ opts_get(int argc, char **argv)
|
|||
{ "vmin", required_argument, 0, 'm' },
|
||||
{ "references", required_argument, 0, 'r'},
|
||||
{ "beta", no_argument, 0, 'b'},
|
||||
{ "example-dir", required_argument, 0, 'e' },
|
||||
{ 0, 0, 0, 0 }
|
||||
};
|
||||
const char* options = "I:D:o:c:M:m:ar:vhb";
|
||||
const char* options = "I:D:o:c:M:m:ar:vhbe:";
|
||||
|
||||
int c, idx;
|
||||
while ( (c = getopt_long(argc, argv, options, long_options, &idx)) != -1)
|
||||
|
@ -382,6 +386,11 @@ opts_get(int argc, char **argv)
|
|||
{
|
||||
opts.want_beta = true;
|
||||
}
|
||||
else if (c == 'e')
|
||||
{
|
||||
opts.examples_dir = optarg;
|
||||
if (!opts.examples_dir.empty() && opts.examples_dir.back() != '/') opts.examples_dir += "/";
|
||||
}
|
||||
}
|
||||
if (optind == argc-1)
|
||||
{
|
||||
|
|
|
@ -17,6 +17,7 @@ ffi.cdef [[
|
|||
typedef struct _Eolian_Object Eolian_Object;
|
||||
typedef struct _Eolian_Class Eolian_Class;
|
||||
typedef struct _Eolian_Function Eolian_Function;
|
||||
typedef struct _Eolian_Part Eolian_Part;
|
||||
typedef struct _Eolian_Type Eolian_Type;
|
||||
typedef struct _Eolian_Typedecl Eolian_Typedecl;
|
||||
typedef struct _Eolian_Function_Parameter Eolian_Function_Parameter;
|
||||
|
@ -31,6 +32,9 @@ ffi.cdef [[
|
|||
typedef struct _Eolian_Value Eolian_Value;
|
||||
typedef struct _Eolian_Unit Eolian_Unit;
|
||||
|
||||
typedef void (*Eolian_Panic_Cb)(const Eolian_State *state, const char *msg);
|
||||
typedef void (*Eolian_Error_Cb)(const Eolian_Object *obj, const char *msg, void *data);
|
||||
|
||||
typedef enum {
|
||||
EOLIAN_OBJECT_UNKNOWN = 0,
|
||||
EOLIAN_OBJECT_CLASS,
|
||||
|
@ -288,7 +292,11 @@ ffi.cdef [[
|
|||
int eolian_shutdown(void);
|
||||
Eolian_State *eolian_state_new(void);
|
||||
void eolian_state_free(Eolian_State *state);
|
||||
Eolian_Panic_Cb eolian_state_panic_cb_set(Eolian_State *state, Eolian_Panic_Cb cb);
|
||||
Eolian_Error_Cb eolian_state_error_cb_set(Eolian_State *state, Eolian_Error_Cb cb);
|
||||
void *eolian_state_error_data_set(Eolian_State *state, void *data);
|
||||
Eolian_Object_Type eolian_object_type_get(const Eolian_Object *obj);
|
||||
const Eolian_Unit *eolian_object_unit_get(const Eolian_Object *obj);
|
||||
const char *eolian_object_file_get(const Eolian_Object *obj);
|
||||
int eolian_object_line_get(const Eolian_Object *obj);
|
||||
int eolian_object_column_get(const Eolian_Object *obj);
|
||||
|
@ -309,8 +317,10 @@ ffi.cdef [[
|
|||
const Eolian_Unit *eolian_state_unit_by_file_get(const Eolian_State *state, const char *file_name);
|
||||
Eina_Iterator *eolian_state_units_get(const Eolian_State *state);
|
||||
|
||||
const Eolian_State *eolian_unit_state_get(const Eolian_Unit *unit);
|
||||
Eina_Iterator *eolian_unit_children_get(const Eolian_Unit *unit);
|
||||
const char *eolian_unit_file_get(const Eolian_Unit *unit);
|
||||
const char *eolian_unit_file_path_get(const Eolian_Unit *unit);
|
||||
const Eolian_Object *eolian_unit_object_by_name_get(const Eolian_Unit *unit, const char *name);
|
||||
Eina_Iterator *eolian_unit_objects_get(const Eolian_Unit *unit);
|
||||
const Eolian_Class *eolian_unit_class_by_name_get(const Eolian_Unit *unit, const char *class_name);
|
||||
|
@ -336,8 +346,10 @@ ffi.cdef [[
|
|||
Eolian_Class_Type eolian_class_type_get(const Eolian_Class *klass);
|
||||
const Eolian_Documentation *eolian_class_documentation_get(const Eolian_Class *klass);
|
||||
const char *eolian_class_eo_prefix_get(const Eolian_Class *klass);
|
||||
const char *eolian_class_event_prefix_get(const Eolian_Class *klass);
|
||||
const char *eolian_class_data_type_get(const Eolian_Class *klass);
|
||||
const Eolian_Class *eolian_class_parent_get(const Eolian_Class *klass);
|
||||
Eina_Iterator *eolian_class_requires_get(const Eolian_Class *klass);
|
||||
Eina_Iterator *eolian_class_extensions_get(const Eolian_Class *klass);
|
||||
Eina_Iterator *eolian_class_functions_get(const Eolian_Class *klass, Eolian_Function_Type func_type);
|
||||
Eolian_Function_Type eolian_function_type_get(const Eolian_Function *function_id);
|
||||
|
@ -363,6 +375,7 @@ ffi.cdef [[
|
|||
const Eolian_Documentation *eolian_function_return_documentation_get(const Eolian_Function *foo_id, Eolian_Function_Type ftype);
|
||||
Eina_Bool eolian_function_return_is_warn_unused(const Eolian_Function *foo_id, Eolian_Function_Type ftype);
|
||||
Eina_Bool eolian_function_object_is_const(const Eolian_Function *function_id);
|
||||
const Eolian_Class *eolian_function_class_get(const Eolian_Function *function_id);
|
||||
const Eolian_Class *eolian_implement_class_get(const Eolian_Implement *impl);
|
||||
const Eolian_Class *eolian_implement_implementing_class_get(const Eolian_Implement *impl);
|
||||
const Eolian_Function *eolian_implement_function_get(const Eolian_Implement *impl, Eolian_Function_Type *func_type);
|
||||
|
@ -376,6 +389,7 @@ ffi.cdef [[
|
|||
const Eolian_Class *eolian_constructor_class_get(const Eolian_Constructor *ctor);
|
||||
const Eolian_Function *eolian_constructor_function_get(const Eolian_Constructor *ctor);
|
||||
Eina_Bool eolian_constructor_is_optional(const Eolian_Constructor *ctor);
|
||||
Eina_Bool eolian_constructor_is_ctor_param(const Eolian_Constructor *ctor);
|
||||
Eina_Iterator *eolian_class_constructors_get(const Eolian_Class *klass);
|
||||
Eina_Iterator *eolian_class_events_get(const Eolian_Class *klass);
|
||||
const Eolian_Type *eolian_event_type_get(const Eolian_Event *event);
|
||||
|
@ -384,12 +398,18 @@ ffi.cdef [[
|
|||
Eolian_Object_Scope eolian_event_scope_get(const Eolian_Event *event);
|
||||
Eina_Bool eolian_event_is_hot(const Eolian_Event *event);
|
||||
Eina_Bool eolian_event_is_restart(const Eolian_Event *event);
|
||||
Eina_Iterator *eolian_class_parts_get(const Eolian_Class *klass);
|
||||
const char *eolian_event_c_name_get(const Eolian_Event *event);
|
||||
const Eolian_Class *eolian_part_class_get(const Eolian_Part *part);
|
||||
const Eolian_Documentation *eolian_part_documentation_get(const Eolian_Part *part);
|
||||
const Eolian_Event *eolian_class_event_by_name_get(const Eolian_Class *klass, const char *event_name);
|
||||
Eina_Bool eolian_class_ctor_enable_get(const Eolian_Class *klass);
|
||||
Eina_Bool eolian_class_dtor_enable_get(const Eolian_Class *klass);
|
||||
const char *eolian_class_c_get_function_name_get(const Eolian_Class *klass);
|
||||
Eolian_Type_Type eolian_type_type_get(const Eolian_Type *tp);
|
||||
Eolian_Type_Builtin_Type eolian_type_builtin_type_get(const Eolian_Type *tp);
|
||||
const char *eolian_class_c_name_get(const Eolian_Class *klass);
|
||||
const char *eolian_class_c_data_type_get(const Eolian_Class *klass);
|
||||
Eolian_Typedecl_Type eolian_typedecl_type_get(const Eolian_Typedecl *tp);
|
||||
Eina_Iterator *eolian_typedecl_struct_fields_get(const Eolian_Typedecl *tp);
|
||||
const Eolian_Struct_Type_Field *eolian_typedecl_struct_field_get(const Eolian_Typedecl *tp, const char *field);
|
||||
|
@ -534,6 +554,14 @@ local object_idx, wrap_object = gen_wrap {
|
|||
return tonumber(eolian.eolian_object_type_get(cast_obj(self)))
|
||||
end,
|
||||
|
||||
unit_get = function(self)
|
||||
local v = eolian.eolian_object_unit_get(cast_obj(self))
|
||||
if v == nil then
|
||||
return nil
|
||||
end
|
||||
return v
|
||||
end,
|
||||
|
||||
line_get = function(self)
|
||||
return tonumber(eolian.eolian_object_line_get(cast_obj(self)))
|
||||
end,
|
||||
|
@ -579,6 +607,12 @@ local object_idx, wrap_object = gen_wrap {
|
|||
ffi.metatype("Eolian_Object", { __index = object_idx })
|
||||
|
||||
local unit_idx, wrap_unit = gen_wrap {
|
||||
state_get = function(self)
|
||||
local v = eolian.eolian_unit_state_get(cast_unit(self))
|
||||
if v == nil then return nil end
|
||||
return v
|
||||
end,
|
||||
|
||||
children_get = function(self)
|
||||
return Ptr_Iterator("const Eolian_Unit*",
|
||||
eolian.eolian_unit_children_get(cast_unit(self)))
|
||||
|
@ -590,6 +624,12 @@ local unit_idx, wrap_unit = gen_wrap {
|
|||
return ffi.string(v)
|
||||
end,
|
||||
|
||||
file_path_get = function(self)
|
||||
local v = eolian.eolian_unit_file_path_get(cast_unit(self))
|
||||
if v == nil then return nil end
|
||||
return ffi.string(v)
|
||||
end,
|
||||
|
||||
object_by_name_get = function(self, name)
|
||||
local v = eolian.eolian_unit_object_by_name_get(cast_unit(self), name)
|
||||
if v == nil then return nil end
|
||||
|
@ -670,8 +710,43 @@ local unit_idx, wrap_unit = gen_wrap {
|
|||
|
||||
ffi.metatype("Eolian_Unit", { __index = unit_idx })
|
||||
|
||||
local panic_cbs = {}
|
||||
local error_cbs = {}
|
||||
|
||||
local obj_to_idx = function(obj)
|
||||
return tonumber(ffi.cast("size_t", obj))
|
||||
end
|
||||
|
||||
local panic_cb, err_cb
|
||||
|
||||
panic_cb = ffi.gc(ffi.cast("Eolian_Panic_Cb", function(state, msg)
|
||||
local pcb = panic_cbs[obj_to_idx(self)]
|
||||
assert(pcb, "internal error: no prror cb")
|
||||
pcb(state, ffi.string(msg))
|
||||
end), function(cb)
|
||||
cb:free()
|
||||
end)
|
||||
|
||||
err_cb = ffi.gc(ffi.cast("Eolian_Panic_Cb", function(obj, msg, data)
|
||||
local ecb = error_cbs[obj_to_idx(self)]
|
||||
assert(ecb, "internal error: no error cb")
|
||||
ecb(obj, ffi.string(msg))
|
||||
end), function(cb)
|
||||
cb:free()
|
||||
end)
|
||||
|
||||
ffi.metatype("Eolian_State", {
|
||||
__index = wrap_unit {
|
||||
panic_cb_set = function(self, cb)
|
||||
panic_cbs[obj_to_idx(self)] = cb
|
||||
eolian.eolian_state_panic_cb_set(self, panic_cb)
|
||||
end,
|
||||
|
||||
error_cb_set = function(self, cb)
|
||||
error_cbs[obj_to_idx(self)] = cb
|
||||
eolian.eolian_state_error_cb_set(self, err_cb)
|
||||
end,
|
||||
|
||||
directory_add = function(self, dir)
|
||||
return eolian.eolian_state_directory_add(self, dir) ~= 0
|
||||
end,
|
||||
|
@ -770,6 +845,9 @@ ffi.metatype("Eolian_State", {
|
|||
end
|
||||
},
|
||||
__gc = function(self)
|
||||
local idx = obj_to_idx(self)
|
||||
panic_cbs[idx] = nil
|
||||
error_cbs[idx] = nil
|
||||
eolian.eolian_state_free(self)
|
||||
end
|
||||
})
|
||||
|
@ -1127,6 +1205,12 @@ M.Function = ffi.metatype("Eolian_Function", {
|
|||
|
||||
is_const = function(self)
|
||||
return eolian.eolian_function_object_is_const(self) ~= 0
|
||||
end,
|
||||
|
||||
class_get = function(self)
|
||||
local v = eolian.eolian_function_class_get(self)
|
||||
if v == nil then return nil end
|
||||
return v
|
||||
end
|
||||
}
|
||||
})
|
||||
|
@ -1241,6 +1325,10 @@ ffi.metatype("Eolian_Constructor", {
|
|||
|
||||
is_optional = function(self)
|
||||
return eolian.eolian_constructor_is_optional(self) ~= 0
|
||||
end,
|
||||
|
||||
is_ctor_param = function(self)
|
||||
return eolian.eolian_constructor_is_ctor_param(self) ~= 0
|
||||
end
|
||||
}
|
||||
})
|
||||
|
@ -1285,6 +1373,22 @@ ffi.metatype("Eolian_Event", {
|
|||
}
|
||||
})
|
||||
|
||||
ffi.metatype("Eolian_Part", {
|
||||
__index = wrap_object {
|
||||
class_get = function(self)
|
||||
local v = eolian.eolian_part_class_get(self)
|
||||
if v == nil then return nil end
|
||||
return v
|
||||
end,
|
||||
|
||||
documentation_get = function(self)
|
||||
local v = eolian.eolian_part_documentation_get(self)
|
||||
if v == nil then return nil end
|
||||
return v
|
||||
end
|
||||
}
|
||||
})
|
||||
|
||||
M.class_type = {
|
||||
UNKNOWN = 0,
|
||||
REGULAR = 1,
|
||||
|
@ -1315,6 +1419,14 @@ M.Class = ffi.metatype("Eolian_Class", {
|
|||
return ffi.string(v)
|
||||
end,
|
||||
|
||||
event_prefix_get = function(self)
|
||||
local v = eolian.eolian_class_event_prefix_get(self)
|
||||
if v == nil then
|
||||
return self:eo_prefix_get()
|
||||
end
|
||||
return ffi.string(v)
|
||||
end,
|
||||
|
||||
data_type_get = function(self)
|
||||
local v = eolian.eolian_class_data_type_get(self)
|
||||
if v == nil then return nil end
|
||||
|
@ -1332,6 +1444,11 @@ M.Class = ffi.metatype("Eolian_Class", {
|
|||
eolian.eolian_class_extensions_get(self))
|
||||
end,
|
||||
|
||||
requires_get = function(self)
|
||||
return Ptr_Iterator("const Eolian_Class*",
|
||||
eolian.eolian_class_requires_get(self))
|
||||
end,
|
||||
|
||||
functions_get = function(self, func_type)
|
||||
return Ptr_Iterator("const Eolian_Function*",
|
||||
eolian.eolian_class_functions_get(self, func_type))
|
||||
|
@ -1359,6 +1476,17 @@ M.Class = ffi.metatype("Eolian_Class", {
|
|||
eolian.eolian_class_events_get(self))
|
||||
end,
|
||||
|
||||
event_by_name_get = function(self, name)
|
||||
local v = eolian.eolian_class_event_by_name_get(self, name)
|
||||
if v == nil then return nil end
|
||||
return v
|
||||
end,
|
||||
|
||||
parts_get = function(self)
|
||||
return Ptr_Iterator("const Eolian_Part*",
|
||||
eolian.eolian_class_parts_get(self))
|
||||
end,
|
||||
|
||||
ctor_enable_get = function(self)
|
||||
return eolian.eolian_class_ctor_enable_get(self) ~= 0
|
||||
end,
|
||||
|
@ -1371,6 +1499,18 @@ M.Class = ffi.metatype("Eolian_Class", {
|
|||
local v = eolian.eolian_class_c_get_function_name_get(self)
|
||||
if v == nil then return nil end
|
||||
return ffi_stringshare(v)
|
||||
end,
|
||||
|
||||
c_name_get = function(self)
|
||||
local v = eolian.eolian_class_c_name_get(self)
|
||||
if v == nil then return nil end
|
||||
return ffi_stringshare(v)
|
||||
end,
|
||||
|
||||
c_data_type_get = function(self)
|
||||
local v = eolian.eolian_class_c_data_type_get(self)
|
||||
if v == nil then return nil end
|
||||
return ffi_stringshare(v)
|
||||
end
|
||||
}
|
||||
})
|
||||
|
|
|
@ -127,6 +127,7 @@ foreach lib : mono_sublibs
|
|||
command : [eolian_mono_gen, beta_option, '-I', meson.current_source_dir(), eolian_include_directories,
|
||||
'--dllimport', package_name,
|
||||
'-o', join_paths(meson.current_build_dir(), mono_gen_file + '.cs'),
|
||||
'-e', get_option('mono-examples-dir'),
|
||||
'@INPUT@'])
|
||||
endif
|
||||
endforeach
|
||||
|
|
|
@ -11,8 +11,23 @@
|
|||
|
||||
#include "draw.h"
|
||||
|
||||
//FIXME: This enum add temporarily to help understanding of additional code
|
||||
//related to masking in prepare_mask.
|
||||
//This needs to be formally declared through the eo class.
|
||||
typedef enum _EFL_CANVAS_VG_NODE_BLEND_TYPE
|
||||
{
|
||||
EFL_CANVAS_VG_NODE_BLEND_TYPE_NONE = 0,
|
||||
EFL_CANVAS_VG_NODE_BLEND_TYPE_ALPHA,
|
||||
EFL_CANVAS_VG_NODE_BLEND_TYPE_ALPHA_INV,
|
||||
EFL_CANVAS_VG_NODE_BLEND_TYPE_MASK_ADD,
|
||||
EFL_CANVAS_VG_NODE_BLEND_TYPE_MASK_SUBSTRACT,
|
||||
EFL_CANVAS_VG_NODE_BLEND_TYPE_MASK_INTERSECT,
|
||||
EFL_CANVAS_VG_NODE_BLEND_TYPE_MASK_DIFFERENCE
|
||||
}EFL_CANVAS_VG_NODE_BLEND_TYPE;
|
||||
//
|
||||
|
||||
static void
|
||||
_blend_color_argb(int count, const SW_FT_Span *spans, void *user_data)
|
||||
_blend_argb(int count, const SW_FT_Span *spans, void *user_data)
|
||||
{
|
||||
Span_Data *sd = user_data;
|
||||
uint32_t color, *buffer, *target;
|
||||
|
@ -34,7 +49,7 @@ _blend_color_argb(int count, const SW_FT_Span *spans, void *user_data)
|
|||
}
|
||||
|
||||
static void
|
||||
_blend_color_argb_with_maskA(int count, const SW_FT_Span *spans, void *user_data)
|
||||
_blend_alpha(int count, const SW_FT_Span *spans, void *user_data)
|
||||
{
|
||||
Span_Data *sd = user_data;
|
||||
const int pix_stride = sd->raster_buffer->stride / 4;
|
||||
|
@ -77,7 +92,7 @@ _blend_color_argb_with_maskA(int count, const SW_FT_Span *spans, void *user_data
|
|||
}
|
||||
|
||||
static void
|
||||
_blend_color_argb_with_maskInvA(int count, const SW_FT_Span *spans, void *user_data)
|
||||
_blend_alpha_inv(int count, const SW_FT_Span *spans, void *user_data)
|
||||
{
|
||||
Span_Data *sd = user_data;
|
||||
const int pix_stride = sd->raster_buffer->stride / 4;
|
||||
|
@ -120,6 +135,122 @@ _blend_color_argb_with_maskInvA(int count, const SW_FT_Span *spans, void *user_d
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_blend_mask_add(int count, const SW_FT_Span *spans, void *user_data)
|
||||
{
|
||||
Span_Data *sd = user_data;
|
||||
Ector_Software_Buffer_Base_Data *mask = sd->mask;
|
||||
|
||||
uint32_t color = DRAW_MUL4_SYM(sd->color, sd->mul_col);
|
||||
RGBA_Comp_Func_Solid comp_func = efl_draw_func_solid_span_get(sd->op, color);
|
||||
uint32_t *mbuffer = mask->pixels.u32;
|
||||
|
||||
while (count--)
|
||||
{
|
||||
uint32_t *ttarget = alloca(sizeof(uint32_t) * spans->len);
|
||||
memset(ttarget, 0x00, sizeof(uint32_t) * spans->len);
|
||||
uint32_t *mtarget = mbuffer + ((mask->generic->w * spans->y) + spans->x);
|
||||
comp_func(ttarget, spans->len, color, spans->coverage);
|
||||
for (int i = 0; i < spans->len; i++)
|
||||
{
|
||||
double adst = A_VAL(&mtarget[i]) == 0 ? 0 : (double)(A_VAL(&mtarget[i])) / (double)255;
|
||||
double asrc = A_VAL(&ttarget[i]) == 0 ? 0 : (double)(A_VAL(&ttarget[i])) / (double)255;
|
||||
uint32_t aout = (int)(((adst * (1 - asrc)) + asrc) * 255);
|
||||
mtarget[i] = (aout<<24) + (0x00FFFFFF & mtarget[i]);
|
||||
}
|
||||
++spans;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_blend_mask_sub(int count, const SW_FT_Span *spans, void *user_data)
|
||||
{
|
||||
Span_Data *sd = user_data;
|
||||
Ector_Software_Buffer_Base_Data *mask = sd->mask;
|
||||
|
||||
uint32_t color = DRAW_MUL4_SYM(sd->color, sd->mul_col);
|
||||
RGBA_Comp_Func_Solid comp_func = efl_draw_func_solid_span_get(sd->op, color);
|
||||
uint32_t *mtarget = mask->pixels.u32;
|
||||
|
||||
int tsize = sd->raster_buffer->generic->w * sd->raster_buffer->generic->h;
|
||||
uint32_t *tbuffer = alloca(sizeof(uint32_t) * tsize);
|
||||
memset(tbuffer, 0x00, sizeof(uint32_t) * tsize);
|
||||
|
||||
while (count--)
|
||||
{
|
||||
uint32_t *ttarget = tbuffer + ((mask->generic->w * spans->y) + spans->x);
|
||||
comp_func(ttarget, spans->len, color, spans->coverage);
|
||||
++spans;
|
||||
}
|
||||
|
||||
for(int i = 0; i < tsize; i++)
|
||||
{
|
||||
double adst = A_VAL(&mtarget[i]) == 0 ? 0 : (double)(A_VAL(&mtarget[i])) / (double)255;
|
||||
double asrc = A_VAL(&tbuffer[i]) == 0 ? 0 : (double)(A_VAL(&tbuffer[i])) / (double)255;
|
||||
uint32_t aout = (int)((adst * (1 - asrc)) * 255);
|
||||
mtarget[i] = (aout<<24) + (0x00FFFFFF & mtarget[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
_blend_mask_ins(int count, const SW_FT_Span *spans, void *user_data)
|
||||
{
|
||||
Span_Data *sd = user_data;
|
||||
Ector_Software_Buffer_Base_Data *mask = sd->mask;
|
||||
|
||||
uint32_t color = DRAW_MUL4_SYM(sd->color, sd->mul_col);
|
||||
RGBA_Comp_Func_Solid comp_func = efl_draw_func_solid_span_get(sd->op, color);
|
||||
uint32_t *mtarget = mask->pixels.u32;
|
||||
|
||||
int tsize = sd->raster_buffer->generic->w * sd->raster_buffer->generic->h;
|
||||
uint32_t *tbuffer = alloca(sizeof(uint32_t) * tsize);
|
||||
memset(tbuffer, 0x00, sizeof(uint32_t) * tsize);
|
||||
|
||||
while (count--)
|
||||
{
|
||||
uint32_t *ttarget = tbuffer + ((mask->generic->w * spans->y) + spans->x);
|
||||
comp_func(ttarget, spans->len, color, spans->coverage);
|
||||
++spans;
|
||||
}
|
||||
|
||||
for(int i = 0; i < tsize; i++)
|
||||
{
|
||||
double adst = A_VAL(&mtarget[i]) == 0 ? 0 : (double)(A_VAL(&mtarget[i])) / (double)255;
|
||||
double asrc = A_VAL(&tbuffer[i]) == 0 ? 0 : (double)(A_VAL(&tbuffer[i])) / (double)255;
|
||||
uint32_t aout = (int)((adst * asrc) * 255);
|
||||
mtarget[i] = (aout<<24) + (0x00FFFFFF & mtarget[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
_blend_mask_diff(int count, const SW_FT_Span *spans, void *user_data)
|
||||
{
|
||||
Span_Data *sd = user_data;
|
||||
Ector_Software_Buffer_Base_Data *mask = sd->mask;
|
||||
|
||||
uint32_t color = DRAW_MUL4_SYM(sd->color, sd->mul_col);
|
||||
RGBA_Comp_Func_Solid comp_func = efl_draw_func_solid_span_get(sd->op, color);
|
||||
uint32_t *mbuffer = mask->pixels.u32;
|
||||
|
||||
while (count--)
|
||||
{
|
||||
uint32_t *ttarget = alloca(sizeof(uint32_t) * spans->len);
|
||||
memset(ttarget, 0x00, sizeof(uint32_t) * spans->len);
|
||||
uint32_t *mtarget = mbuffer + ((mask->generic->w * spans->y) + spans->x);
|
||||
comp_func(ttarget, spans->len, color, spans->coverage);
|
||||
for (int i = 0; i < spans->len; i++)
|
||||
{
|
||||
double adst = A_VAL(&mtarget[i]) == 0 ? 0 : (double)(A_VAL(&mtarget[i])) / (double)255;
|
||||
double asrc = A_VAL(&ttarget[i]) == 0 ? 0 : (double)(A_VAL(&ttarget[i])) / (double)255;
|
||||
uint32_t aout = (int)((((1 - adst) * asrc) + ((1 - asrc) * adst)) * 255);
|
||||
mtarget[i] = (aout<<24) + (0x00FFFFFF & mtarget[i]);
|
||||
}
|
||||
++spans;
|
||||
}
|
||||
}
|
||||
|
||||
#define BLEND_GRADIENT_BUFFER_SIZE 2048
|
||||
|
||||
typedef void (*src_fetch) (unsigned int *buffer, Span_Data *data, int y, int x, int length);
|
||||
|
@ -362,14 +493,32 @@ _adjust_span_fill_methods(Span_Data *spdata)
|
|||
case Solid:
|
||||
{
|
||||
if (spdata->mask)
|
||||
{
|
||||
if (spdata->mask_op == 2)
|
||||
spdata->unclipped_blend = &_blend_color_argb_with_maskInvA;
|
||||
else
|
||||
spdata->unclipped_blend = &_blend_color_argb_with_maskA;
|
||||
}
|
||||
{
|
||||
switch (spdata->mask_op)
|
||||
{
|
||||
default:
|
||||
case EFL_CANVAS_VG_NODE_BLEND_TYPE_ALPHA:
|
||||
spdata->unclipped_blend = &_blend_alpha;
|
||||
break;
|
||||
case EFL_CANVAS_VG_NODE_BLEND_TYPE_ALPHA_INV:
|
||||
spdata->unclipped_blend = &_blend_alpha_inv;
|
||||
break;
|
||||
case EFL_CANVAS_VG_NODE_BLEND_TYPE_MASK_ADD:
|
||||
spdata->unclipped_blend = &_blend_mask_add;
|
||||
break;
|
||||
case EFL_CANVAS_VG_NODE_BLEND_TYPE_MASK_SUBSTRACT:
|
||||
spdata->unclipped_blend = &_blend_mask_sub;
|
||||
break;
|
||||
case EFL_CANVAS_VG_NODE_BLEND_TYPE_MASK_INTERSECT:
|
||||
spdata->unclipped_blend = &_blend_mask_ins;
|
||||
break;
|
||||
case EFL_CANVAS_VG_NODE_BLEND_TYPE_MASK_DIFFERENCE:
|
||||
spdata->unclipped_blend = &_blend_mask_diff;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
spdata->unclipped_blend = &_blend_color_argb;
|
||||
spdata->unclipped_blend = &_blend_argb;
|
||||
}
|
||||
break;
|
||||
case LinearGradient:
|
||||
|
@ -378,6 +527,10 @@ _adjust_span_fill_methods(Span_Data *spdata)
|
|||
break;
|
||||
}
|
||||
|
||||
//FIXME: Mask and mask case is not use clipping.
|
||||
if (spdata->mask_op >= EFL_CANVAS_VG_NODE_BLEND_TYPE_MASK_ADD)
|
||||
spdata->clip.enabled = EINA_FALSE;
|
||||
|
||||
// Clipping Function
|
||||
if (spdata->clip.enabled)
|
||||
{
|
||||
|
|
|
@ -87,7 +87,7 @@
|
|||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
# ifdef ELEMENTARY_BUILD
|
||||
# ifdef EFL_BUILD
|
||||
# ifdef DLL_EXPORT
|
||||
# define EAPI __declspec(dllexport)
|
||||
# else
|
||||
|
@ -386,7 +386,7 @@ typedef Eo Efl_Ui_Pager;
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifndef ELEMENTARY_BUILD
|
||||
#ifndef EFL_BUILD
|
||||
# undef EAPI
|
||||
# define EAPI
|
||||
#endif
|
||||
|
|
|
@ -467,7 +467,7 @@ _efl_ui_list_efl_object_finalize(Eo *obj,
|
|||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_ui_list_efl_object_destructor(Eo *obj, Efl_Ui_List_Data *pd)
|
||||
_efl_ui_list_efl_object_invalidate(Eo *obj, Efl_Ui_List_Data *pd)
|
||||
{
|
||||
_scroll_edje_object_detach(obj);
|
||||
|
||||
|
@ -488,12 +488,14 @@ _efl_ui_list_efl_object_destructor(Eo *obj, Efl_Ui_List_Data *pd)
|
|||
|
||||
efl_del(pd->box);
|
||||
pd->box = NULL;
|
||||
|
||||
efl_del(pd->pan);
|
||||
pd->pan = NULL;
|
||||
|
||||
efl_del(pd->smanager);
|
||||
pd->smanager = NULL;
|
||||
|
||||
efl_destructor(efl_super(obj, MY_CLASS));
|
||||
efl_invalidate(efl_super(obj, MY_CLASS));
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
|
|
|
@ -42,7 +42,7 @@ class @beta Efl.Ui.List extends Efl.Ui.Layout_Base implements
|
|||
//Efl.Object
|
||||
Efl.Object.constructor;
|
||||
Efl.Object.finalize;
|
||||
Efl.Object.destructor;
|
||||
Efl.Object.invalidate;
|
||||
|
||||
//Efl.Canvas
|
||||
Efl.Canvas.Group.group_calculate;
|
||||
|
|
|
@ -1373,8 +1373,16 @@ _disabled_counter_get(Eo *widget)
|
|||
static void
|
||||
_mirror_disabled_state(Eo *obj, Elm_Widget_Smart_Data *pd, int disabled_delta)
|
||||
{
|
||||
int prev_disabled = pd->disabled;
|
||||
|
||||
pd->disabled = (pd->parent_obj ? _disabled_counter_get(pd->parent_obj) : 0) + disabled_delta;
|
||||
|
||||
//The current disabled state is the same as the parent
|
||||
//when the parent is assigned or changed, no further action is required.
|
||||
if (((prev_disabled > 0 && pd->disabled > 0)) ||
|
||||
((prev_disabled <= 0 && pd->disabled <= 0)))
|
||||
return;
|
||||
|
||||
//we should not call disabled_set when things are invalidated
|
||||
//otherwise we will unleashe an amount of errors in efl_ui_layout
|
||||
if (efl_invalidated_get(obj)) return;
|
||||
|
@ -1413,7 +1421,6 @@ _efl_ui_widget_widget_parent_set(Eo *obj, Elm_Widget_Smart_Data *pd, Efl_Ui_Widg
|
|||
*/
|
||||
double scale, prev_scale = efl_gfx_entity_scale_get(obj);
|
||||
Elm_Theme *th, *prev_th = elm_widget_theme_get(obj);
|
||||
Eina_Bool mirrored, pmirrored = efl_ui_mirrored_get(parent);
|
||||
int disabled_delta = pd->disabled - (pd->parent_obj ? _disabled_counter_get(pd->parent_obj) : 0);
|
||||
|
||||
old_parent = pd->parent_obj;
|
||||
|
@ -1422,6 +1429,7 @@ _efl_ui_widget_widget_parent_set(Eo *obj, Elm_Widget_Smart_Data *pd, Efl_Ui_Widg
|
|||
// now lets sync up all states
|
||||
if (pd->parent_obj)
|
||||
{
|
||||
Eina_Bool mirrored, pmirrored = efl_ui_mirrored_get(pd->parent_obj);
|
||||
scale = efl_gfx_entity_scale_get(obj);
|
||||
th = elm_widget_theme_get(obj);
|
||||
mirrored = efl_ui_mirrored_get(obj);
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
#define ELM_CONFIG_ICON_THEME_ELEMENTARY "_Elementary_Icon_Theme"
|
||||
|
||||
#if defined(ELEMENTARY_BUILD) || defined(ELM_INTERNAL_API_ARGESFSDFEFC)
|
||||
#if defined(EFL_BUILD) || defined(ELM_INTERNAL_API_ARGESFSDFEFC)
|
||||
#define EFL_UI_WIDGET_PROTECTED
|
||||
#define EFL_CANVAS_OBJECT_PROTECTED
|
||||
#define EFL_CANVAS_GROUP_PROTECTED
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
# ifdef ELEMENTARY_BUILD
|
||||
# ifdef EFL_BUILD
|
||||
# ifdef DLL_EXPORT
|
||||
# define EAPI __declspec(dllexport)
|
||||
# else
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
# endif
|
||||
|
||||
# ifdef _WIN32
|
||||
# ifdef ELEMENTARY_BUILD
|
||||
# ifdef EFL_BUILD
|
||||
# ifdef DLL_EXPORT
|
||||
# define EAPI __declspec(dllexport)
|
||||
# else
|
||||
|
|
|
@ -5,6 +5,23 @@
|
|||
|
||||
#define MY_CLASS EFL_CANVAS_VG_CONTAINER_CLASS
|
||||
|
||||
|
||||
//FIXME: This enum add temporarily to help understanding of additional code
|
||||
//related to masking in prepare_mask.
|
||||
//This needs to be formally declared through the eo class.
|
||||
//This is a list of blending supported via efl_canvas_vg_node_mask_set().
|
||||
typedef enum _EFL_CANVAS_VG_NODE_BLEND_TYPE
|
||||
{
|
||||
EFL_CANVAS_VG_NODE_BLEND_TYPE_NONE = 0,
|
||||
EFL_CANVAS_VG_NODE_BLEND_TYPE_ALPHA,
|
||||
EFL_CANVAS_VG_NODE_BLEND_TYPE_ALPHA_INV,
|
||||
EFL_CANVAS_VG_NODE_BLEND_TYPE_MASK_ADD,
|
||||
EFL_CANVAS_VG_NODE_BLEND_TYPE_MASK_SUBSTRACT,
|
||||
EFL_CANVAS_VG_NODE_BLEND_TYPE_MASK_INTERSECT,
|
||||
EFL_CANVAS_VG_NODE_BLEND_TYPE_MASK_DIFFERENCE
|
||||
}EFL_CANVAS_VG_NODE_BLEND_TYPE;
|
||||
//
|
||||
|
||||
static void
|
||||
_invalidate_cb(void *data EINA_UNUSED, const Efl_Event *event)
|
||||
{
|
||||
|
@ -53,6 +70,7 @@ _prepare_mask(Evas_Object_Protected_Data *obj, //vector object
|
|||
void *engine, void *output, void *context,
|
||||
Ector_Surface *surface,
|
||||
Eina_Matrix3 *ptransform,
|
||||
Eina_Matrix3 *ctransform,
|
||||
Ector_Buffer *mask,
|
||||
int mask_op)
|
||||
{
|
||||
|
@ -60,6 +78,7 @@ _prepare_mask(Evas_Object_Protected_Data *obj, //vector object
|
|||
Efl_Canvas_Vg_Node_Data *nd =
|
||||
efl_data_scope_get(mask_obj, EFL_CANVAS_VG_NODE_CLASS);
|
||||
if (nd->flags == EFL_GFX_CHANGE_FLAG_NONE) return pd->mask.buffer;
|
||||
uint32_t init_buffer = 0x0;
|
||||
|
||||
//1. Mask Size
|
||||
Eina_Rect mbound;
|
||||
|
@ -68,7 +87,9 @@ _prepare_mask(Evas_Object_Protected_Data *obj, //vector object
|
|||
mbound.w = obj->cur->geometry.w;
|
||||
mbound.h = obj->cur->geometry.h;
|
||||
|
||||
// efl_gfx_path_bounds_get(mask, &mbound);
|
||||
//FIXME: If mask typs is SUBSTRACT or INTERSECT, buffer fills in white color(Full alpha color).
|
||||
if (pd->mask.option == EFL_CANVAS_VG_NODE_BLEND_TYPE_MASK_SUBSTRACT || pd->mask.option == EFL_CANVAS_VG_NODE_BLEND_TYPE_MASK_INTERSECT)
|
||||
init_buffer = 0xFFFFFFFF;
|
||||
|
||||
//2. Reusable ector buffer?
|
||||
if (!pd->mask.buffer || (pd->mask.bound.w != mbound.w) ||
|
||||
|
@ -76,7 +97,8 @@ _prepare_mask(Evas_Object_Protected_Data *obj, //vector object
|
|||
{
|
||||
if (pd->mask.pixels) free(pd->mask.pixels);
|
||||
if (pd->mask.buffer) efl_unref(pd->mask.buffer);
|
||||
pd->mask.pixels = calloc(sizeof(uint32_t), mbound.w * mbound.h);
|
||||
pd->mask.pixels = malloc(sizeof(uint32_t) * (mbound.w * mbound.h));
|
||||
memset(pd->mask.pixels, init_buffer, sizeof(uint32_t) * (mbound.w * mbound.h));
|
||||
pd->mask.buffer = ENFN->ector_buffer_new(ENC, obj->layer->evas->evas,
|
||||
mbound.w, mbound.h,
|
||||
EFL_GFX_COLORSPACE_ARGB8888,
|
||||
|
@ -93,7 +115,7 @@ _prepare_mask(Evas_Object_Protected_Data *obj, //vector object
|
|||
else
|
||||
{
|
||||
if (pd->mask.pixels)
|
||||
memset(pd->mask.pixels, 0x0, sizeof(uint32_t) * mbound.w * mbound.h);
|
||||
memset(pd->mask.pixels, init_buffer, sizeof(uint32_t) * mbound.w * mbound.h);
|
||||
}
|
||||
|
||||
pd->mask.bound.x = mbound.x;
|
||||
|
@ -101,6 +123,22 @@ _prepare_mask(Evas_Object_Protected_Data *obj, //vector object
|
|||
|
||||
if (!pd->mask.buffer) ERR("Mask Buffer is invalid");
|
||||
|
||||
//FIXME: This code means that there is another masking container.
|
||||
if (pd->mask.option != EFL_CANVAS_VG_NODE_BLEND_TYPE_NONE)
|
||||
{
|
||||
Efl_Canvas_Vg_Container_Data *src_pd = pd;
|
||||
mask = pd->mask.buffer;
|
||||
for (Efl_VG *mask_src = pd->mask_src; mask_src; mask_src = src_pd->mask_src)
|
||||
{
|
||||
Efl_Canvas_Vg_Container_Data *target_pd = NULL;
|
||||
src_pd = efl_data_scope_get(mask_src, MY_CLASS);
|
||||
target_pd = efl_data_scope_get(eina_list_nth(src_pd->mask.target, 0), MY_CLASS);
|
||||
_evas_vg_render_pre(obj, mask_src,
|
||||
engine, output, context, surface,
|
||||
ctransform, mask, target_pd->mask.option);
|
||||
}
|
||||
}
|
||||
|
||||
//3. Prepare Drawing shapes.
|
||||
_evas_vg_render_pre(obj, mask_obj,
|
||||
engine, output, context,
|
||||
|
@ -140,12 +178,12 @@ _efl_canvas_vg_container_render_pre(Evas_Object_Protected_Data *vg_pd,
|
|||
EFL_CANVAS_VG_COMPUTE_MATRIX(ctransform, ptransform, nd);
|
||||
|
||||
//Container may have mask source.
|
||||
if (pd->mask_src)
|
||||
if (pd->mask_src && !pd->mask.target)
|
||||
{
|
||||
mask_op = pd->mask.option;
|
||||
mask = _prepare_mask(vg_pd, pd->mask_src,
|
||||
engine, output, context, surface,
|
||||
ptransform, mask, mask_op);
|
||||
mask_op = pd->mask.option;
|
||||
ptransform, ctransform, mask, mask_op);
|
||||
}
|
||||
|
||||
EINA_LIST_FOREACH(pd->children, l, child)
|
||||
|
|
|
@ -56,13 +56,13 @@ evas_common_convert_rgba_to_32bpp_rgb_8888_rot_180 (DATA32 *src, DATA8 *dst, int
|
|||
for (y = 0; y < h; y++) { \
|
||||
const pix_type *s = &(src[h - y - 1]); \
|
||||
pix_type *d = &(dst[dst_stride * y]); \
|
||||
pix_type *ptr1 = s; \
|
||||
pix_type *ptr2 = ptr1 + src_stride; \
|
||||
pix_type *ptr3 = ptr2 + src_stride; \
|
||||
pix_type *ptr4 = ptr3 + src_stride; \
|
||||
const pix_type *ptr1 = s; \
|
||||
const pix_type *ptr2 = ptr1 + src_stride; \
|
||||
const pix_type *ptr3 = ptr2 + src_stride; \
|
||||
const pix_type *ptr4 = ptr3 + src_stride; \
|
||||
for(x = 0; x < w; x += 4) { \
|
||||
pix_type s_array[4] = { *ptr1, *ptr2, *ptr3, *ptr4 }; \
|
||||
vst1q_s32(d, vld1q_s32(s_array)); \
|
||||
vst1q_u32(d, vld1q_u32(s_array)); \
|
||||
d += 4; \
|
||||
ptr1 += klght; \
|
||||
ptr2 += klght; \
|
||||
|
@ -90,18 +90,18 @@ evas_common_convert_rgba_to_32bpp_rgb_8888_rot_180 (DATA32 *src, DATA8 *dst, int
|
|||
for (y = 0; y < h; y++) { \
|
||||
const pix_type *s = &(src[(src_stride * (w - 1)) + y]); \
|
||||
pix_type *d = &(dst[dst_stride * y]); \
|
||||
pix_type *ptr1 = s; \
|
||||
pix_type *ptr2 = ptr1 + src_stride; \
|
||||
pix_type *ptr3 = ptr2 + src_stride; \
|
||||
pix_type *ptr4 = ptr3 + src_stride; \
|
||||
for(x = 0; x < w; x+=4) { \
|
||||
const pix_type *ptr1 = s; \
|
||||
const pix_type *ptr2 = ptr1 - src_stride; \
|
||||
const pix_type *ptr3 = ptr2 - src_stride; \
|
||||
const pix_type *ptr4 = ptr3 - src_stride; \
|
||||
for(x = 0; x < w; x += 4) { \
|
||||
pix_type s_array[4] = { *ptr1, *ptr2, *ptr3, *ptr4 }; \
|
||||
vst1q_s32(d, vld1q_s32(s_array)); \
|
||||
vst1q_u32(d, vld1q_u32(s_array)); \
|
||||
d += 4; \
|
||||
ptr1 += klght; \
|
||||
ptr2 += klght; \
|
||||
ptr3 += klght; \
|
||||
ptr4 += klght; \
|
||||
ptr1 -= klght; \
|
||||
ptr2 -= klght; \
|
||||
ptr3 -= klght; \
|
||||
ptr4 -= klght; \
|
||||
} \
|
||||
} \
|
||||
} \
|
||||
|
@ -111,7 +111,7 @@ evas_common_convert_rgba_to_32bpp_rgb_8888_rot_180 (DATA32 *src, DATA8 *dst, int
|
|||
pix_type *d = &(dst[dst_stride * y]); \
|
||||
for (x = 0; x < w; x++) { \
|
||||
*d++ = *s; \
|
||||
s += src_stride; \
|
||||
s -= src_stride; \
|
||||
} \
|
||||
} \
|
||||
} \
|
||||
|
|
|
@ -890,7 +890,7 @@ evas_common_map_rgba(RGBA_Image *src, RGBA_Image *dst,
|
|||
}
|
||||
|
||||
EAPI void
|
||||
evas_common_map_rgba_draw(RGBA_Image *src, RGBA_Image *dst, int clip_x, int clip_y, int clip_w, int clip_h, DATA32 mul_col, int render_op, int npoints, RGBA_Map_Point *p, int smooth, Eina_Bool anti_alias, int level, RGBA_Image *mask_ie, int mask_x, int mask_y)
|
||||
evas_common_map_rgba_draw(RGBA_Image *src, RGBA_Image *dst, int clip_x, int clip_y, int clip_w, int clip_h, DATA32 mul_col, int render_op, int npoints EINA_UNUSED, RGBA_Map_Point *p, int smooth, Eina_Bool anti_alias, int level, RGBA_Image *mask_ie, int mask_x, int mask_y)
|
||||
{
|
||||
//The best quaility requsted.
|
||||
if (anti_alias && smooth)
|
||||
|
|
|
@ -4,7 +4,9 @@
|
|||
|
||||
#include "Elementary.h"
|
||||
|
||||
#define ELEMENTARY_BUILD
|
||||
#ifndef EFL_BUILD
|
||||
# define EFL_BUILD
|
||||
#endif
|
||||
#undef ELM_MODULE_HELPER_H
|
||||
#include "elm_module_helper.h"
|
||||
|
||||
|
|
|
@ -9,7 +9,9 @@
|
|||
#include "elm_ctxpopup_item_eo.h"
|
||||
#include "elm_ctxpopup_eo.h"
|
||||
|
||||
#define ELEMENTARY_BUILD
|
||||
#ifndef EFL_BUILD
|
||||
# define EFL_BUILD
|
||||
#endif
|
||||
#undef ELM_MODULE_HELPER_H
|
||||
#include "elm_module_helper.h"
|
||||
|
||||
|
|
|
@ -4,7 +4,9 @@
|
|||
|
||||
#include "Elementary.h"
|
||||
|
||||
#define ELEMENTARY_BUILD
|
||||
#ifndef EFL_BUILD
|
||||
# define EFL_BUILD
|
||||
#endif
|
||||
#undef ELM_MODULE_HELPER_H
|
||||
#include "private.h"
|
||||
|
||||
|
|
|
@ -4,7 +4,9 @@
|
|||
|
||||
#include "Elementary.h"
|
||||
|
||||
#define ELEMENTARY_BUILD
|
||||
#ifndef EFL_BUILD
|
||||
# define EFL_BUILD
|
||||
#endif
|
||||
#undef ELM_MODULE_HELPER_H
|
||||
#include "elm_module_helper.h"
|
||||
|
||||
|
|
|
@ -6,7 +6,9 @@
|
|||
#include "elm_module_helper.h"
|
||||
#include "elm_widget_map.h"
|
||||
|
||||
#define ELEMENTARY_BUILD
|
||||
#ifndef EFL_BUILD
|
||||
# define EFL_BUILD
|
||||
#endif
|
||||
#undef ELM_MODULE_HELPER_H
|
||||
#include "elm_module_helper.h"
|
||||
|
||||
|
|
|
@ -9,7 +9,9 @@
|
|||
#include "elm_priv.h"
|
||||
#include "elm_widget_web.h"
|
||||
|
||||
#define ELEMENTARY_BUILD
|
||||
#ifndef EFL_BUILD
|
||||
# define EFL_BUILD
|
||||
#endif
|
||||
#undef ELM_MODULE_HELPER_H
|
||||
#include "elm_module_helper.h"
|
||||
#include "elm_web_none_eo.h"
|
||||
|
|
|
@ -2297,6 +2297,15 @@ evas_vg_load_file_open_svg(Eina_File *file,
|
|||
defs = loader.doc->node.doc.defs;
|
||||
if (defs)
|
||||
_update_gradient(loader.doc, defs->node.defs.gradients);
|
||||
else
|
||||
{
|
||||
if (loader.gradient)
|
||||
{
|
||||
Eina_List* gradient_list = eina_list_append(NULL, loader.gradient);
|
||||
_update_gradient(loader.doc, gradient_list);
|
||||
eina_list_free(gradient_list);
|
||||
}
|
||||
}
|
||||
|
||||
*error = EVAS_LOAD_ERROR_NONE;
|
||||
}
|
||||
|
|
|
@ -158,6 +158,7 @@ _eet_for_style_gradient(void)
|
|||
EET_DATA_DESCRIPTOR_ADD_BASIC(_eet_style_gradient_node, Svg_Style_Gradient, "type", type, EET_T_INT);
|
||||
EET_DATA_DESCRIPTOR_ADD_BASIC(_eet_style_gradient_node, Svg_Style_Gradient, "id", id, EET_T_STRING);
|
||||
EET_DATA_DESCRIPTOR_ADD_BASIC(_eet_style_gradient_node, Svg_Style_Gradient, "spread", spread, EET_T_INT);
|
||||
EET_DATA_DESCRIPTOR_ADD_BASIC(_eet_style_gradient_node, Svg_Style_Gradient, "user_space", user_space, EET_T_INT);
|
||||
EET_DATA_DESCRIPTOR_ADD_LIST(_eet_style_gradient_node, Svg_Style_Gradient, "stops", stops, _eet_gradient_stops_node);
|
||||
EET_DATA_DESCRIPTOR_ADD_SUB(_eet_style_gradient_node, Svg_Style_Gradient, "radial", radial, _eet_radial_gradient_node);
|
||||
EET_DATA_DESCRIPTOR_ADD_SUB(_eet_style_gradient_node, Svg_Style_Gradient, "linear", linear, _eet_linear_gradient_node);
|
||||
|
|
Loading…
Reference in New Issue