Dear Cedric

I'm sorry for late reply. :)

2011년 11월 3일 목요일에 Cedric BAIL님이 작성:

> On Thu, Nov 3, 2011 at 5:43 AM, Enlightenment SVN
> <[email protected] <javascript:;>> wrote:
> > Log:
> > Add CURRENT option which edje object moves from current position.
> >  Currently, when the part in edc move by transition, it moves from the
> >  one of the states to another of the states even if it is ainimating.
> >  We need it to move from current position, because the animation is not
> >  natural and smooth. So I made the "CURRENT" option.
>
> And that's patch is so super simple to read and understand now ! That
> rock ! Thanks !
>
> > Author:       jaehwan
> > Date:         2011-11-02 21:43:00 -0700 (Wed, 02 Nov 2011)
> > New Revision: 64675
> > Trac:         http://trac.enlightenment.org/e/changeset/64675
> >
> > Modified:
> >  trunk/edje/src/bin/edje_cc_handlers.c trunk/edje/src/lib/Edje.h
> trunk/edje/src/lib/edje_calc.c trunk/edje/src/lib/edje_private.h
> trunk/edje/src/lib/edje_program.c
> >
> > Modified: trunk/edje/src/bin/edje_cc_handlers.c
> > ===================================================================
> > --- trunk/edje/src/bin/edje_cc_handlers.c       2011-11-03 03:26:29 UTC
> (rev 64674)
> > +++ trunk/edje/src/bin/edje_cc_handlers.c       2011-11-03 04:43:00 UTC
> (rev 64675)
> > @@ -7121,7 +7121,7 @@
> >     @property
> >         transition
> >     @parameters
> > -        [type] [length] [[interp val 1]] [[interp val 2]]
> > +        [type] [length] [[interp val 1]] [[interp val 2]] [[option]]
> >     @effect
> >         Defines how transitions occur using STATE_SET action.\n
> >         Where 'type' is the style of the transition and 'length' is a
> double
> > @@ -7157,6 +7157,11 @@
> >         spring "swings" and val 1 specifies the decay, but it can exceed
> 1.0
> >         on the outer swings.
> >
> > +        Valid option is CURRENT.
> > +
> > +        CURRENT is the option which the edje object moves from current
> position.
> > +        It can be used as the last parameter of the every type.
> > +
> >     @endproperty
> >  */
> >  static void
> > @@ -7190,15 +7195,30 @@
> >                                            "SPRING",
> EDJE_TWEEN_MODE_SPRING,
> >                                            NULL);
> >    current_program->tween.time = FROM_DOUBLE(parse_float_range(1, 0.0,
> 999999999.0));
> > +   if ((current_program->tween.mode >= EDJE_TWEEN_MODE_LINEAR) &&
> > +       (current_program->tween.mode <= EDJE_TWEEN_MODE_DECELERATE))
> > +     {
> > +        if ((get_arg_count() == 3) && (!strcmp(parse_str(2),
> "CURRENT")))
> > +          current_program->tween.mode |=
> EDJE_TWEEN_MODE_OPT_FROM_CURRENT;
> > +        else if (get_arg_count() != 2)
> > +          {
> > +             ERR("%s: Error. parse error %s:%i. "
> > +                 "Need 2rd parameter to set time",
> > +                 progname, file_in, line - 1);
> > +             exit(-1);
> > +          }
> > +     }
> >    // the following need v1
> >    // EDJE_TWEEN_MODE_ACCELERATE_FACTOR
> >    // EDJE_TWEEN_MODE_DECELERATE_FACTOR
> >    // EDJE_TWEEN_MODE_SINUSOIDAL_FACTOR
> >    // current_program->tween.v1
> > -   if ((current_program->tween.mode >=
> EDJE_TWEEN_MODE_ACCELERATE_FACTOR) &&
> > +   else if ((current_program->tween.mode >=
> EDJE_TWEEN_MODE_ACCELERATE_FACTOR) &&
> >        (current_program->tween.mode <=
> EDJE_TWEEN_MODE_SINUSOIDAL_FACTOR))
> >      {
> > -        if (get_arg_count() != 3)
> > +        if ((get_arg_count() == 4) && (!strcmp(parse_str(3),
> "CURRENT")))
> > +          current_program->tween.mode |=
> EDJE_TWEEN_MODE_OPT_FROM_CURRENT;
> > +        else if (get_arg_count() != 3)
> >           {
> >             ERR("%s: Error. parse error %s:%i. "
> >                 "Need 3rd parameter to set factor",
> > @@ -7215,7 Hum, I don't think you should look so late into ed->x and
> ed->y. I
> guess that if the object is moved between the time your got the
> current->x position and the time you update the position, it will be
> wrong. Couldn't you directly do this operation when you retrieve the
> current state ?
>

The part which be retrieved current state is in _edje_program_run. That's
when the edje program is started
by any event or signal emit. I think the current position have to be got at
that time. And If there is transition
in program, the animator is started. While animator is called, the
edje_part_recalc is called and it decides
the object position, color and so on. So I inserted the code into that
function.

>
> > +             p1->w = ep->current->w;
> > +             p1->h = ep->current->h;
> > +             p1->color.r = ep->current->color.r;
> > +             p1->color.g = ep->current->color.g;
> > +             p1->color.b = ep->current->color.b;
> > +             p1->color.a = ep->current->color.a;
> > +             p1->type.text.size = ep->current->type.text.size;
> > +             p1->type.text.color2.r = ep->current->type.text.color2.r;
> > +             p1->type.text.color2.g = ep->current->type.text.color2.g;
> > +             p1->type.text.color2.b = ep->current->type.text.color2.b;
> > +             p1->type.text.color2.a = ep->current->type.text.color2.a;
> > +             p1->type.text.color3.r = ep->current->type.text.color3.r;
> > +             p1->type.text.color3.g = ep->current->type.text.color3.g;
> > +             p1->type.text.color3.b = ep->current->type.text.color3.b;
> > +             p1->type.text.color3.a = ep->current->type.text.color3.a;
> > +          }
>
> There is still some parameter that are not extracted from the current
> state and I really think that at the end, you should just do *p1 =
> *ep->current;. If you do so, that mean you don't need to compute p1 at
> all, so you should disable it's computation a little bit earlier in
> this function.
>

The reason that I don't use *p1 = *ep->current is why I want to keep the p1
value which is calculated
by _edje_part_recalc_single except the value related to "current". So I
think the code is right.

>        p3 = &lp3;
> >
> >  #ifndef EDJE_CALC_CACHE
> >
> > Modified: trunk/edje/src/lib/edje_private.h
> > ===================================================================
> > --- trunk/edje/src/lib/edje_private.h   2011-11-03 03:26:29 UTC (rev
> 64674)
> > +++ trunk/edje/src/lib/edje_private.h   2011-11-03 04:43:00 UTC (rev
> 64675)
> > @@ -1212,6 +1212,7 @@
> >    Edje_Real_Part_State      param1; // 20
> >    // WITH EDJE_CALC_CACHE: 140
> >    Edje_Real_Part_State     *param2, *custom; // 8
> > +   Edje_Calc_Params         *current; // 4
> >
> >  #ifdef EDJE_CALC_CACHE
> >    int                       state; // 4
> > @@ -1230,8 +1231,8 @@
> >  #ifdef EDJE_CALC_CACHE
> >    unsigned char             invalidate : 1; // 0
> >  #endif
> > -}; //  260
> > -// WITH EDJE_CALC_CACHE: 400
> > +}; //  264
> > +// WITH EDJE_CALC_CACHE: 404
> >
> >  struct _Edje_Running_Program
> >  {
> >
> > Modified: trunk/edje/src/lib/edje_program.c
> > ===================================================================
> > --- trunk/edje/src/lib/edje_program.c   2011-11-03 03:26:29 UTC (rev
> 64674)
> > +++ trunk/edje/src/lib/edje_program.c   2011-11-03 04:43:00 UTC (rev
> 64675)
> > @@ -478,6 +478,35 @@
> >                       rp = ed->table_parts[pt->id %
> ed->table_parts_size];
> >                       if (rp)
> >                         {
> > +                            if ((rp->object) && (pr->tween.mode &
> EDJE_TWEEN_MODE_OPT_FROM_CURRENT))
> > +                              {
> > +                                 rp->current = calloc(1,
> sizeof(Edje_Calc_Params));
> > +                                 evas_object_geometry_get(rp->object,
> &(rp->current->x),
> > +
>  &(rp->current->y),
> > +
>  &(rp->current->w),
> > +
>  &(rp->current->h));
> > +                                 evas_object_color_get(rp->object, (int
> *)&(rp->current->color.r),
> > +                                                       (int
> *)&(rp->current->color.g),
> > +                                                       (int
> *)&(rp->current->color.b),
> > +                                                       (int
> *)&(rp->current->color.a));
> > +                                 evas_object_text_font_get(rp->object,
> NULL, &(rp->current->type.text.size));
> > +
> evas_object_text_outline_color_get(rp->object,
> > +                                                       (int *)Please
> don't rely on Evas doing type/magic check to have this working.
> It would be way nicer to have a switch/case that handle part->type and
> do the reverse of what we do in edje_calc.c
>
> > +                              }
> > +                            else
> > +                              {
> > +                                 if (rp->current) free(rp->current);
> > +                                 rp->current = NULL;
> > +                              }
> > +
> >                            if (rp->program)
> >                              _edje_program_end(ed, rp->program);
> >                            _edje_part_description_apply(ed, rp,
>
> Anyway, that's a very nice patch, like what was done just need a
> little bit more polish and that would be ready for 1.1.
>
> I changed the ChangeLog and added since 1.1
Thanks
--
Jaehwan Kim.
------------------------------------------------------------------------------
RSA(R) Conference 2012
Save $700 by Nov 18
Register now
http://p.sf.net/sfu/rsa-sfdev2dev1
_______________________________________________
enlightenment-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to