Evas_Coord oh)
{
Evas_Coord ax, ay, gw, gh;
+ Evas_Coord offset_x, offset_y;
ELM_PHOTOCAM_DATA_GET(obj, sd);
if (ow > gw) ax = (ow - gw) / 2;
if (oh > gh) ay = (oh - gh) / 2;
}
- evas_object_move(sd->img, ox + 0 - px + ax, oy + 0 - py + ay);
if (rw != 0 && rh != 0) // TIZEN_ONLY(20150813): resize image only when viewport has a size
- evas_object_resize(sd->img, gw, gh);
+ {
+ offset_x = ox - px + ax;
+ offset_y = oy - py + ay;
+
+ double degree = 0;
+ if (sd->orient == EVAS_IMAGE_ORIENT_90) degree = 90;
+ else if (sd->orient == EVAS_IMAGE_ORIENT_180) degree = 180;
+ else if (sd->orient == EVAS_IMAGE_ORIENT_270) degree = 270;
+
+ double rate = 1;
+
+ //rotated?
+ if (degree == 90 || degree == 270)
+ {
+ double temp = sd->size.h > oh ? sd->size.h : oh;
+ rate = temp / (double) sd->size.w;
+ }
+
+ evas_object_move(sd->img, offset_x, offset_y);
+ evas_object_resize(sd->img, gw, gh);
+ evas_map_util_points_populate_from_object_full(sd->map, sd->img, 0);
+ evas_map_util_rotate(sd->map, degree, (sd->size.w/2) + ax, (sd->size.h/2) + ay);
+ evas_map_util_zoom(sd->map, rate, rate, (sd->size.w/2) + ax, (sd->size.h/2) + ay);
+ evas_object_map_set(sd->img, sd->map);
+ evas_object_map_enable_set(sd->img, EINA_TRUE);
+ }
if (sd->show.show)
{
}
}
+static int
+_nearest_pow2_get(int num)
+{
+ unsigned int n = num - 1;
+
+ n |= n >> 1;
+ n |= n >> 2;
+ n |= n >> 4;
+ n |= n >> 8;
+ n |= n >> 16;
+
+ return n + 1;
+}
+
+static int
+_grid_zoom_calc(double zoom)
+{
+ int z = zoom;
+
+ if (z < 1) z = 1;
+ if (z > 8) z = 8; // TIZEN_ONLY(20150813): need to create 1x1 grid when zoom >= 8 to load high res img
+ return _nearest_pow2_get(z);
+}
+
+static void
+_grid_raise(Elm_Phocam_Grid *g)
+{
+ int x, y;
+
+ for (y = 0; y < g->gh; y++)
+ {
+ for (x = 0; x < g->gw; x++)
+ {
+ int tn;
+
+ tn = (y * g->gw) + x;
+ evas_object_raise(g->grid[tn].img);
+ }
+ }
+}
+
+static void
+_tile_preloaded_cb(void *data,
+ Evas *e EINA_UNUSED,
+ Evas_Object *o EINA_UNUSED,
+ void *event_info EINA_UNUSED)
+{
+ Elm_Photocam_Grid_Item *git = data;
+ Elm_Phocam_Grid *g = git->grid;
+ ELM_PHOTOCAM_DATA_GET(git->obj, sd);
+ ELM_WIDGET_DATA_GET_OR_RETURN(git->obj, wd);
+ Evas_Coord ax, ay, px, py, ox, oy, ow, oh, gw, gh, tx, ty;
+ gw = sd->size.w;
+ gh = sd->size.h;
+
+ ax = 0;
+ ay = 0;
+ evas_object_geometry_get(sd->pan_obj, &ox, &oy, &ow, &oh);
+ px = sd->pan_x;
+ py = sd->pan_y;
+ ox = ox - sd->g_layer_zoom.imx;
+ oy = oy - sd->g_layer_zoom.imy;
+
+ if (!sd->zoom_g_layer)
+ {
+ if (ow > gw) ax = (ow - gw) / 2;
+ if (oh > gh) ay = (oh - gh) / 2;
+ }
+
+ if (git->want)
+ {
+ git->want = 0;
+ git->map = evas_map_new(4);
+
+ int tn = (int) evas_object_data_get(git->img, "idx");
+ int xx = git->out.x;
+ int yy = git->out.y;
+ int ww = git->out.w;
+ int hh = git->out.h;
+
+ if ((gw != g->w) && (g->w > 0))
+ {
+ tx = xx;
+ xx = (gw * xx) / g->w;
+ ww = ((gw * (tx + ww)) / g->w) - xx;
+ }
+ if ((gh != g->h) && (g->h > 0))
+ {
+ ty = yy;
+ yy = (gh * yy) / g->h;
+ hh = ((gh * (ty + hh)) / g->h) - yy;
+ }
+
+ evas_object_resize(git->img, ww, hh);
+ evas_object_move(git->img, ox + xx - px + ax, oy + yy - py + ay);
+ evas_object_show(git->img);
+
+ double degree = 0;
+ if (sd->orient == EVAS_IMAGE_ORIENT_90) degree = 90;
+ else if (sd->orient == EVAS_IMAGE_ORIENT_180) degree = 180;
+ else if (sd->orient == EVAS_IMAGE_ORIENT_270) degree = 270;
+
+ double rate = 1;
+
+ //rotated?
+ if (degree == 90 || degree == 270)
+ {
+ double temp = sd->size.h > oh ? sd->size.h : oh;
+ rate = temp / (double) sd->size.w;
+ }
+
+ evas_map_util_points_populate_from_object_full(git->map, git->img, 0);
+ evas_map_point_image_uv_set(git->map, 0, 0, 0);
+ evas_map_point_image_uv_set(git->map, 1, g->grid[tn].src.w, 0);
+ evas_map_point_image_uv_set(git->map, 2, g->grid[tn].src.w, g->grid[tn].src.h);
+ evas_map_point_image_uv_set(git->map, 3, 0, g->grid[tn].src.h);
+ evas_map_util_rotate(git->map, degree, (sd->size.w/2) + ax, (sd->size.h/2) + ay);
+ evas_map_util_zoom(git->map, rate, rate, (sd->size.w/2) + ax, (sd->size.h/2) + ay);
+ evas_object_map_set(git->img, git->map);
+ evas_object_map_enable_set(git->img, EINA_TRUE);
+
+ _grid_raise(g);
+
+ git->have = 1;
+ sd->preload_num--;
+ if (!sd->preload_num)
+ {
+ edje_object_signal_emit
+ (wd->resize_obj, "elm,state,busy,stop", "elm");
+ eo_do(wd->obj, eo_event_callback_call
+ (ELM_PHOTOCAM_EVENT_LOADED_DETAIL, NULL));
+ }
+ }
+}
+
+static Elm_Phocam_Grid *
+_grid_create(Evas_Object *obj)
+{
+ int x, y;
+ Elm_Phocam_Grid *g;
+
+ ELM_PHOTOCAM_DATA_GET(obj, sd);
+
+ g = calloc(1, sizeof(Elm_Phocam_Grid));
+ if (!g) return NULL;
+
+ g->zoom = _grid_zoom_calc(sd->zoom);
+ g->tsize = sd->tsize;
+ g->iw = sd->size.imw;
+ g->ih = sd->size.imh;
+
+ g->w = g->iw / g->zoom;
+ g->h = g->ih / g->zoom;
+
+ // TIZEN_ONLY(20150813): need to create 1x1 grid when zoom >= 8 to load high res img
+ if ((sd->do_region) && (g->zoom < 8))
+ {
+ g->gw = (g->w + g->tsize - 1) / g->tsize;
+ g->gh = (g->h + g->tsize - 1) / g->tsize;
+ }
+ else
+ {
+ g->gw = 1;
+ g->gh = 1;
+ }
+
+ g->grid = calloc(1, sizeof(Elm_Photocam_Grid_Item) * g->gw * g->gh);
+ if (!g->grid)
+ {
+ g->gw = 0;
+ g->gh = 0;
+
+ return g;
+ }
+
+ for (y = 0; y < g->gh; y++)
+ {
+ for (x = 0; x < g->gw; x++)
+ {
+ int tn;
+
+ tn = (y * g->gw) + x;
+ g->grid[tn].src.x = x * g->tsize;
+ if (x == (g->gw - 1))
+ g->grid[tn].src.w = g->w - ((g->gw - 1) * g->tsize);
+ else
+ g->grid[tn].src.w = g->tsize;
+ g->grid[tn].src.y = y * g->tsize;
+ if (y == (g->gh - 1))
+ g->grid[tn].src.h = g->h - ((g->gh - 1) * g->tsize);
+ else
+ g->grid[tn].src.h = g->tsize;
+
+ g->grid[tn].out.x = g->grid[tn].src.x;
+ g->grid[tn].out.y = g->grid[tn].src.y;
+ g->grid[tn].out.w = g->grid[tn].src.w;
+ g->grid[tn].out.h = g->grid[tn].src.h;
+
+ g->grid[tn].obj = obj;
+ g->grid[tn].grid = g;
+ g->grid[tn].img = evas_object_image_add(evas_object_evas_get(obj));
+ evas_object_image_load_orientation_set(g->grid[tn].img, EINA_TRUE);
+ evas_object_image_scale_hint_set
+ (g->grid[tn].img, EVAS_IMAGE_SCALE_HINT_DYNAMIC);
+ evas_object_pass_events_set(g->grid[tn].img, EINA_TRUE);
+
+ /* XXX: check this */
+ evas_object_smart_member_add(g->grid[tn].img, sd->pan_obj);
+ elm_widget_sub_object_add(obj, g->grid[tn].img);
+ evas_object_image_filled_set(g->grid[tn].img, 1);
+ evas_object_data_set(g->grid[tn].img, "idx", (void*) (y * g->gw + x));
+ evas_object_event_callback_add
+ (g->grid[tn].img, EVAS_CALLBACK_IMAGE_PRELOADED,
+ _tile_preloaded_cb, &(g->grid[tn]));
+ }
+ }
+
+ return g;
+}
+
static void
_grid_load(Evas_Object *obj,
Elm_Phocam_Grid *g)
gw = sd->size.w;
gh = sd->size.h;
+ if ((gw == 0) || (gh == 0)) return;
+
for (y = 0; y < g->gh; y++)
{
for (x = 0; x < g->gw; x++)
yy - sd->pan_y + oy,
ww, hh, cvx, cvy, cvw, cvh))
visible = EINA_TRUE;
+
if ((visible) && (!g->grid[tn].have) && (!g->grid[tn].want))
{
+ int sx, sy, sw, sh;
+
g->grid[tn].want = 1;
evas_object_hide(g->grid[tn].img);
evas_object_image_file_set(g->grid[tn].img, NULL, NULL);
evas_object_image_load_scale_down_set
(g->grid[tn].img, g->zoom);
+
+ sx = g->grid[tn].src.x;
+ sy = g->grid[tn].src.y;
+ sw = g->grid[tn].src.w;
+ sh = g->grid[tn].src.h;
+
evas_object_image_load_region_set
- (g->grid[tn].img, g->grid[tn].src.x, g->grid[tn].src.y,
- g->grid[tn].src.w, g->grid[tn].src.h);
+ (g->grid[tn].img, sx, sy, sw, sh);
+
_photocam_image_file_set(g->grid[tn].img, sd);
evas_object_image_preload(g->grid[tn].img, 0);
+
sd->preload_num++;
if (sd->preload_num == 1)
{
ay = 0;
gw = sd->size.w;
gh = sd->size.h;
+
if (!sd->zoom_g_layer)
{
if (ow > gw) ax = (ow - gw) / 2;
if (oh > gh) ay = (oh - gh) / 2;
}
+
for (y = 0; y < g->gh; y++)
{
for (x = 0; x < g->gw; x++)
int tn, xx, yy, ww, hh;
tn = (y * g->gw) + x;
+ if (!g->grid[tn].map) break;
+
xx = g->grid[tn].out.x;
yy = g->grid[tn].out.y;
ww = g->grid[tn].out.w;
hh = g->grid[tn].out.h;
+
if ((gw != g->w) && (g->w > 0))
{
tx = xx;
xx = (gw * xx) / g->w;
ww = ((gw * (tx + ww)) / g->w) - xx;
}
+
if ((gh != g->h) && (g->h > 0))
{
ty = yy;
yy = (gh * yy) / g->h;
hh = ((gh * (ty + hh)) / g->h) - yy;
}
- evas_object_move(g->grid[tn].img,
- ox + xx - px + ax,
- oy + yy - py + ay);
+
evas_object_resize(g->grid[tn].img, ww, hh);
+ evas_object_move(g->grid[tn].img, ox + xx - px + ax, oy + yy - py + ay);
+
+ double degree = 0;
+ if (sd->orient == EVAS_IMAGE_ORIENT_90) degree = 90;
+ else if (sd->orient == EVAS_IMAGE_ORIENT_180) degree = 180;
+ else if (sd->orient == EVAS_IMAGE_ORIENT_270) degree = 270;
+
+ double rate = 1;
+
+ //rotated?
+ if (degree == 90 || degree == 270)
+ {
+ double temp = sd->size.h > oh ? sd->size.h : oh;
+ rate = temp / (double) sd->size.w;
+ }
+
+ evas_map_util_points_populate_from_object_full(g->grid[tn].map, g->grid[tn].img, 0);
+ evas_map_point_image_uv_set(g->grid[tn].map, 0, 0, 0);
+ evas_map_point_image_uv_set(g->grid[tn].map, 1, g->grid[tn].src.w, 0);
+ evas_map_point_image_uv_set(g->grid[tn].map, 2, g->grid[tn].src.w, g->grid[tn].src.h);
+ evas_map_point_image_uv_set(g->grid[tn].map, 3, 0, g->grid[tn].src.h);
+ evas_map_util_rotate(g->grid[tn].map, degree, (sd->size.w/2) + ax, (sd->size.h/2) + ay);
+ evas_map_util_zoom(g->grid[tn].map, rate, rate, (sd->size.w/2) + ax, (sd->size.h/2) + ay);
+ evas_object_map_set(g->grid[tn].img, g->grid[tn].map);
+ evas_object_map_enable_set(g->grid[tn].img, EINA_TRUE);
+ _grid_raise(g);
+ }
+ }
+}
+
+static void
+_grid_clear(Evas_Object *obj,
+ Elm_Phocam_Grid *g)
+{
+ int x, y;
+
+ ELM_PHOTOCAM_DATA_GET(obj, sd);
+ ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
+
+ if (!g->grid) return;
+ for (y = 0; y < g->gh; y++)
+ {
+ for (x = 0; x < g->gw; x++)
+ {
+ int tn;
+
+ tn = (y * g->gw) + x;
+ evas_object_del(g->grid[tn].img);
+ if (g->grid[tn].want)
+ {
+ sd->preload_num--;
+ if (!sd->preload_num)
+ {
+ edje_object_signal_emit
+ (wd->resize_obj,
+ "elm,state,busy,stop", "elm");
+ eo_do(obj, eo_event_callback_call
+ (ELM_PHOTOCAM_EVENT_LOAD_DETAIL, NULL));
+ }
+ }
}
}
+
+ ELM_SAFE_FREE(g->grid, free);
+ g->gw = 0;
+ g->gh = 0;
+}
+
+static void
+_grid_clear_all(Evas_Object *obj)
+{
+ Elm_Phocam_Grid *g;
+
+ ELM_PHOTOCAM_DATA_GET(obj, sd);
+
+ EINA_LIST_FREE(sd->grids, g)
+ {
+ _grid_clear(obj, g);
+ free(g);
+ }
}
EOLIAN static void
_elm_photocam_pan_evas_object_smart_calculate(Eo *obj, Elm_Photocam_Pan_Data *psd)
{
+ Evas_Coord rx, ry, rw, rh;
+ eo_do(psd->wobj, elm_interface_scrollable_content_pos_get(&rx, &ry));
+ eo_do(psd->wobj, elm_interface_scrollable_content_viewport_geometry_get
+ (NULL, NULL, &rw, &rh));
+
Elm_Phocam_Grid *g;
Eina_List *l;
Evas_Coord ox, oy, ow, oh;
ox - psd->wsd->g_layer_zoom.imx, oy - psd->wsd->g_layer_zoom.imy, ow,
oh);
+ if ((psd->wsd->viewport_w != rw) || (psd->wsd->viewport_h != rh))
+ {
+ if (psd->wsd->mode != ELM_PHOTOCAM_ZOOM_MODE_MANUAL)
+ {
+ psd->wsd->viewport_w = rw;
+ psd->wsd->viewport_h = rh;
+ g = _grid_create(psd->wobj);
+ if (g)
+ {
+ _grid_clear_all(psd->wobj);
+ psd->wsd->grids = eina_list_prepend(psd->wsd->grids, g);
+ }
+ }
+ }
EINA_LIST_FOREACH(psd->wsd->grids, l, g)
{
_grid_load(wd->obj, g);
_grid_place(
- wd->obj, g, psd->wsd->pan_x,
- psd->wsd->pan_y, ox - psd->wsd->g_layer_zoom.imx,
- oy - psd->wsd->g_layer_zoom.imy, ow, oh);
+ wd->obj, g, psd->wsd->pan_x,
+ psd->wsd->pan_y, ox - psd->wsd->g_layer_zoom.imx,
+ oy - psd->wsd->g_layer_zoom.imy, ow, oh);
}
}
#include "elm_photocam_pan.eo.c"
-static int
-_nearest_pow2_get(int num)
-{
- unsigned int n = num - 1;
-
- n |= n >> 1;
- n |= n >> 2;
- n |= n >> 4;
- n |= n >> 8;
- n |= n >> 16;
-
- return n + 1;
-}
-
-static void
-_grid_clear(Evas_Object *obj,
- Elm_Phocam_Grid *g)
-{
- int x, y;
-
- ELM_PHOTOCAM_DATA_GET(obj, sd);
- ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
-
- if (!g->grid) return;
- for (y = 0; y < g->gh; y++)
- {
- for (x = 0; x < g->gw; x++)
- {
- int tn;
-
- tn = (y * g->gw) + x;
- evas_object_del(g->grid[tn].img);
- if (g->grid[tn].want)
- {
- sd->preload_num--;
- if (!sd->preload_num)
- {
- edje_object_signal_emit
- (wd->resize_obj,
- "elm,state,busy,stop", "elm");
- eo_do(obj, eo_event_callback_call
- (ELM_PHOTOCAM_EVENT_LOAD_DETAIL, NULL));
- }
- }
- }
- }
-
- ELM_SAFE_FREE(g->grid, free);
- g->gw = 0;
- g->gh = 0;
-}
-
-static void
-_tile_preloaded_cb(void *data,
- Evas *e EINA_UNUSED,
- Evas_Object *o EINA_UNUSED,
- void *event_info EINA_UNUSED)
-{
- Elm_Photocam_Grid_Item *git = data;
- ELM_PHOTOCAM_DATA_GET(git->obj, sd);
- ELM_WIDGET_DATA_GET_OR_RETURN(git->obj, wd);
-
- if (git->want)
- {
- git->want = 0;
- evas_object_show(git->img);
- git->have = 1;
- sd->preload_num--;
- if (!sd->preload_num)
- {
- edje_object_signal_emit
- (wd->resize_obj, "elm,state,busy,stop",
- "elm");
- eo_do(wd->obj, eo_event_callback_call
- (ELM_PHOTOCAM_EVENT_LOADED_DETAIL, NULL));
- }
- }
-}
-
-static int
-_grid_zoom_calc(double zoom)
-{
- int z = zoom;
-
- if (z < 1) z = 1;
- if (z > 8) z = 8; // TIZEN_ONLY(20150813): need to create 1x1 grid when zoom >= 8 to load high res img
- return _nearest_pow2_get(z);
-}
-
-static Elm_Phocam_Grid *
-_grid_create(Evas_Object *obj)
-{
- int x, y;
- Elm_Phocam_Grid *g;
-
- ELM_PHOTOCAM_DATA_GET(obj, sd);
-
- g = calloc(1, sizeof(Elm_Phocam_Grid));
- if (!g) return NULL;
-
- g->zoom = _grid_zoom_calc(sd->zoom);
- g->tsize = sd->tsize;
- g->iw = sd->size.imw;
- g->ih = sd->size.imh;
-
- g->w = g->iw / g->zoom;
- g->h = g->ih / g->zoom;
-
- // TIZEN_ONLY(20150813): need to create 1x1 grid when zoom >= 8 to load high res img
- if ((sd->do_region) && (g->zoom < 8))
- {
- g->gw = (g->w + g->tsize - 1) / g->tsize;
- g->gh = (g->h + g->tsize - 1) / g->tsize;
- }
- else
- {
- g->gw = 1;
- g->gh = 1;
- }
-
- g->grid = calloc(1, sizeof(Elm_Photocam_Grid_Item) * g->gw * g->gh);
- if (!g->grid)
- {
- g->gw = 0;
- g->gh = 0;
-
- return g;
- }
-
- for (y = 0; y < g->gh; y++)
- {
- for (x = 0; x < g->gw; x++)
- {
- int tn;
-
- tn = (y * g->gw) + x;
- g->grid[tn].src.x = x * g->tsize;
- if (x == (g->gw - 1))
- g->grid[tn].src.w = g->w - ((g->gw - 1) * g->tsize);
- else
- g->grid[tn].src.w = g->tsize;
- g->grid[tn].src.y = y * g->tsize;
- if (y == (g->gh - 1))
- g->grid[tn].src.h = g->h - ((g->gh - 1) * g->tsize);
- else
- g->grid[tn].src.h = g->tsize;
-
- g->grid[tn].out.x = g->grid[tn].src.x;
- g->grid[tn].out.y = g->grid[tn].src.y;
- g->grid[tn].out.w = g->grid[tn].src.w;
- g->grid[tn].out.h = g->grid[tn].src.h;
-
- g->grid[tn].obj = obj;
- g->grid[tn].img =
- evas_object_image_add(evas_object_evas_get(obj));
- evas_object_image_load_orientation_set(g->grid[tn].img, EINA_TRUE);
- evas_object_image_orient_set(g->grid[tn].img, sd->orient);
- evas_object_image_scale_hint_set
- (g->grid[tn].img, EVAS_IMAGE_SCALE_HINT_DYNAMIC);
- evas_object_pass_events_set(g->grid[tn].img, EINA_TRUE);
-
- /* XXX: check this */
- evas_object_smart_member_add(g->grid[tn].img, sd->pan_obj);
- elm_widget_sub_object_add(obj, g->grid[tn].img);
- evas_object_image_filled_set(g->grid[tn].img, 1);
- evas_object_event_callback_add
- (g->grid[tn].img, EVAS_CALLBACK_IMAGE_PRELOADED,
- _tile_preloaded_cb, &(g->grid[tn]));
- }
- }
-
- return g;
-}
-
-static void
-_grid_clear_all(Evas_Object *obj)
-{
- Elm_Phocam_Grid *g;
-
- ELM_PHOTOCAM_DATA_GET(obj, sd);
-
- EINA_LIST_FREE(sd->grids, g)
- {
- _grid_clear(obj, g);
- free(g);
- }
-}
-
static void
_smooth_update(Evas_Object *obj)
{
evas_object_image_smooth_scale_set(sd->img, (!sd->no_smooth));
}
-static void
-_grid_raise(Elm_Phocam_Grid *g)
-{
- int x, y;
-
- for (y = 0; y < g->gh; y++)
- {
- for (x = 0; x < g->gw; x++)
- {
- int tn;
-
- tn = (y * g->gw) + x;
- evas_object_raise(g->grid[tn].img);
- }
- }
-}
-
static Eina_Bool
_scroll_timeout_cb(void *data)
{
ELM_PHOTOCAM_DATA_GET(data, sd);
ELM_WIDGET_DATA_GET_OR_RETURN(data, wd);
+ sd->loaded = EINA_TRUE;
evas_object_show(sd->img);
+
+ sd->map = evas_map_new(4);
+
sd->main_load_pending = 0;
g = _grid_create(obj);
if (g)
{
+ _grid_clear_all(obj);
sd->grids = eina_list_prepend(sd->grids, g);
_grid_load(obj, g);
}
return EVAS_EVENT_FLAG_NONE;
}
-static void
-_orient_do(Evas_Object *obj, Elm_Photocam_Data *sd)
-{
- evas_object_smart_member_del(sd->img);
- elm_widget_sub_object_del(obj, sd->img);
- evas_object_smart_member_add(sd->img, sd->pan_obj);
- elm_widget_sub_object_add(obj, sd->img);
- ecore_job_del(sd->calc_job);
- sd->calc_job = ecore_job_add(_calc_job_cb, obj);
-}
-
EOLIAN static void
_elm_photocam_image_orient_set(Eo *obj, Elm_Photocam_Data *sd, Evas_Image_Orient orient)
{
- int iw, ih;
- Eina_List *l;
- Elm_Phocam_Grid *g, *g_orient = NULL;
-
if (sd->orient == orient) return;
sd->orientation_changed = EINA_TRUE;
sd->orient = orient;
- g = _grid_create(obj);
- if (g)
- {
- if (eina_list_count(sd->grids) > 1)
- {
- g_orient = eina_list_last(sd->grids)->data;
- sd->grids = eina_list_remove(sd->grids, g_orient);
- _grid_clear(obj, g_orient);
- free(g_orient);
- EINA_LIST_FOREACH(sd->grids, l, g_orient)
- {
- g_orient->dead = 1;
- }
- }
- sd->grids = eina_list_prepend(sd->grids, g);
- }
- else
+
+ if (sd->loaded)
{
- EINA_LIST_FREE(sd->grids, g)
+ _grid_clear_all(obj);
+ Evas_Coord ox, oy, ow, oh;
+
+ ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
+
+ evas_object_geometry_get(obj, &ox, &oy, &ow, &oh);
+ _image_place(
+ obj, sd->pan_x, sd->pan_y,
+ ox - sd->g_layer_zoom.imx, oy - sd->g_layer_zoom.imy, ow, oh);
+
+ Elm_Phocam_Grid *g = _grid_create(obj);
+ if (g)
{
- _grid_clear(obj, g);
- free(g);
+ _grid_clear_all(obj);
+ sd->grids = eina_list_prepend(sd->grids, g);
+ _grid_load(obj, g);
}
+ ecore_job_del(sd->calc_job);
+ sd->calc_job = ecore_job_add(_calc_job_cb, obj);
}
-
- evas_object_image_orient_set(sd->img, orient);
- evas_object_image_size_get(sd->img, &iw, &ih);
- sd->size.imw = iw;
- sd->size.imh = ih;
- sd->size.w = iw / sd->zoom;
- sd->size.h = ih / sd->zoom;
- _orient_do(obj, sd);
}
EOLIAN static Evas_Image_Orient
/* XXX: mmm... */
evas_object_smart_member_add(priv->img, priv->pan_obj);
+ priv->loaded = EINA_FALSE;
elm_widget_sub_object_add(obj, priv->img);
evas_object_image_filled_set(priv->img, EINA_TRUE);
evas_object_event_callback_add
EOLIAN static void
_elm_photocam_zoom_set(Eo *obj, Elm_Photocam_Data *sd, double zoom)
{
- double z;
Eina_List *l;
Ecore_Animator *an;
- Elm_Phocam_Grid *g, *g_zoom = NULL;
+ Elm_Phocam_Grid *g;
Evas_Coord rx, ry, rw, rh; // TIZEN_ONLY(20150813): make as a function for reusability
int zoom_changed = 0, started = 0;
if ((rw <= 0) || (rh <= 0)) return;
// TIZEN_ONLY(20150813): make as a function for reusability
- z = sd->zoom;
_image_size_calc(obj, sd);
sd->size.w = sd->size.nw;
g = _grid_create(obj);
if (g)
{
- if (eina_list_count(sd->grids) > 1)
- {
- g_zoom = eina_list_last(sd->grids)->data;
- sd->grids = eina_list_remove(sd->grids, g_zoom);
- _grid_clear(obj, g_zoom);
- free(g_zoom);
- EINA_LIST_FOREACH(sd->grids, l, g_zoom)
- {
- g_zoom->dead = 1;
- }
- }
+ _grid_clear_all(obj);
sd->grids = eina_list_prepend(sd->grids, g);
}
else