Hey,

Few comments.


On 19/09/14 05:48, Jaehwan Kim wrote:
> jaehwan pushed a commit to branch master.
>
> http://git.enlightenment.org/core/elementary.git/commit/?id=f75b121f6428cf6aea7387d8700a887e6ca4a98a
>
> commit f75b121f6428cf6aea7387d8700a887e6ca4a98a
> Author: Jaehwan Kim <[email protected]>
> Date:   Fri Sep 19 13:45:03 2014 +0900
>
>      scale: set the base scale of the application.
>
>      The scale is used for the application to be scaled.
>      If the application isn't made on the basis of scale 1.0,
>      the application layout will be scaled inappositely. So if the
>      application set the base scale, it is applied when the application is 
> scaled.
> ---
>   src/lib/elm_app.h    | 27 +++++++++++++++++++++++++++
>   src/lib/elm_macros.h |  1 +
>   src/lib/elm_main.c   | 15 +++++++++++++++
>   3 files changed, 43 insertions(+)
>
> diff --git a/src/lib/elm_app.h b/src/lib/elm_app.h
> index f08fd1b..df2a37c 100644
> --- a/src/lib/elm_app.h
> +++ b/src/lib/elm_app.h
> @@ -266,5 +266,32 @@ EAPI const char *elm_app_data_dir_get(void);
>   EAPI const char *elm_app_locale_dir_get(void);
>
>   /**
> + * Set the base scale of the application.
> + *
> + * @param base_scale The scale that the application is made on the basis of.
> + *
> + * @note The scale is used for the application to be scaled.
> + * If the application isn't made on the basis of scale 1.0,
> + * the application layout will be scaled inappositely. So if the application 
> set
> + * the base scale, it is applied when the application is scaled.
> + *
> + * @note You should call this function @b before using ELM_SCALE_SIZE macro.
> + *
> + * @ingroup App
> + * @since 1.12
> + */
> +EAPI void elm_app_base_scale_set(double base_scale);
> +
> +/**
> + * Get the base scale of the application.
> + *
> + * @return The base scale which the application sets.
> + *
> + * @ingroup App
> + * @since 1.12
> + */
> +EAPI double elm_app_base_scale_get(void);
> +
> +/**
>    * @}
>    */
> diff --git a/src/lib/elm_macros.h b/src/lib/elm_macros.h
> index c25e956..05403ae 100644
> --- a/src/lib/elm_macros.h
> +++ b/src/lib/elm_macros.h
> @@ -1,6 +1,7 @@
>   /* handy macros */
>   #define ELM_RECTS_INTERSECT(x, y, w, h, xx, yy, ww, hh) (((x) < ((xx) + 
> (ww))) && ((y) < ((yy) + (hh))) && (((x) + (w)) > (xx)) && (((y) + (h)) > 
> (yy)))
>   #define ELM_PI 3.14159265358979323846
> +#define ELM_SCALE_SIZE(x) x / elm_app_base_scale_get() * 
> elm_config_scale_get()


This is bad... Very bad...

Should be:
#define ELM_SCALE_SIZE(x) ((x) / (elm_app_base_scale_get() * 
elm_config_scale_get()))

And even this doesn't take division by zero into account... You should 
really work this up.


>
>   // checks if the point(xx, yy) stays out of the rectangle(x, y, w, h) area.
>   #define ELM_RECTS_POINT_OUT(x, y, w, h, xx, yy) (((xx) < (x)) || ((yy) < 
> (y)) || ((xx) > ((x) + (w))) || ((yy) > ((y) + (h))))
> diff --git a/src/lib/elm_main.c b/src/lib/elm_main.c
> index 1977994..9fabd43 100644
> --- a/src/lib/elm_main.c
> +++ b/src/lib/elm_main.c
> @@ -127,6 +127,7 @@ static const char *app_bin_dir = NULL;
>   static const char *app_lib_dir = NULL;
>   static const char *app_data_dir = NULL;
>   static const char *app_locale_dir = NULL;
> +static double app_base_scale = 1.0;
>
>   static Eina_Prefix *app_pfx = NULL;
>
> @@ -457,6 +458,20 @@ elm_app_locale_dir_get(void)
>      return app_locale_dir;
>   }
>
> +EAPI void
> +elm_app_base_scale_set(double base_scale)
> +{
> +   if (base_scale <= 0.0) return;
> +   app_base_scale = base_scale;
> +}
> +
> +EAPI double
> +elm_app_base_scale_get(void)
> +{
> +   if (app_base_scale) return app_base_scale;
> +   return 1.0;
> +}
> +

You can't/shouldn't use the equal sign (or the true checks) in 
comparison of floating point numbers. Anyway, in the scale_get, you 
should probably drop the if altogether, as app_base_scale can never be zero.

>   static Eina_Bool _elm_need_e_dbus = EINA_FALSE;
>   static void *e_dbus_handle = NULL;
>
>


--
Tom.


------------------------------------------------------------------------------
Slashdot TV.  Video for Nerds.  Stuff that Matters.
http://pubads.g.doubleclick.net/gampad/clk?id=160591471&iu=/4140/ostg.clktrk
_______________________________________________
enlightenment-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to