From d810de418ec98f7c33c10628b65acc8fb14cbdea Mon Sep 17 00:00:00 2001 From: Savio Sena Date: Wed, 24 Sep 2014 04:13:41 -0300 Subject: [PATCH] Fixed some casts. --- src/bin/cxx/image_data_argb.cc | 2 +- src/bin/cxx/image_data_argb_alpha.cc | 10 ++--- src/bin/cxx/image_data_ycbcr601pl.cc | 8 ++-- ...ata_ycbcr601pl_map_nearest_solid_rotate.cc | 8 ++-- .../image_data_ycbcr601pl_map_solid_rotate.cc | 42 +++++++++---------- .../cxx/image_data_ycbcr601pl_wide_stride.cc | 13 +++--- src/bin/cxx/image_map_3d_3.cc | 2 +- src/bin/cxx/image_map_3d_4.cc | 2 +- src/bin/cxx/image_map_3d_5.cc | 2 +- src/bin/cxx/image_map_3d_6.cc | 4 +- .../image_map_color_alpha_nearest_rotate.cc | 13 +++--- ...ge_map_color_alpha_nearest_solid_rotate.cc | 2 +- .../cxx/image_map_color_alpha_solid_rotate.cc | 2 +- .../image_map_color_nearest_solid_rotate.cc | 2 +- src/bin/cxx/image_map_color_solid_rotate.cc | 2 +- src/bin/cxx/image_map_nearest_solid_rotate.cc | 31 +++++++------- src/bin/cxx/image_map_solid_rotate.cc | 29 ++++++------- src/bin/cxx/image_quality_scale.cc | 32 +++++++------- src/bin/cxx/widgets_file_icons_2.cc | 8 +--- 19 files changed, 98 insertions(+), 116 deletions(-) diff --git a/src/bin/cxx/image_data_argb.cc b/src/bin/cxx/image_data_argb.cc index 3041200..e666c8a 100644 --- a/src/bin/cxx/image_data_argb.cc +++ b/src/bin/cxx/image_data_argb.cc @@ -61,7 +61,7 @@ static void _loop(double t, int f) (*itr).position_set(x, y); (*itr).evas::object::size_set(w, h); (*itr).fill_set(0, 0, w, h); - data = (*itr).data_get(1); + data = static_cast((*itr).data_get(1)); st = (*itr).stride_get(); // XXX st = st >> 2; p = data; diff --git a/src/bin/cxx/image_data_argb_alpha.cc b/src/bin/cxx/image_data_argb_alpha.cc index 1f230d5..4db9f6c 100644 --- a/src/bin/cxx/image_data_argb_alpha.cc +++ b/src/bin/cxx/image_data_argb_alpha.cc @@ -49,11 +49,9 @@ static void _cleanup(void) /* loop - do things */ static void _loop(double t, int f) { - int st; auto itr = images.begin(); - for (i = 0; i < 1; i++, ++itr) + for (int i = 0; i < 1; i++, ++itr) { - unsigned int *data, *p; int a, r, g, b; Evas_Coord w = 640; Evas_Coord h = 480; @@ -62,10 +60,10 @@ static void _loop(double t, int f) (*itr).evas::object::position_set(x, y); (*itr).evas::object::size_set(w, h); (*itr).fill_set(0, 0, w, h); - data = (*itr).data_get(1); - st = evas_obj_image_stride_get(); + unsigned int *data = static_cast((*itr).data_get(1)); + int st = evas_obj_image_stride_get(); st = st >> 2; - p = data; + unsigned int *p = data; for (y = 0; y < h; y++) { for (x = 0; x < w; x++) diff --git a/src/bin/cxx/image_data_ycbcr601pl.cc b/src/bin/cxx/image_data_ycbcr601pl.cc index 1c38578..79353b9 100644 --- a/src/bin/cxx/image_data_ycbcr601pl.cc +++ b/src/bin/cxx/image_data_ycbcr601pl.cc @@ -37,9 +37,9 @@ static void _setup(void) o.fill_set(0, 0, 640, 480); o.evas::object::size_set(640, 480); o.visibility_set(true); - yp = malloc(640 * 480); - up = malloc(320 * 240); - vp = malloc(320 * 240); + yp = static_cast(malloc(640 * 480)); + up = static_cast(malloc(320 * 240)); + vp = static_cast(malloc(320 * 240)); FILE *f = fopen(build_path("tp.yuv"), "rb"); if (f) { @@ -48,7 +48,7 @@ static void _setup(void) fread(vp, 320 * 240, 1, f); fclose(f); } - unsigned char **data = evas_object_image_data_get(images[i], 1); + unsigned char **data = static_cast(o.data_get(1)); unsigned char **lp = data; for (int y = 0; y < 480; y++) { diff --git a/src/bin/cxx/image_data_ycbcr601pl_map_nearest_solid_rotate.cc b/src/bin/cxx/image_data_ycbcr601pl_map_nearest_solid_rotate.cc index 1da65f6..ffd96b9 100644 --- a/src/bin/cxx/image_data_ycbcr601pl_map_nearest_solid_rotate.cc +++ b/src/bin/cxx/image_data_ycbcr601pl_map_nearest_solid_rotate.cc @@ -38,9 +38,9 @@ static void _setup(void) o.evas::object::size_set(640, 480); o.smooth_scale_set(0); o.visibility_set(true); - yp = malloc(640 * 480); - up = malloc(320 * 240); - vp = malloc(320 * 240); + yp = static_cast(malloc(640 * 480)); + up = static_cast(malloc(320 * 240)); + vp = static_cast(malloc(320 * 240)); FILE *f = fopen(build_path("tp.yuv"), "rb"); if (f) { @@ -49,7 +49,7 @@ static void _setup(void) fread(vp, 320 * 240, 1, f); fclose(f); } - unsigned char **data = o.data_get(1); // XXX + unsigned char **data = static_cast(o.data_get(1)); // XXX unsigned char **lp = data; for (int y = 0; y < 480; y++) { diff --git a/src/bin/cxx/image_data_ycbcr601pl_map_solid_rotate.cc b/src/bin/cxx/image_data_ycbcr601pl_map_solid_rotate.cc index ecc482b..3387844 100644 --- a/src/bin/cxx/image_data_ycbcr601pl_map_solid_rotate.cc +++ b/src/bin/cxx/image_data_ycbcr601pl_map_solid_rotate.cc @@ -25,26 +25,22 @@ static unsigned char *yp = NULL, *up = NULL, *vp = NULL; /* setup */ static void _setup(void) { - int i, y; - FILE *f; - unsigned char **data, **lp; evas::canvas canvas(::eo_ref(G_evas)); - for (i = 0; i < 1; i++) + for (int i = 0; i < 1; i++) { evas::image o(efl::eo::parent = canvas); images.push_back(o); - eo_do(o, - evas_obj_image_content_hint_set(EVAS_IMAGE_CONTENT_HINT_DYNAMIC), - evas_obj_image_colorspace_set(EVAS_COLORSPACE_YCBCR422P601_PL), - evas_obj_image_size_set(640, 480), - evas_obj_image_alpha_set(0), - evas_obj_image_fill_set(0, 0, 640, 480), - evas_obj_size_set(640, 480), - evas_obj_visibility_set(EINA_TRUE)); - yp = malloc(640 * 480); - up = malloc(320 * 240); - vp = malloc(320 * 240); - f = fopen(build_path("tp.yuv"), "rb"); + o.content_hint_set(EVAS_IMAGE_CONTENT_HINT_DYNAMIC); + o.colorspace_set(EVAS_COLORSPACE_YCBCR422P601_PL); + o.size_set(640, 480); + o.alpha_set(0); + o.fill_set(0, 0, 640, 480); + o.evas::object::size_set(640, 480); + o.evas::object::visibility_set(true); + yp = static_cast(malloc(640 * 480)); + up = static_cast(malloc(320 * 240)); + vp = static_cast(malloc(320 * 240)); + FILE *f = fopen(build_path("tp.yuv"), "rb"); if (f) { fread(yp, 640 * 480, 1, f); @@ -52,24 +48,24 @@ static void _setup(void) fread(vp, 320 * 240, 1, f); fclose(f); } - data = evas_object_image_data_get(images[i], 1); - lp = data; - for (y = 0; y < 480; y++) + unsigned char **data = static_cast(o.data_get(1)); + unsigned char **lp = data; + for (int y = 0; y < 480; y++) { *lp = yp + (y * 640); lp++; } - for (y = 0; y < 240; y++) + for (int y = 0; y < 240; y++) { *lp = up + (y * 320); lp++; } - for (y = 0; y < 240; y++) + for (int y = 0; y < 240; y++) { *lp = vp + (y * 320); lp++; } - eo_do(images[i], evas_obj_image_data_set(data)); + o.data_set(data); } done = 0; } @@ -77,7 +73,7 @@ static void _setup(void) /* cleanup */ static void _cleanup(void) { - for (int i = 0; i < 1; i++) eo_del(images[i]); + images.clear(); free(yp); free(up); free(vp); diff --git a/src/bin/cxx/image_data_ycbcr601pl_wide_stride.cc b/src/bin/cxx/image_data_ycbcr601pl_wide_stride.cc index 540ee97..e7ffcb5 100644 --- a/src/bin/cxx/image_data_ycbcr601pl_wide_stride.cc +++ b/src/bin/cxx/image_data_ycbcr601pl_wide_stride.cc @@ -25,7 +25,6 @@ static unsigned char *yp = NULL, *up = NULL, *vp = NULL; /* setup */ static void _setup(void) { - unsigned char **data, **lp; evas::canvas canvas(::eo_ref(G_evas)); for (int i = 0; i < 1; i++) { @@ -38,9 +37,9 @@ static void _setup(void) o.fill_set(0, 0, 640, 480); o.evas::object::size_set(640, 480); o.evas::object::visibility_set(true); - yp = malloc(640 * 480); - up = malloc(320 * 240); - vp = malloc(320 * 240); + yp = static_cast(malloc(640 * 480)); + up = static_cast(malloc(320 * 240)); + vp = static_cast(malloc(320 * 240)); FILE *f = fopen(build_path("tp.yuv"), "rb"); if (f) { @@ -49,10 +48,10 @@ static void _setup(void) fread(vp, 320 * 240, 1, f); fclose(f); } - data = o.data_get(1); + unsigned char **data = static_cast(o.data_get(1)); if (data) { - lp = data; + unsigned char **lp = data; for (int y = 0; y < 480; y++) { *lp = yp + (y * 640); @@ -105,7 +104,7 @@ static void _loop(double t, int f) w &= ~0x1; (*itr).size_set(w, 480); - unsigned char **data = (*itr).data_get(1); + unsigned char **data = static_cast((*itr).data_get(1)); if (data) { unsigned char **lp = data; diff --git a/src/bin/cxx/image_map_3d_3.cc b/src/bin/cxx/image_map_3d_3.cc index 9e1b899..3812c6d 100644 --- a/src/bin/cxx/image_map_3d_3.cc +++ b/src/bin/cxx/image_map_3d_3.cc @@ -52,7 +52,7 @@ _cube_new(Evas_Coord w, Evas_Coord h, Evas_Coord d) w -= (w / 2); h -= (h / 2); d -= (d / 2); - c = calloc(1, sizeof(Cube)); + c = static_cast(calloc(1, sizeof(Cube))); for (int i = 0; i < 6; i++) { Evas_Object *o; diff --git a/src/bin/cxx/image_map_3d_4.cc b/src/bin/cxx/image_map_3d_4.cc index 2786510..5e48a19 100644 --- a/src/bin/cxx/image_map_3d_4.cc +++ b/src/bin/cxx/image_map_3d_4.cc @@ -52,7 +52,7 @@ _cube_new(Evas_Coord w, Evas_Coord h, Evas_Coord d) w -= (w / 2); h -= (h / 2); d -= (d / 2); - c = calloc(1, sizeof(Cube)); + c = static_cast(calloc(1, sizeof(Cube))); for (int i = 0; i < 6; i++) { Evas_Object *o; diff --git a/src/bin/cxx/image_map_3d_5.cc b/src/bin/cxx/image_map_3d_5.cc index bd5752f..fadb253 100644 --- a/src/bin/cxx/image_map_3d_5.cc +++ b/src/bin/cxx/image_map_3d_5.cc @@ -52,7 +52,7 @@ _cube_new(Evas_Coord w, Evas_Coord h, Evas_Coord d) w -= (w / 2); h -= (h / 2); d -= (d / 2); - c = calloc(1, sizeof(Cube)); + c = static_cast(calloc(1, sizeof(Cube))); for (int i = 0; i < 6; i++) { Evas_Object *o; diff --git a/src/bin/cxx/image_map_3d_6.cc b/src/bin/cxx/image_map_3d_6.cc index e399993..fe5f671 100644 --- a/src/bin/cxx/image_map_3d_6.cc +++ b/src/bin/cxx/image_map_3d_6.cc @@ -52,10 +52,10 @@ _cube_new(Evas_Coord w, Evas_Coord h, Evas_Coord d) w -= (w / 2); h -= (h / 2); d -= (d / 2); - c = calloc(1, sizeof(Cube)); + c = static_cast(calloc(1, sizeof(Cube))); for (int i = 0; i < 6; i++) { - Evas_Object *o; + Evas_Object *o; // XXX char buf[256]; o = eo_add(EVAS_IMAGE_CLASS, G_evas); c->side[i].o = o; diff --git a/src/bin/cxx/image_map_color_alpha_nearest_rotate.cc b/src/bin/cxx/image_map_color_alpha_nearest_rotate.cc index 23ab039..1771efb 100644 --- a/src/bin/cxx/image_map_color_alpha_nearest_rotate.cc +++ b/src/bin/cxx/image_map_color_alpha_nearest_rotate.cc @@ -29,12 +29,11 @@ static void _setup(void) { evas::image o(efl::eo::parent = canvas); images.push_back(o); - eo_do(o, - efl_file_set(build_path("logo.png"), NULL), - evas_obj_image_fill_set(0, 0, 120, 160), - evas_obj_size_set(120, 160), - efl_image_smooth_scale_set(0), - evas_obj_visibility_set(EINA_TRUE)); + o.file_set(build_path("logo.png"), ""); + o.fill_set(0, 0, 120, 160); + o.evas::object::size_set(120, 160); + o.smooth_scale_set(0); + o.visibility_set(true); } done = 0; } @@ -42,7 +41,7 @@ static void _setup(void) /* cleanup */ static void _cleanup(void) { - for (int i = 0; i < (OBNUM / 2); i++) eo_del(images[i]); + images.clear(); } /* loop - do things */ diff --git a/src/bin/cxx/image_map_color_alpha_nearest_solid_rotate.cc b/src/bin/cxx/image_map_color_alpha_nearest_solid_rotate.cc index 3e0d93f..edbb713 100644 --- a/src/bin/cxx/image_map_color_alpha_nearest_solid_rotate.cc +++ b/src/bin/cxx/image_map_color_alpha_nearest_solid_rotate.cc @@ -42,7 +42,7 @@ static void _setup(void) /* cleanup */ static void _cleanup(void) { - for (int i = 0; i < (OBNUM / 2); i++) eo_del(images[i]); + images.clear(); } /* loop - do things */ diff --git a/src/bin/cxx/image_map_color_alpha_solid_rotate.cc b/src/bin/cxx/image_map_color_alpha_solid_rotate.cc index 3fd18d0..57e203f 100644 --- a/src/bin/cxx/image_map_color_alpha_solid_rotate.cc +++ b/src/bin/cxx/image_map_color_alpha_solid_rotate.cc @@ -41,7 +41,7 @@ static void _setup(void) /* cleanup */ static void _cleanup(void) { - for (int i = 0; i < (OBNUM / 2); i++) eo_del(images[i]); + images.clear(); } /* loop - do things */ diff --git a/src/bin/cxx/image_map_color_nearest_solid_rotate.cc b/src/bin/cxx/image_map_color_nearest_solid_rotate.cc index eb13110..71f6648 100644 --- a/src/bin/cxx/image_map_color_nearest_solid_rotate.cc +++ b/src/bin/cxx/image_map_color_nearest_solid_rotate.cc @@ -42,7 +42,7 @@ static void _setup(void) /* cleanup */ static void _cleanup(void) { - for (int i = 0; i < (OBNUM / 2); i++) eo_del(images[i]); + images.clear(); } /* loop - do things */ diff --git a/src/bin/cxx/image_map_color_solid_rotate.cc b/src/bin/cxx/image_map_color_solid_rotate.cc index 04a21f9..3a2ade0 100644 --- a/src/bin/cxx/image_map_color_solid_rotate.cc +++ b/src/bin/cxx/image_map_color_solid_rotate.cc @@ -41,7 +41,7 @@ static void _setup(void) /* cleanup */ static void _cleanup(void) { - for (int i = 0; i < (OBNUM / 2); i++) eo_del(images[i]); + images.clear(); } /* loop - do things */ diff --git a/src/bin/cxx/image_map_nearest_solid_rotate.cc b/src/bin/cxx/image_map_nearest_solid_rotate.cc index 0404691..7f38ce9 100644 --- a/src/bin/cxx/image_map_nearest_solid_rotate.cc +++ b/src/bin/cxx/image_map_nearest_solid_rotate.cc @@ -29,12 +29,11 @@ static void _setup(void) { evas::image o(efl::eo::parent = canvas); images.push_back(o); - eo_do(o, - efl_file_set(build_path("image.png"), NULL), - evas_obj_image_fill_set(0, 0, 120, 160), - evas_obj_size_set(120, 160), - efl_image_smooth_scale_set(0), - evas_obj_visibility_set(EINA_TRUE)); + o.file_set(build_path("image.png"), ""); + o.fill_set(0, 0, 120, 160); + o.evas::object::size_set(120, 160); + o.smooth_scale_set(0); + o.visibility_set(true); } done = 0; } @@ -42,32 +41,30 @@ static void _setup(void) /* cleanup */ static void _cleanup(void) { - for (int i = 0; i < (OBNUM / 2); i++) eo_del(images[i]); + images.clear(); } /* loop - do things */ static void _loop(double t, int f) { static Evas_Map *m = NULL; - Evas_Coord x, y, w, h; if (!m) m = evas_map_new(4); evas_map_smooth_set(m, 0); - for (int i = 0; i < (OBNUM / 2); i++) + auto itr = images.begin(); + for (int i = 0; i < (OBNUM / 2); i++, ++itr) { - w = 120; - h = 160; - x = (win_w / 2) - (w / 2); + Evas_Coord w = 120; + Evas_Coord h = 160; + Evas_Coord x = (win_w / 2) - (w / 2); x += sin((double)(f + (i * 13)) / (36.7 * SLOW)) * (w / 2); - y = (win_h / 2) - (h / 2); + Evas_Coord y = (win_h / 2) - (h / 2); y += cos((double)(f + (i * 28)) / (43.8 * SLOW)) * (h / 2); evas_map_util_points_populate_from_geometry(m, x, y, w, h, 0); - evas_map_util_rotate(m, f, x + (w / 2), y + (h / 2)); - eo_do(images[i], - evas_obj_map_enable_set(1), - evas_obj_map_set(m)); + (*itr).map_enable_set(1); + (*itr).map_set(m)); } FPS_STD(NAME); } diff --git a/src/bin/cxx/image_map_solid_rotate.cc b/src/bin/cxx/image_map_solid_rotate.cc index 3516c71..03761ba 100644 --- a/src/bin/cxx/image_map_solid_rotate.cc +++ b/src/bin/cxx/image_map_solid_rotate.cc @@ -29,11 +29,10 @@ static void _setup(void) { evas::image o(efl::eo::parent = canvas); images.push_back(o); - eo_do(o, - efl_file_set(build_path("image.png"), NULL), - evas_obj_image_fill_set(0, 0, 120, 160), - evas_obj_size_set(120, 160), - evas_obj_visibility_set(EINA_TRUE)); + o.file_set(build_path("image.png"), ""); + o.fill_set(0, 0, 120, 160); + o.evas::object::size_set(120, 160); + o.evas::object::visibility_set(EINA_TRUE); } done = 0; } @@ -41,31 +40,29 @@ static void _setup(void) /* cleanup */ static void _cleanup(void) { - for (int i = 0; i < (OBNUM / 2); i++) eo_del(images[i]); + images.clear(); } /* loop - do things */ static void _loop(double t, int f) { static Evas_Map *m = NULL; - Evas_Coord x, y, w, h; if (!m) m = evas_map_new(4); - for (int i = 0; i < (OBNUM / 2); i++) + auto itr = images.begin(); + for (int i = 0; i < (OBNUM / 2); i++, ++itr) { - w = 120; - h = 160; - x = (win_w / 2) - (w / 2); + Evas_Coord w = 120; + Evas_Coord h = 160; + Evas_Coord x = (win_w / 2) - (w / 2); x += sin((double)(f + (i * 13)) / (36.7 * SLOW)) * (w / 2); - y = (win_h / 2) - (h / 2); + Evas_Coord y = (win_h / 2) - (h / 2); y += cos((double)(f + (i * 28)) / (43.8 * SLOW)) * (h / 2); evas_map_util_points_populate_from_geometry(m, x, y, w, h, 0); - evas_map_util_rotate(m, f, x + (w / 2), y + (h / 2)); - eo_do(images[i], - evas_obj_map_enable_set(1), - evas_obj_map_set(m)); + (*itr).map_enable_set(1); + (*itr).map_set(m); } FPS_STD(NAME); } diff --git a/src/bin/cxx/image_quality_scale.cc b/src/bin/cxx/image_quality_scale.cc index 0772ddb..2be2af4 100644 --- a/src/bin/cxx/image_quality_scale.cc +++ b/src/bin/cxx/image_quality_scale.cc @@ -29,10 +29,10 @@ static void _setup(void) { evas::image o(efl::eo::parent = canvas); images.push_back(o); - eo_do(o, efl_file_set(build_path("tp.png"), NULL), - evas_obj_image_fill_set(0, 0, 640, 480), - evas_obj_size_set(640, 480), - evas_obj_visibility_set(EINA_TRUE)); + o.file_set(build_path("tp.png"), ""); + o.fill_set(0, 0, 640, 480); + o.evas::object::size_set(640, 480); + o.visibility_set(true); } done = 0; } @@ -40,24 +40,24 @@ static void _setup(void) /* cleanup */ static void _cleanup(void) { - for (int i = 0; i < 1; i++) eo_del(images[i]); + images.clear(); } /* loop - do things */ static void _loop(double t, int f) { - Evas_Coord x, y, w, h; - for (int i = 0; i < 1; i++) + auto itr = images.begin(); + for (int i = 0; i < 1; i++, ++itr) { - w = 640; - h = 480; - w *= (f / 100.0) * 4.0; - h *= (f / 100.0) * 4.0; - x = (win_w / 2) - (w / 2); - y = (win_h / 2) - (h / 2); - eo_do(images[i], evas_obj_position_set(x, y), - evas_obj_size_set(w, h), - evas_obj_image_fill_set(0, 0, w, h)); + Evas_Coord w = 640; + Evas_Coord h = 480; + Evas_Coord w *= (f / 100.0) * 4.0; + Evas_Coord h *= (f / 100.0) * 4.0; + Evas_Coord x = (win_w / 2) - (w / 2); + Evas_Coord y = (win_h / 2) - (h / 2); + (*itr).position_set(x, y); + (*itr).msize_set(w, h); + (*itr).fill_set(0, 0, w, h); } FPS_STD(NAME); } diff --git a/src/bin/cxx/widgets_file_icons_2.cc b/src/bin/cxx/widgets_file_icons_2.cc index 7ad890f..867b364 100644 --- a/src/bin/cxx/widgets_file_icons_2.cc +++ b/src/bin/cxx/widgets_file_icons_2.cc @@ -66,12 +66,8 @@ static void _setup(void) /* cleanup */ static void _cleanup(void) { - int i; - for (i = 0; i < NUM; i++) - { - eo_del(images[i]); - eo_del(o_texts[i]); - } + images.clear(); + texts.clear(); } static void _key(char *key) {