<option id="gnu.c.compiler.option.preprocessor.def.symbols.1168419395" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" valueType="definedSymbols">
<listOptionValue builtIn="false" value="_USE_DLOG_"/>
<listOptionValue builtIn="false" value="_USE_SECURE_LOG_"/>
- <listOptionValue builtIn="false" value="_USE_ROTATE_BG"/>
<listOptionValue builtIn="false" value="_USE_OPENGL_BACKEND"/>
<listOptionValue builtIn="false" value="_USE_GRID_CHECK"/>
</option>
ADD_DEFINITIONS("-D_USE_DLOG_")
ADD_DEFINITIONS("-D_USE_SECURE_LOG_")
-ADD_DEFINITIONS("-D_USE_ROTATE_BG")
ADD_DEFINITIONS("-D_USE_OPENGL_BACKEND")
ADD_DEFINITIONS("-D_USE_GRID_CHECK")
#include "gallery.h"
int _gl_thumbs_sel_create_view(void *data, gl_cluster *album_item);
-int _gl_thumbs_sel_update_view(void *data);
int _gl_thumbs_sel_pop_view(void *data, bool b_pop);
int _gl_thumbs_sel_update_lang(void *data);
int _gl_thumbs_sel_disable_btns(void *data, bool b_disabled);
/* Button object style of previous button of naviframe */
#define GL_BUTTON_STYLE_NAVI_PRE "naviframe/back_btn/default"
-#ifdef _USE_ROTATE_BG
-#define GL_BUTTON_STYLE_NAVI_CTRL "naviframe_control/multiline"
-#endif
#define GL_CHECKBOX_STYLE_DEFAULT "gallery/default"
#define GL_GENLIST_STYLE_DEFAULT GL_CHECKBOX_STYLE_DEFAULT
Eina_List *elist; /* List of all selected medias of a album/tag/marker */
Eina_List *fav_elist; /* List of fav medias of a album/tag/marker */
int images_cnt; /* Images count selected */
- int jpeg_cnt; /* JEPG files count selected */
int disable_hide_cnt; /* Disable hide files count selected */
/* All media count */
int sel_cnt;
+++ /dev/null
-/*
-* Copyright (c) 2000-2015 Samsung Electronics Co., Ltd All Rights Reserved
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*
-*/
-
-#ifdef _USE_ROTATE_BG
-
-#ifndef _GL_EXIF_H_
-#define _GL_EXIF_H_
-
-#include <stdbool.h>
-#include <stdio.h>
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-/*
-Orientation - angle
-1 - 0
-3 - 180
-6 - 90
-8 - 270
-*/
-
-enum _gl_orientation_rot_t {
- GL_ORIENTATION_ROT_ERR = 0,
- GL_ORIENTATION_ROT_0 = 1,
- GL_ORIENTATION_ROT_180 = 3,
- GL_ORIENTATION_ROT_90 = 6,
- GL_ORIENTATION_ROT_270 = 8,
-};
-typedef enum _gl_orientation_rot_t gl_orientation_rot_e;
-
-bool _gl_exif_check_img_type(char *file_path);
-int _gl_exif_get_orientation(char *file_path, unsigned int *orientation);
-int _gl_exif_set_orientation(char *file_path, unsigned int orientation);
-int _gl_exif_get_rotated_orientation(unsigned int orientation, bool b_left);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _GL_EXIF_H_ */
-
-#endif
-
int _gl_ui_rm_selall_btn(Elm_Object_Item *nf_it);
int _gl_ui_add_selall_btn(Evas_Object *naviframe, Elm_Object_Item *nf_it,
Evas_Smart_Cb cb_func, void *data);
-#if 0
-int _gl_ui_add_xpt_btns(Elm_Object_Item *nf_it, gl_ui_xpt_btn_e xpt_btn,
- Evas_Smart_Cb r_cb, Evas_Smart_Cb l_cb, void *data);
-Evas_Object *_gl_ui_get_xpt_btn(Elm_Object_Item *nf_it, gl_ui_xpt_btn_e ui_btn);
-int _gl_ui_disable_xpt_btn(Elm_Object_Item *nf_it, gl_ui_xpt_btn_e ui_btn, bool b_disabled);
-int _gl_ui_clear_xpt_btns(Elm_Object_Item *nf_it);
-#endif
int _gl_ui_clear_btns(void *data);
int _gl_ui_hide_back_button(Elm_Object_Item *nf_it);
gl_icon_type_e _gl_ui_elm_bg_file_set(Evas_Object *bg, gl_item *git);
GL_MEDIA_OP_DELETE,
/*Delete albums*/
GL_MEDIA_OP_DELETE_ALBUM,
-#ifdef _USE_ROTATE_BG
- GL_MEDIA_OP_ROTATING_LEFT,
- GL_MEDIA_OP_ROTATING_RIGHT,
-#endif
GL_MEDIA_OP_MOVE_TIMELINE,
GL_MEDIA_OP_COPY_TIMELINE,
GL_MEDIA_OP_DELETE_TIMELINE,
-#ifdef _USE_ROTATE_BG
- GL_MEDIA_OP_ROTATING_LEFT_TIMELINE,
- GL_MEDIA_OP_ROTATING_RIGHT_TIMELINE,
-#endif
} gl_media_op_mode;
typedef enum
GL_POPUP_OP_PROTECTED_FILE,
} gl_popup_op_mode;
-typedef enum
-{
- GL_SHARE_NONE,
- GL_SHARE_IMAGE_ONE, /* One image selection */
- GL_SHARE_IMAGE_ONE_JPEG, /* One jpeg image selection */
- GL_SHARE_IMAGE_MULTI, /* Multiple images selection */
- GL_SHARE_IMAGE_MULTI_JPEG, /* Multiple jpeg images selection */
- GL_SHARE_IMAGE_VIDEO, /* Image(s) and Video(s) selection */
- GL_SHARE_VIDEO_ONE, /* One video selection */
- GL_SHARE_VIDEO_MULTI, /* Multiple videos selection */
-} gl_share_mode;
-
typedef enum
{
GL_INVALID_NONE,
bool gl_make_new_album(const char *name);
bool gl_check_gallery_empty(void* data);
bool gl_is_image_valid(void *data, char *filepath);
-#ifdef _USE_ROTATE_BG
-int _gl_delay(double sec);
-int _gl_rotate_images(void *data, bool b_left);
-int _gl_rotate_image_by_id(void *data, const char *uuid, bool b_left);
-#endif
int gl_get_entry_text(Evas_Object * entry, char *entry_text, int len_max);
int gl_set_entry_text(Evas_Object *entry, char *entry_text);
int _gl_get_valid_album_name(void *data, char* album_name, bool b_new,
int _gl_validate_album_name(void *data, char* album_name);
int _gl_validate_input_character(void *data, char* album_name);
char* _gl_get_i18n_album_name(gl_album_s *cluster);
-int gl_get_share_mode(void *data);
int gl_del_invalid_widgets(void *data, int invalid_m);
int gl_pop_to_ctrlbar_ly(void *data);
int gl_play_vibration(void *data);
* limitations under the License.
*
*/
-#ifdef _USE_ROTATE_BG
#ifndef _GL_ROTATE_BG_H_
#define _GL_ROTATE_BG_H_
#include "gallery.h"
Evas_Object *_gl_rotate_bg_add(Evas_Object *parent, bool b_preload);
-int _gl_rotate_bg_set_data(Evas_Object *bg, void *data);
-int _gl_rotate_bg_get_data(Evas_Object *bg, void **data);
int _gl_rotate_bg_set_file(Evas_Object *bg, const char *file, int w, int h);
-int _gl_rotate_bg_get_file(Evas_Object *bg, char **file);
int _gl_rotate_bg_rotate_image(Evas_Object *bg, unsigned int orient);
int _gl_rotate_bg_add_image(Evas_Object *bg, int w, int h);
int _gl_rotate_bg_set_image_file(Evas_Object *bg, const char *file);
#endif
-
-#endif
profile = mobile-3.0
# C Sources
-USER_SRCS = src/util/gl-fs.c src/features/gl-albums.c src/data/gl-data-util.c src/2dview/gl-albums-rename.c src/util/gl-ext-ug-load.c src/util/gl-exif.c src/features/gl-thumbs-sel.c src/data/gl-local-data.c src/features/gl-entry.c src/widget/gl-gesture.c src/widget/gl-tile.c src/widget/gl-rotate-bg.c src/util/gl-lang.c src/widget/gl-ctxpopup.c src/util/gl-db-update.c src/features/gl-main.c src/util/gl-thread-util.c src/widget/gl-editfield.c src/widget/gl-controlbar.c src/widget/gl-notify.c src/gallery.c src/util/gl-file-util.c src/util/gl-debug.c src/2dview/gl-timeline.c src/widget/gl-button.c src/util/gl-ta.c src/2dview/gl-albums-new.c src/2dview/gl-albums-edit.c src/widget/gl-nocontents.c src/data/gl-data-type.c src/widget/gl-progressbar.c src/widget/gl-thumb.c src/widget/gl-popup.c src/features/gl-pinchzoom.c src/features/gl-albums-sel.c src/data/gl-data.c src/features/gl-thumbs-edit.c src/util/gl-ui-util.c src/util/gl-util.c src/features/gl-thumbs.c
+USER_SRCS = src/util/gl-fs.c src/features/gl-albums.c src/data/gl-data-util.c src/2dview/gl-albums-rename.c src/util/gl-ext-ug-load.c src/features/gl-thumbs-sel.c src/data/gl-local-data.c src/features/gl-entry.c src/widget/gl-gesture.c src/widget/gl-tile.c src/widget/gl-rotate-bg.c src/util/gl-lang.c src/widget/gl-ctxpopup.c src/util/gl-db-update.c src/features/gl-main.c src/util/gl-thread-util.c src/widget/gl-editfield.c src/widget/gl-controlbar.c src/widget/gl-notify.c src/gallery.c src/util/gl-file-util.c src/util/gl-debug.c src/2dview/gl-timeline.c src/widget/gl-button.c src/util/gl-ta.c src/2dview/gl-albums-new.c src/2dview/gl-albums-edit.c src/widget/gl-nocontents.c src/data/gl-data-type.c src/widget/gl-progressbar.c src/widget/gl-thumb.c src/widget/gl-popup.c src/features/gl-pinchzoom.c src/features/gl-albums-sel.c src/data/gl-data.c src/features/gl-thumbs-edit.c src/util/gl-ui-util.c src/util/gl-util.c src/features/gl-thumbs.c
USER_SRCS_ABS =
# EDC Sources
USER_POS = res/po/es_ES.po res/po/lv.po res/po/hy.po res/po/gl.po res/po/ga.po res/po/es_US.po res/po/zh_HK.po res/po/zh_TW.po res/po/et.po res/po/de.po res/po/ru_RU.po res/po/nb.po res/po/lt.po res/po/it_IT.po res/po/el_GR.po res/po/uz.po res/po/pt_BR.po res/po/nl.po res/po/fr.po res/po/ca.po res/po/kk.po res/po/eu.po res/po/tr_TR.po res/po/pt_PT.po res/po/hr.po res/po/is.po res/po/hu.po res/po/ko_KR.po res/po/mk.po res/po/bg.po res/po/fr_CA.po res/po/en_US.po res/po/en.po res/po/da.po res/po/pl.po res/po/cs.po res/po/az.po res/po/ja_JP.po res/po/sv.po res/po/sk.po res/po/ro.po res/po/sl.po res/po/uk.po res/po/sr.po res/po/zh_CN.po res/po/ka.po res/po/ar.po res/po/fi.po res/po/en_PH.po
# User Defines
-USER_DEFS = _USE_DLOG_ _USE_SECURE_LOG_ _USE_ROTATE_BG _USE_OPENGL_BACKEND _USE_GRID_CHECK
+USER_DEFS = _USE_DLOG_ _USE_SECURE_LOG_ _USE_OPENGL_BACKEND _USE_GRID_CHECK
USER_CPP_DEFS =
# User Undefines
__gl_albums_edit_update_check_state(ad, album_item, obj, false);
}
-#if 0
-static void __gl_albums_edit_rename(gl_cluster *album)
-{
- GL_CHECK(album);
- GL_CHECK(album->ad);
- gl_appdata *ad = (gl_appdata *)album->ad;
- /* save album selected for rename */
- if (_gl_albums_rename_create_view(album->ad, album) == 0) {
- ad->albuminfo.selected = album;
- }
-}
-
-static void __gl_albums_edit_rename_btn_cb(void *data, Evas_Object *obj,
- void *event_info)
-{
- gl_dbg("");
- GL_CHECK(data);
- gl_cluster *album_item = (gl_cluster *)data;
- gl_appdata *ad = (gl_appdata *)album_item->ad;
- _gl_ctxpopup_del(ad);
- /* Save scroller position before clearing gengrid */
- _gl_ui_save_scroller_pos(ad->albuminfo.view);
- __gl_albums_edit_rename(album_item);
-}
-#endif
-
static void __gl_albums_edit_del_cb(void *data, Evas_Object *obj,
void *ei)
{
_gl_ui_update_navi_title_text(ad->ctrlinfo.nf_it, sel_all_cnt, false);
}
-#if 0
-static int __gl_albums_edit_ctxpopup_append(void *data, Evas_Object *parent)
-{
- gl_dbg("");
- GL_CHECK_VAL(parent, -1);
- GL_CHECK_VAL(data, -1);
- gl_appdata *ad = (gl_appdata *)data;
- GL_CHECK_VAL(ad->albuminfo.sel_elist, -1);
- gl_cluster *album_item = NULL;
- album_item = (gl_cluster *)eina_list_nth(ad->albuminfo.sel_elist, 0);
- GL_CHECK_VAL(album_item, -1);
-
- /* Rename */
- _gl_ctxpopup_append(parent, GL_STR_ID_RENAME,
- __gl_albums_edit_rename_btn_cb, album_item);
- return 0;
-}
-
-static void __gl_albums_edit_more_btn_cb(void *data, Evas_Object *obj, void *ei)
-{
- gl_dbgE("more button clicked");
- GL_CHECK(data);
- gl_appdata *ad = (gl_appdata *)data;
-
- if (GL_GRID_EDIT != ad->albuminfo.b_share_mode) {
- return;
- }
- GL_CHECK(ad->albuminfo.sel_elist);
- gl_cluster *album_item = NULL;
- album_item = (gl_cluster *)eina_list_nth(ad->albuminfo.sel_elist, 0);
- GL_CHECK(album_item);
- if (1 != _gl_data_get_albums_selected_cnt(ad) ||
- album_item->cluster->type > GL_STORE_T_MMC ||
- _gl_data_is_camera_album(album_item->cluster)) {
- return;
- }
- _gl_ctxpopup_create(data, obj, __gl_albums_edit_ctxpopup_append);
-}
-#endif
-
Evas_Object *_gl_albums_edit_add_content(void *data, Evas_Object *obj,
const char *part)
{
#include "gl-util.h"
#include "gl-data.h"
#include "gl-strings.h"
-#ifdef _USE_ROTATE_BG
#include "gl-rotate-bg.h"
-#include "gl-exif.h"
-#endif
#include "gl-thumb.h"
#include "gl-thumbs.h"
#include "gl-main.h"
typedef struct _gl_sel_data_t gl_sel_s;
struct _gl_sel_data_t {
Eina_List *sel_list; /* List about image selected */
- int jpge_cnt;
int image_cnt;
};
if (b_append) {
if (item->type == MEDIA_CONTENT_TYPE_IMAGE) {
timeline_d->sel_d->image_cnt++;
- if (item->ext != NULL &&
- !strcasecmp(item->ext, GL_JPEG_FILE_EXT) &&
- _gl_exif_check_img_type(item->file_url)) {
- timeline_d->sel_d->jpge_cnt++;
- }
}
} else {
if (item->type == MEDIA_CONTENT_TYPE_IMAGE) {
} else {
gl_dbgW("Image count is 0!");
}
- if (item->ext != NULL &&
- !strcasecmp(item->ext, GL_JPEG_FILE_EXT) &&
- _gl_exif_check_img_type(item->file_url)) {
- if (timeline_d->sel_d->jpge_cnt > 0) {
- timeline_d->sel_d->jpge_cnt--;
- } else {
- gl_dbgW("JPG count is 0!");
- }
- }
}
}
return true;
#include "gl-util.h"
#include "gl-strings.h"
#include "gl-icons.h"
-#include "gl-exif.h"
#include "gl-db-update.h"
#include "gl-file-util.h"
#include "gl-data-util.h"
ad->albuminfo.elist->phone_cnt = phone_cnt;
ad->albuminfo.elist->edit_cnt = edit_album_cnt;
-#if 0
- /**
- * add "all" album, only inclduing local albums temporarily,
- * web album would be contained in the future .
- */
- if (all_item_cnt) {
- _gl_db_update_set_count(ad, all_item_cnt);
- /* Create "All albums" album if any local file exists */
- gcluster = _gl_data_util_new_gcluster_all(ad, all_item_cnt);
- if (gcluster == NULL) {
- gl_dbgE("_gl_data_util_new_gcluster_all failed!");
- _gl_data_clear_cluster_list(ad, false);
- return -1;
- }
- if (b_selected) {
- b_selected = false;
- /* Set checkbox state */
- gcluster->checked = true;
- /* Append gcluster to selected list */
- _gl_data_albums_selected_list_append(ad, gcluster);
- }
-
- if (default_album)
- ad->albuminfo.elist->clist = eina_list_append_relative(ad->albuminfo.elist->clist,
- gcluster,
- default_album);
- else
- ad->albuminfo.elist->clist = eina_list_prepend(ad->albuminfo.elist->clist,
- gcluster);
- default_album = gcluster;
-
- /* Save all count */
- ad->maininfo.all_medias_cnt = all_item_cnt;
- }
-#endif
-
/* add "favourite" album */
int fav_count = 0;
err = _gl_get_fav_image_count(&fav_count);
if (!g_strcmp0(burstshot_id, cur_gitem->item->image_info->burstshot_id)) {
cur_gitem->checked = gitem->checked;
ad->selinfo.images_cnt++;
-#ifdef _USE_ROTATE_BG
- if (cur_gitem->item->ext &&
- !strcasecmp(cur_gitem->item->ext, GL_JPEG_FILE_EXT))
- if (_gl_exif_check_img_type(cur_gitem->item->file_url)) {
- ad->selinfo.jpeg_cnt++;
- }
-#endif
if (gitem->item->storage_type != GL_STORE_T_PHONE) {
++ad->selinfo.disable_hide_cnt;
}
/* Update selected images count */
if (gitem->item->type == MEDIA_CONTENT_TYPE_IMAGE) {
ad->selinfo.images_cnt++;
-#ifdef _USE_ROTATE_BG
- gl_dbg("Ext: %s", gitem->item->ext);
- if (gitem->item->ext &&
- !strcasecmp(gitem->item->ext, GL_JPEG_FILE_EXT)) {
- if (_gl_exif_check_img_type(gitem->item->file_url)) {
- ad->selinfo.jpeg_cnt++;
- }
- }
-#endif
}
if (gitem->item->storage_type != GL_STORE_T_PHONE) {
++ad->selinfo.disable_hide_cnt;
if (current->item->type == MEDIA_CONTENT_TYPE_IMAGE &&
ad->selinfo.images_cnt > 0) {
ad->selinfo.images_cnt--;
-#ifdef _USE_ROTATE_BG
- if (current->item->ext &&
- !strcasecmp(current->item->ext, GL_JPEG_FILE_EXT) &&
- ad->selinfo.jpeg_cnt > 0)
- if (_gl_exif_check_img_type(current->item->file_url)) {
- ad->selinfo.jpeg_cnt--;
- }
-#endif
}
ad->selinfo.elist = eina_list_remove(ad->selinfo.elist,
if (gitem->item->type == MEDIA_CONTENT_TYPE_IMAGE &&
ad->selinfo.images_cnt > 0) {
ad->selinfo.images_cnt--;
-#ifdef _USE_ROTATE_BG
- if (gitem->item->ext &&
- !strcasecmp(gitem->item->ext, GL_JPEG_FILE_EXT) &&
- ad->selinfo.jpeg_cnt > 0) {
- if (_gl_exif_check_img_type(gitem->item->file_url)) {
- ad->selinfo.jpeg_cnt--;
- }
- }
-#endif
}
if (gitem->item->storage_type != GL_STORE_T_PHONE) {
ad->selinfo.disable_hide_cnt--;
ad->selinfo.elist = NULL;
ad->selinfo.images_cnt = 0;
ad->selinfo.disable_hide_cnt = 0;
-#ifdef _USE_ROTATE_BG
- ad->selinfo.jpeg_cnt = 0;
-#endif
gl_dbg("Selected list freed");
return 0;
}
ad->selinfo.elist = NULL;
ad->selinfo.images_cnt = 0;
ad->selinfo.disable_hide_cnt = 0;
-#ifdef _USE_ROTATE_BG
- ad->selinfo.jpeg_cnt = 0;
-#endif
return 0;
}
/* Reset old flags */
ad->selinfo.images_cnt = 0;
ad->selinfo.disable_hide_cnt = 0;
-#ifdef _USE_ROTATE_BG
- ad->selinfo.jpeg_cnt = 0;
-#endif
return 0;
}
#include "gl-nocontents.h"
#include "gl-notify.h"
#include "gl-ext-ug-load.h"
-#ifdef _USE_ROTATE_BG
#include "gl-rotate-bg.h"
-#include "gl-exif.h"
-#endif
#include "gl-gesture.h"
#include "gl-file-util.h"
gl_dbg("realized");
}
-#if 0
-static void __gl_albums_lang_changed(void *data, Evas_Object *obj, void *ei)
-{
- GL_CHECK(data);
- gl_appdata *ad = (gl_appdata *)data;
- gl_albums_update_items(ad);
-}
-#endif
-
void __gl_albums_new_album_sel(void *data, Evas_Object *obj, void *ei)
{
GL_CHECK(data);
GL_ALBUMS_FAILED:
-#ifdef _USE_ROTATE_BG
_gl_rotate_bg_set_image_file(bg, bg_path);
-#else
- elm_bg_file_set(bg, bg_path, NULL);
-#endif
return ret_val;
}
gl_cluster *album = elm_object_item_data_get(it);
GL_CHECK(album);
_gl_albums_set_current(data, album);
-#if 0
- _gl_data_finalize_albums_selected_list(data);
- _gl_data_albums_selected_list_append(data, album);
-#endif
}
/* Free data after layout deleted */
data);
evas_object_smart_callback_add(grid, "unrealized",
__gl_albums_unrealized, data);
-#if 0
- evas_object_smart_callback_add(grid, "language,changed",
- __gl_albums_lang_changed, data);
-#endif
evas_object_smart_callback_add(grid, "longpressed",
__gl_albums_longpressed_cb, data);
evas_object_show(grid);
void *ad;
};
-#if 0
-/* Free data after layout deleted */
-static void __gl_entry_layout_del_cb(void *data, Evas *e, Evas_Object *obj,
- void *ei)
-{
- gl_dbg("Delete entry layout ---");
- GL_FREEIF(data);
- gl_dbg("Delete entry layout +++");
-}
-
-static Eina_Bool __gl_entry_pop_cb(void *data, Elm_Object_Item *it)
-{
- GL_CHECK_FALSE(data);
- gl_entry_s *entry_d = (gl_entry_s *)data;
- GL_CHECK_FALSE(entry_d->ad);
- gl_dbg("");
-
- /* Call cancel callback */
- Evas_Object *entry = _gl_editfield_get_entry(entry_d->ad);
- GL_CHECK_FALSE(entry);
- Eina_Bool(*pop_cb)(void * data, Elm_Object_Item * it);
- pop_cb = evas_object_data_get(entry, "gl_entry_pop_cb_key");
- /* Clear editfield variables */
- _gl_editfield_destroy_imf(entry_d->ad);
- if (pop_cb) {
- return pop_cb(entry_d->ad, it);
- } else {
- return EINA_TRUE;
- }
-}
-#endif
-
static void __gl_entry_done_cb(void *data, Evas_Object *obj, void *ei)
{
GL_CHECK(data);
GL_FREEIF(ad->albuminfo.temp_album_name);
}
-#if 0
-static void __gl_entry_trans_finished_cb(void *data, Evas_Object *obj, void *ei)
-{
- evas_object_smart_callback_del(obj, GL_TRANS_FINISHED,
- __gl_entry_trans_finished_cb);
- GL_CHECK(data);
- gl_dbg("");
-
- Evas_Object *entry = _gl_editfield_get_entry(data);
- GL_CHECK(entry);
-
- int (*transit_cb)(void * data);
- transit_cb = evas_object_data_get(entry, "gl_entry_transit_cb_key");
- if (transit_cb) {
- transit_cb(data);
- }
-
-}
-#endif
/**
* Use naviframe api to push albums rename view to stack.
} else {
ad->maininfo.rotate_mode = changed_ang;
}
-#if 0
- enum ug_event evt = UG_EVENT_NONE;
- /* Send event to UG */
- switch (changed_ang) {
- case APP_DEVICE_ORIENTATION_0:
- evt = UG_EVENT_ROTATE_PORTRAIT;
- break;
- case APP_DEVICE_ORIENTATION_90:
- evt = UG_EVENT_ROTATE_LANDSCAPE_UPSIDEDOWN;
- break;
- case APP_DEVICE_ORIENTATION_180:
- evt = UG_EVENT_ROTATE_PORTRAIT_UPSIDEDOWN;
- break;
- case APP_DEVICE_ORIENTATION_270:
- evt = UG_EVENT_ROTATE_LANDSCAPE;
- break;
- }
- ug_send_event(evt);
-#endif
int view_mode = gl_get_view_mode(ad);
_gl_ui_rotate_view(data, view_mode);
_gl_timeline_rotate_view(data);
#include "gl-notify.h"
#include "gl-strings.h"
-#if 0
-static void __gl_thumbs_sel_trans_finished_cb(void *data, Evas_Object *obj,
- void *event_info)
-{
- GL_CHECK(data);
- gl_appdata *ad = (gl_appdata *)data;
- int view_mode = gl_get_view_mode(ad);
- gl_dbgW("view_mode: %d", view_mode);
- evas_object_smart_callback_del(obj, GL_TRANS_FINISHED,
- __gl_thumbs_sel_trans_finished_cb);
-
- /* Clear previous view after animation finished */
- if (view_mode == GL_VIEW_THUMBS_SELECT) {
- elm_gengrid_clear(ad->albuminfo.select_view);
- } else {
- gl_dbgE("Wrong view mode!");
- }
-
- if (ad->gridinfo.is_append) {
- _gl_thumbs_append_items(data);
- ad->gridinfo.is_append = false;
- }
-}
-
-static Eina_Bool __gl_thumbs_sel_pop_cb(void *data, Elm_Object_Item *it)
-{
- GL_CHECK_FALSE(data);
- gl_appdata *ad = (gl_appdata *)data;
- gl_dbg("");
- ad->gridinfo.is_append = false;
-
- /* If the back button is clicked or H/W Back key is pressed,
- this callback will be called right before the
- current view pop. User may implement application logic here. */
-
- /* To proceed the popping, please return the EINA_TRUE or not,
- popping will be canceled.
- If it needs to delete the current view without any transition effect,
- then call the elm_object_item_del() here and then return the EINA_FALSE */
- _gl_thumbs_sel_pop_view(data, false);
-
- /* Clear selected list */
- _gl_data_clear_selected_info(data);
-
- return EINA_TRUE;
-}
-#endif
-
static void __gl_thumbs_sel_popup_cb(void *data, Evas_Object *obj, void *ei)
{
GL_CHECK(obj);
elm_naviframe_item_pop(ad->maininfo.naviframe);
}
-#if 0
-/**
- * Use naviframe api to push thumbnails eidt view to stack.
- * @param obj is the content to be pushed.
- */
-static int __gl_thumbs_sel_push_view(void *data, Evas_Object *parent,
- Evas_Object *obj, char *title)
-{
- gl_dbg("GL_NAVI_THUMBS_SELECT");
- GL_CHECK_VAL(obj, -1);
- GL_CHECK_VAL(parent, -1);
- GL_CHECK_VAL(data, -1);
- gl_appdata *ad = (gl_appdata *)data;
- Elm_Object_Item *nf_it = NULL;
-
- /* Add transition finished callback */
- evas_object_smart_callback_add(parent, GL_TRANS_FINISHED,
- __gl_thumbs_sel_trans_finished_cb, data);
-
- /* Push to stack */
- nf_it = elm_naviframe_item_push(parent, title, NULL, NULL, obj,
- NULL);
- /* use pop_cb_set to support HW key event */
- elm_naviframe_item_pop_cb_set(nf_it, __gl_thumbs_sel_pop_cb, data);
- _gl_ui_set_translatable_item(nf_it, title);
- ad->gridinfo.nf_it_select = nf_it;
-
- Elm_Object_Item *tb_it = NULL;
- Evas_Object *toolbar = _gl_ctrl_add_toolbar(parent);
- /* Add 'Cancel' button */
- _gl_ctrl_append_item(toolbar, NULL, GL_STR_ID_CANCEL,
- __gl_thumbs_sel_cancel_cb, data);
- char *str = GL_STR_ID_DONE;
- /* Add 'Done' button */
- tb_it = _gl_ctrl_append_item(toolbar, NULL, str,
- __gl_thumbs_sel_done_cb, data);
- _gl_ctrl_disable_item(tb_it, true);
- elm_object_item_part_content_set(nf_it, "toolbar", toolbar);
- return 0;
-}
-#endif
-
/* Free data after layout deleted */
static void __gl_thumbs_sel_delete_layout_cb(void *data, Evas *e,
Evas_Object *obj, void *ei)
return 0;
}
-/* Update in select thunb view for Tags */
-int _gl_thumbs_sel_update_view(void *data)
-{
- GL_CHECK_VAL(data, -1);
- gl_appdata *ad = (gl_appdata *)data;
- int view_mode = gl_get_view_mode(ad);
-
- gl_dbg("view_mode: %d", view_mode);
- if (view_mode != GL_VIEW_THUMBS_SELECT) {
- gl_dbg("Not in Select view.");
- return -1;
- }
-
-#ifdef _USE_ROTATE_BG
- bool is_select = true;
- if (_gl_ctrl_get_tab_mode(data) == GL_CTRL_TAB_ALBUMS ||
- _gl_ctrl_get_tab_mode(data) == GL_CTRL_TAB_TIMELINE) {
- is_select = false;
- }
- _gl_refresh_albums_list(data, false, is_select);
-#else
- /* Checkme: albums list is not updated */
- Eina_List *sel_id_list = NULL;
- Eina_List *media_elist = NULL;
- _gl_data_save_selected_str_ids(data, &sel_id_list);
- _gl_data_clear_selected_info(ad);
- _gl_data_update_item_list(ad, &sel_id_list, &media_elist);
- _gl_thumbs_clear_and_set_list(ad, media_elist);
-#endif
-
- if (_gl_thumbs_check_zero(data)) {
- int err = -1;
- int item_cnt = 0;
- err = _gl_data_get_item_cnt(GL_ALBUM_ALL_ID, GL_STORE_T_ALL, &item_cnt);
- /* Destroy select albums view */
- if (err != 0 || item_cnt == 0) {
- gl_dbg("None local albums.");
- _gl_albums_sel_pop_view(ad);
- } else {
- gl_dbg("Empty album.");
- _gl_thumbs_sel_pop_view(ad, true);
- }
- return 0;
- } else {
- _gl_thumbs_show_edit_view(ad);
-
- /* Get selected medias count */
- int sel_cnt = _gl_data_selected_list_count(ad);
-
- gl_item *gitem = NULL;
- gitem = eina_list_nth(ad->gridinfo.medias_elist, 0);
- if (!gitem) {
- return -1;
- }
- int album_sel_count = eina_list_count(gitem->album->elist);
-
- /* Display selectioninfo */
- _gl_notify_check_selall(ad, ad->albuminfo.nf_it_select,
- ad->gridinfo.count, album_sel_count);
-
- /* Update the label text */
- _gl_ui_update_label_text(ad->albuminfo.nf_it_select, sel_cnt,
- false);
- }
-
- return 0;
-}
-
int _gl_thumbs_sel_pop_view(void *data, bool b_pop)
{
GL_CHECK_VAL(data, -1);
GL_CTRL_TAB_ALBUMS != _gl_ctrl_get_tab_mode(data)) {
return;
}
-
-#if 0
- gl_item *gitem = (gl_item *)elm_object_item_data_get(ei);
- GL_CHECK(gitem);
- GL_CHECK(gitem->item);
- GL_CHECK(gitem->item->display_name);
-
- _gl_data_selected_list_finalize(data);
- _gl_data_selected_list_append(data, gitem);
- Eina_List *medias_elist = NULL;
- _gl_thumbs_get_list(data, &medias_elist);
- _gl_data_selected_add_burstshot(data, gitem, medias_elist);
-#endif
}
static void __gl_thumbs_lang_changed(void *data, Evas_Object *obj, void *ei)
_gl_ctxpopup_create(data, obj, __gl_thumbs_ctxpopup_append);
}
-#if 0
-static void __gl_thumbs_camera_cb(void *data, Evas_Object *obj, void *ei)
-{
- GL_CHECK(data);
- gl_dbg("");
- _gl_ext_load_camera(data);
-}
-#endif
-
/**
* Use naviframe api to push thumbnails view to stack.
* @param obj is the content to be pushed.
+++ /dev/null
-/*
-* Copyright (c) 2000-2015 Samsung Electronics Co., Ltd All Rights Reserved
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*
-*/
-
-/**
- * The Exif specification defines an Orientation Tag to indicate the orientation of the
- * camera relative to the captured scene. This can be used by the camera either to
- * indicate the orientation automatically by an orientation sensor,
- * or to allow the user to indicate the orientation manually by a menu switch,
- * without actually transforming the image data itself.
- * Here is an explanation given by TsuruZoh Tachibanaya in
- * his description of the Exif file format:
- *
- * The orientation of the camera relative to the scene, when the image was captured.
- * The relation of the '0th row' and '0th column' to visual position is shown as below.
- *
- * Value 0th Row 0th Column
- * 1 top left side
- * 2 top right side
- * 3 bottom right side
- * 4 bottom left side
- * 5 left side top
- * 6 right side top
- * 7 right side bottom
- * 8 left side bottom
- *
- * Read this table as follows (thanks to Peter Nielsen for clarifying this - see also below):
- * Entry #6 in the table says that the 0th row in the stored image is the right side of
- * the captured scene, and the 0th column in the stored image is the top side of
- * the captured scene.
- *
- * Here is another description given by Adam M. Costello:
- *
- * For convenience, here is what the letter F would look like if it were tagged correctly
- * and displayed by a program that ignores the orientation tag
- * (thus showing the stored image):
- *
- * 1 2 3 4 5 6 7 8
- *
- * 888888 888888 88 88 8888888888 88 88 8888888888
- * 88 88 88 88 88 88 88 88 88 88 88 88
- * 8888 8888 8888 8888 88 8888888888 8888888888 88
- * 88 88 88 88
- * 88 88 888888 888888
-*/
-
-#ifdef _USE_ROTATE_BG
-
-#include <stdlib.h>
-#include <string.h>
-#include <time.h>
-#include <Elementary.h>
-#include "gl-exif.h"
-#include "gl-debug.h"
-#include "gallery.h"
-#include "gl-file-util.h"
-
-#define GL_EXIF_BUF_LEN_MAX 65536L
-#define GL_EXIF_BUF_TIME_LEN_MAX 20
-#define GL_EXIF_DEFAULT_YEAR 1900
-
-#define GL_EXIF_SOI 0xD8
-#define GL_EXIF_TAG 0xFF
-#define GL_EXIF_APP0 0xE0
-#define GL_EXIF_APP1 0xE1
-#define GL_EXIF_JFIF_00 0x00
-#define GL_EXIF_JFIF_01 0x01
-#define GL_EXIF_JFIF_02 0x02
-
-#define GL_EXIF_IFD_DATA_FORMAT_UNSIGNED_BYTE 1
-#define GL_EXIF_IFD_DATA_FORMAT_ASCII_STRINGS 1
-#define GL_EXIF_IFD_DATA_FORMAT_UNSIGNED_SHORT 2
-#define GL_EXIF_IFD_DATA_FORMAT_UNSIGNED_LONG 4
-#define GL_EXIF_IFD_DATA_FORMAT_UNSIGNED_RATIONAL 8
-#define GL_EXIF_IFD_DATA_FORMAT_SIGNED_BYTE 1
-#define GL_EXIF_IFD_DATA_FORMAT_UNDEFINED 1
-#define GL_EXIF_IFD_DATA_FORMAT_SIGNED_SHORT 2
-#define GL_EXIF_IFD_DATA_FORMAT_SIGNED_LONG 4
-#define GL_EXIF_IFD_DATA_FORMAT_SIGNED_RATIONAL 8
-#define GL_EXIF_IFD_DATA_FORMAT_SIGNED_FLOAT 4
-#define GL_EXIF_IFD_DATA_FORMAT_DOUBLE_FLOAT 8
-
-#define GL_EXI_TMP_JPEG_FILE GL_DATA_FOLDER_PATH"/.gallery_tmp_write_exif.jpg"
-
-/* Write one byte, testing for EOF */
-static int __gl_exif_write_1_byte(FILE *fd, int c)
-{
- if (fputc(c, fd) < 0) {
- gl_dbgE("fputc failed!");
- return -1;
- }
-
- return 0;
-}
-
-/* Read one byte, testing for EOF */
-static int __gl_exif_read_1_byte(FILE *fd)
-{
- int c = 0;
-
- /* Return next input byte, or EOF if no more */
- c = getc(fd);
- if (c == EOF) {
- gl_dbgE("Premature EOF in JPEG file!");
- return -1;
- }
-
- return c;
-}
-
-/* Read 2 bytes, convert to unsigned int */
-/* All 2-byte quantities in JPEG markers are MSB first */
-static int __gl_exif_read_2_bytes(FILE *fd, unsigned int *len)
-{
- int c1 = 0;
- int c2 = 0;
-
- /* Return next input byte, or EOF if no more */
- c1 = getc(fd);
- if (c1 == EOF) {
- gl_dbgE("Premature EOF in JPEG file!");
- return -1;
- }
-
- /* Return next input byte, or EOF if no more */
- c2 = getc(fd);
- if (c2 == EOF) {
- gl_dbgE("Premature EOF in JPEG file!");
- return -1;
- }
-
- if (len) {
- *len = (((unsigned int)c1) << 8) + ((unsigned int)c2);
- }
-
- return 0;
-}
-
-/* Add raw exif tag and data */
-static int __gl_exif_add_header(FILE *fd, unsigned int *orientation)
-{
- GL_CHECK_VAL(orientation, -1);
- GL_CHECK_VAL(fd, -1);
- int i = 0;
- int ret = -1;
- char *time_buf = NULL;
- unsigned int offset = 0;
-
- /* raw EXIF header data */
- const unsigned char exif1[] = {
- GL_EXIF_TAG, GL_EXIF_SOI, GL_EXIF_TAG, GL_EXIF_APP1
- };
- /* Write File head, check for JPEG SOI + Exif APP1 */
- for (i = 0; i < 4; i++) {
- if (__gl_exif_write_1_byte(fd, exif1[i]) < 0) {
- goto GL_EXIF_FAILED;
- }
- }
- /* SET the marker parameter length count */
- /* Length includes itself, so must be at least 2
- Following Exif data length must be at least 6; 30+36 bytes*/
- const unsigned char exif2[] = { 0x00, 0x42 };
- for (i = 0; i < 2; i++) {
- if (__gl_exif_write_1_byte(fd, exif2[i]) < 0) {
- goto GL_EXIF_FAILED;
- }
- }
-
- /* Write Exif head -- "Exif" */
- const unsigned char exif3[] = { 0x45, 0x78, 0x69, 0x66, 0x00, 0x00 };
- for (i = 0; i < 6; i++) {
- if (__gl_exif_write_1_byte(fd, exif3[i]) < 0) {
- goto GL_EXIF_FAILED;
- }
- }
-
- /* Set byte order and Tag Mark , "II(0x4949)" */
- const unsigned char exif4[] = { 0x49, 0x49, 0x2A, 0x00 };
- for (i = 0; i < 4; i++) {
- if (__gl_exif_write_1_byte(fd, exif4[i]) < 0) {
- goto GL_EXIF_FAILED;
- }
- }
- offset += 4;
-
- /* Set first IFD offset (offset to IFD0) , II-08000000 */
- const unsigned char exif5[] = { 0x08, 0x00, 0x00, 0x00 };
- for (i = 0; i < 4; i++) {
- if (__gl_exif_write_1_byte(fd, exif5[i]) < 0) {
- goto GL_EXIF_FAILED;
- }
- }
- offset += 4;
-
- /* IFD: Image File Directory */
- /* Set the number of directory entries contained in this IFD, - EEEE ;
- * 2 entry: orientation, data time */
- const unsigned char exif6[] = { 0x02, 0x00 };
- for (i = 0; i < 2; i++) {
- if (__gl_exif_write_1_byte(fd, exif6[i]) < 0) {
- goto GL_EXIF_FAILED;
- }
- }
- offset += 2;
-
- /* Add Orientation Tag in IFD0; 0x0112 */
- const unsigned char exif7[] = { 0x12, 0x01 };
- for (i = 0; i < 2; i++) {
- if (__gl_exif_write_1_byte(fd, exif7[i]) < 0) {
- goto GL_EXIF_FAILED;
- }
- }
- offset += 2;
-
- gl_dbg("Write: %d", *orientation);
- const unsigned char exif8[] = { 0x03, 0x00, 0x01, 0x00, 0x00, 0x00 };
- for (i = 0; i < 6; i++) {
- if (__gl_exif_write_1_byte(fd, exif8[i]) < 0) {
- goto GL_EXIF_FAILED;
- }
- }
- offset += 6;
-
- /* Set the Orientation value */
- if (__gl_exif_write_1_byte(fd, (unsigned char)(*orientation)) < 0) {
- goto GL_EXIF_FAILED;
- }
-
- const unsigned char exif9[] = { 0x00, 0x00, 0x00 };
- for (i = 0; i < 3; i++) {
- if (__gl_exif_write_1_byte(fd, exif9[i]) < 0) {
- goto GL_EXIF_FAILED;
- }
- }
- offset += 4;
-
- /* Add Data Time Tag in IFD0; 0x0132 */
- const unsigned char exif10[] = { 0x32, 0x01 };
- for (i = 0; i < 2; i++) {
- if (__gl_exif_write_1_byte(fd, exif10[i]) < 0) {
- goto GL_EXIF_FAILED;
- }
- }
- offset += 2;
-
- /* Type: strings */
- const unsigned char exif11[] = { 0x02, 0x00 };
- for (i = 0; i < 2; i++) {
- if (__gl_exif_write_1_byte(fd, exif11[i]) < 0) {
- goto GL_EXIF_FAILED;
- }
- }
- offset += 2;
-
- /* Data lengh, byte count */
- const unsigned char exif12[] = { 0x14, 0x00, 0x00, 0x00 };
- for (i = 0; i < 4; i++) {
- if (__gl_exif_write_1_byte(fd, exif12[i]) < 0) {
- goto GL_EXIF_FAILED;
- }
- }
- offset += 8;
-
- /* 20 bytes larger than 4 bytes,
- * so next 4 bytes is data offset start from "II"(0x4949)*/
-
- gl_dbg("offset: %2X", offset + 8);
- /* Too add data offset, plus 4 bytes self and plus 4 bytes IFD terminator */
- if (__gl_exif_write_1_byte(fd, (unsigned char)(offset + 4)) < 0) {
- goto GL_EXIF_FAILED;
- }
-
- const unsigned char exif13[] = { 0x00, 0x00, 0x00 };
- for (i = 0; i < 3; i++) {
- if (__gl_exif_write_1_byte(fd, exif13[i]) < 0) {
- goto GL_EXIF_FAILED;
- }
- }
-
- /*After last directory entry, there is a 4bytes of data('LLLLLLLL' at the chart),
- * it means an offset to next IFD. If its value is '0x00000000',
- * it means this is the last IFD and there is no linked IFD */
- const unsigned char exif14[] = { 0x00, 0x00, 0x00, 0x00 };
- for (i = 0; i < 4; i++) {
- if (__gl_exif_write_1_byte(fd, exif14[i]) < 0) {
- goto GL_EXIF_FAILED;
- }
- }
-
- /* Date Time of image was last modified.
- * Data format is "YYYY:MM:DD HH:MM:SS"+0x00, total 20bytes
- */
- time_t t;
- struct tm tms;
- struct tm *tm;
-
- t = time(NULL);
- tm = localtime_r(&t, &tms);
- if (!tm) {
- gl_dbgE("Faild to allocate memory!");
- goto GL_EXIF_FAILED;
- }
-
- time_buf = (char *)calloc(1, GL_EXIF_BUF_TIME_LEN_MAX);
- if (!time_buf) {
- gl_dbgE("Faild to allocate memory!");
- goto GL_EXIF_FAILED;
- }
- snprintf(time_buf, GL_EXIF_BUF_TIME_LEN_MAX,
- "%04i:%02i:%02i %02i:%02i:%02i",
- tm->tm_year + GL_EXIF_DEFAULT_YEAR, tm->tm_mon + 1,
- tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec);
-
- gl_dbg("time_buf: %s", time_buf);
- if (fwrite(time_buf, 1, GL_EXIF_BUF_TIME_LEN_MAX, fd) != GL_EXIF_BUF_TIME_LEN_MAX) {
- gl_dbgW("Write size are diff!");
- goto GL_EXIF_FAILED;
- }
-
- ret = 0;
-
-GL_EXIF_FAILED:
-
- gl_dbg("All done");
- GL_FREEIF(time_buf);
- return ret;
-}
-
-/* Add exif to jfif , don't have exif */
-static int __gl_exif_add_exif_to_jfif(char *file_path, unsigned int *orientation)
-{
- GL_CHECK_VAL(orientation, -1);
- GL_CHECK_VAL(file_path, -1);
- unsigned char tmp[GL_EXIF_BUF_LEN_MAX] = { 0, };
- FILE *fd = NULL;
- int ret = -1;
-
- if ((fd = fopen(file_path, "rb+")) == NULL) {
- gl_sdbgE("Can't open %s!", file_path);
- return -1;
- }
-
- char *tmp_file = GL_EXI_TMP_JPEG_FILE;
- FILE *tmp_fd = NULL;
- if ((tmp_fd = fopen(tmp_file, "wb+")) == NULL) {
- gl_dbgE("Can't open %s!", tmp_file);
- goto GL_EXIF_FAILED;
- }
-
- /* Add raw EXIF header data */
- if (__gl_exif_add_header(tmp_fd, orientation) < 0) {
- goto GL_EXIF_FAILED;
- }
-
- size_t r_size = 0;
- /* Remove start of JPEG image data section, 20 bytes */
- r_size = fread(tmp, sizeof(char), 20, fd);
-
- if (r_size > 0) {
- gl_dbg("r_size: %ld", r_size);
- }
-
- memset(tmp, 0x00, GL_EXIF_BUF_LEN_MAX);
- /* Write JPEG image data to tmp file after EXIF header */
- while ((r_size = fread(tmp, 1, sizeof(tmp), fd)) > 0) {
- gl_dbg("r_size: %ld", r_size);
- if (fwrite(tmp, 1, r_size, tmp_fd) != r_size) {
- gl_dbgW("Write and read size are diff!");
- }
-
- memset(tmp, 0x00, GL_EXIF_BUF_LEN_MAX);
- }
-
- fclose(fd);
- fd = fopen(file_path, "wb");
- if (!fd) {
- gl_sdbgE("Error creating file %s!", file_path);
- goto GL_EXIF_FAILED;
- }
-
- memset(tmp, 0x00, GL_EXIF_BUF_LEN_MAX);
- /* Write back tmp file after to JPEG image */
- int val = fseek(tmp_fd, 0, SEEK_SET);
- gl_dbg("return value is : %d", val);
- while ((r_size = fread(tmp, 1, sizeof(tmp), tmp_fd)) > 0) {
- gl_dbg("r_size: %ld", r_size);
- if (fwrite(tmp, 1, r_size, fd) != r_size) {
- gl_dbgW("Write and read size are diff!");
- }
-
- memset(tmp, 0x00, GL_EXIF_BUF_LEN_MAX);
- }
-
- ret = 0;
-
-GL_EXIF_FAILED:
-
- if (fd) {
- fclose(fd);
- }
- if (tmp_fd) {
- fclose(tmp_fd);
- }
-
- /* Delete tmp file */
- if (!gl_file_unlink(tmp_file)) {
- gl_dbgE("Delete file failed");
- }
-
- gl_dbg("All done");
- return ret;
-}
-
-
-
-/* Add orientation tag to jpegs which have exif tag but do not have orientation tag: include jfif and exif*/
-static int __gl_exif_add_orientation_tag(char *file_path,
- unsigned int *orientation)
-{
-
- GL_CHECK_VAL(orientation, -1);
- GL_CHECK_VAL(file_path, -1);
- unsigned char tmp[GL_EXIF_BUF_LEN_MAX] = { 0, };
- FILE *fd = NULL;
- int ret = -1;
- int tmp_exif = -1;
- int i = 0;
- unsigned int length = 0;
- bool is_motorola = false; /* Flag for byte order */
- unsigned int offset = 0;
- size_t r_size = 0;
- const unsigned char ifd_data_format[13] = {
- /*add 0 to ifd_data_format[0] ,for easy to use*/
- 0,
- GL_EXIF_IFD_DATA_FORMAT_UNSIGNED_BYTE,
- GL_EXIF_IFD_DATA_FORMAT_ASCII_STRINGS,
- GL_EXIF_IFD_DATA_FORMAT_UNSIGNED_SHORT,
- GL_EXIF_IFD_DATA_FORMAT_UNSIGNED_LONG,
- GL_EXIF_IFD_DATA_FORMAT_UNSIGNED_RATIONAL,
- GL_EXIF_IFD_DATA_FORMAT_SIGNED_BYTE,
- GL_EXIF_IFD_DATA_FORMAT_UNDEFINED,
- GL_EXIF_IFD_DATA_FORMAT_SIGNED_SHORT,
- GL_EXIF_IFD_DATA_FORMAT_SIGNED_LONG,
- GL_EXIF_IFD_DATA_FORMAT_SIGNED_RATIONAL,
- GL_EXIF_IFD_DATA_FORMAT_SIGNED_FLOAT,
- GL_EXIF_IFD_DATA_FORMAT_DOUBLE_FLOAT
-
- };
-
- if ((fd = fopen(file_path, "rb+")) == NULL) {
- gl_sdbgE("Can't open %s!", file_path);
- return -1;
- }
-
- char *tmp_file = GL_EXI_TMP_JPEG_FILE;
- FILE *tmp_fd = NULL;
- if ((tmp_fd = fopen(tmp_file, "wb+")) == NULL) {
- gl_dbgE("Can't open %s!", tmp_file);
- goto GL_EXIF_FAILED;
- }
- /* Find APP1 */
- bool b_tag_ff = false;
- while (1) {
- tmp_exif = __gl_exif_read_1_byte(fd);
- if (tmp_exif < 0) {
- goto GL_EXIF_FAILED;
- }
-
- /*copy data from jpeg to tmp_fd (from "FF D8" to " FF E1",because those data we needn't modify)*/
- if (__gl_exif_write_1_byte(tmp_fd, tmp_exif) < 0) {
- goto GL_EXIF_FAILED;
- }
-
- tmp[0] = (unsigned char)tmp_exif;
-
- gl_dbg("- %02X", tmp[0]);
- if (!b_tag_ff) {
- /* Get first tag */
- if (tmp[0] == GL_EXIF_TAG) {
- gl_dbgW("0xFF!");
- b_tag_ff = true;
- }
- continue;
- }
-
- /* Get APP1 */
- if (tmp[0] == GL_EXIF_APP1) {
- gl_dbgW("Exif in APP1!");
- break;
- } else {
- gl_dbgW("0x%02X!", tmp[0]);
- b_tag_ff = false;
- }
- }
-
- /* Get the marker parameter length count */
- if (__gl_exif_read_2_bytes(fd, &length) < 0) {
- goto GL_EXIF_FAILED;
- }
- gl_dbg("length: %d", length);
- /* Length includes itself, so must be at least 2
- Following Exif data length must be at least 6 */
- if (length < 8) {
- gl_dbgE("length < 8");
- goto GL_EXIF_FAILED;
- }
- /*modify the marker parameter length, orientation tag is 12*/
- length += 12;
- gl_dbgW("modified length: %d", length);
- tmp[0] = (length >> 8) & 0xff ;
- tmp[1] = length & 0xff ;
- for (i = 0; i < 2; i++) {
- if (__gl_exif_write_1_byte(tmp_fd, tmp[i]) < 0) {
- goto GL_EXIF_FAILED;
- }
- }
-
- for (i = 0; i < 6; i++) {
- tmp_exif = __gl_exif_read_1_byte(fd);
- if (tmp_exif < 0) {
- goto GL_EXIF_FAILED;
- }
-
- tmp[i] = (unsigned char)tmp_exif;
- gl_dbg("- %02X", tmp[i]);
- if (__gl_exif_write_1_byte(tmp_fd, tmp[i]) < 0) {
- goto GL_EXIF_FAILED;
- }
- }
- if (tmp[0] == 0x45 && tmp[1] == 0x78 && tmp[2] == 0x69 && tmp[3] == 0x66 &&
- tmp[4] == 0x00 && tmp[5] == 0x00) {
- gl_dbgW("Met Exif!");
- } else {
- gl_dbgW("Not met Exif!");
- goto GL_EXIF_FAILED;
- }
- /* Read Exif body */
- for (i = 0; i < 4; i++) {
- tmp_exif = __gl_exif_read_1_byte(fd);
- if (tmp_exif < 0) {
- goto GL_EXIF_FAILED;
- }
- tmp[i] = (unsigned char)tmp_exif;
- if (__gl_exif_write_1_byte(tmp_fd, tmp[i]) < 0) {
- goto GL_EXIF_FAILED;
- }
- }
-
- /* Check byte order and Tag Mark , "II(0x4949)" or "MM(0x4d4d)" */
- if (tmp[0] == 0x49 && tmp[1] == 0x49 && tmp[2] == 0x2A &&
- tmp[3] == 0x00) {
- gl_dbg("Intel");
- is_motorola = false;
- } else if (tmp[0] == 0x4D && tmp[1] == 0x4D && tmp[2] == 0x00 &&
- tmp[3] == 0x2A) {
- gl_dbg("Motorola");
- is_motorola = true;
- } else {
- goto GL_EXIF_FAILED;
- }
-
- for (i = 0; i < 4; i++) {
- tmp_exif = __gl_exif_read_1_byte(fd);
- if (tmp_exif < 0) {
- goto GL_EXIF_FAILED;
- }
-
- tmp[i] = (unsigned char)tmp_exif;
- gl_dbg("- %02X", tmp[i]);
- if (__gl_exif_write_1_byte(tmp_fd, tmp[i]) < 0) {
- goto GL_EXIF_FAILED;
- }
- }
-
- /* Get first IFD offset (offset to IFD0) , MM-08000000, II-00000008 */
- if (is_motorola) {
- if (tmp[0] != 0 && tmp[1] != 0) {
- goto GL_EXIF_FAILED;
- }
- offset = tmp[2];
- offset <<= 8;
- offset += tmp[3];
- } else {
- if (tmp[3] != 0 && tmp[2] != 0) {
- goto GL_EXIF_FAILED;
- }
- offset = tmp[1];
- offset <<= 8;
- offset += tmp[0];
- }
- gl_dbg("offset: %d", offset);
- /*if offset >8, copy data from there to IFD start position*/
- if (offset > 8) {
- for (i = 0; i < (offset - 8); i++) {
- tmp_exif = __gl_exif_read_1_byte(fd);
- if (tmp_exif < 0) {
- goto GL_EXIF_FAILED;
- }
-
- tmp[i] = (unsigned char)tmp_exif;
- gl_dbg("- %02X", tmp[i]);
- if (__gl_exif_write_1_byte(tmp_fd, tmp[i]) < 0) {
- goto GL_EXIF_FAILED;
- }
- }
- }
-
- /* IFD: Image File Directory */
- /* Get the number of directory entries contained in this IFD, - 2 bytes, EE */
- unsigned int tags_cnt = 0;
- for (i = 0; i < 2; i++) {
- tmp_exif = __gl_exif_read_1_byte(fd);
- if (tmp_exif < 0) {
- goto GL_EXIF_FAILED;
- }
-
- tmp[i] = (unsigned char)tmp_exif;
- }
- if (is_motorola) {
- tags_cnt = tmp[0];
- tags_cnt <<= 8;
- tags_cnt += tmp[1];
- } else {
- tags_cnt = tmp[1];
- tags_cnt <<= 8;
- tags_cnt += tmp[0];
- }
- gl_dbg("tags_cnt: %d", tags_cnt);
- /*modify tags num,add orientation tag */
- tags_cnt += 1;
- gl_dbg("modified tags_cnt: %d", tags_cnt);
- if (is_motorola) {
- tmp[0] = (tags_cnt >> 8) & 0xff;
- tmp[1] = tags_cnt & 0xff;
- } else {
- tmp[0] = tags_cnt & 0xff;
- tmp[1] = (tags_cnt >> 8) & 0xff;
- }
- for (i = 0; i < 2; i++) {
- gl_dbg("modified- %02X", tmp[i]);
- if (__gl_exif_write_1_byte(tmp_fd, tmp[i]) < 0) {
- goto GL_EXIF_FAILED;
- }
-
- }
- /* Add Orientation Tag in IFD0 */
- unsigned int tag_num = 0;
- unsigned char orientation_tag[12] = { 0, };
- bool b_found_position = false;
- int j = 0;
- unsigned int data_type = 0;
- unsigned int unit_num = 0;
- unsigned int data_length = 0;
- unsigned int offset_value = 0;
- /*initialize orientation_tag value*/
- if (is_motorola) {
- orientation_tag[0] = 0x01;
- orientation_tag[1] = 0x12;
-
- orientation_tag[2] = 0x00;
- orientation_tag[3] = 0x03;
-
- orientation_tag[4] = 0x00;
- orientation_tag[5] = 0x00;
- orientation_tag[6] = 0x00;
- orientation_tag[7] = 0x01;
-
- orientation_tag[8] = 0x00;
- orientation_tag[9] = (unsigned char)(*orientation);
- orientation_tag[10] = 0x00;
- orientation_tag[11] = 0x00;
-
- } else {
- orientation_tag[0] = 0x12;
- orientation_tag[1] = 0x01;
- orientation_tag[2] = 0x03;
- orientation_tag[3] = 0x00;
- orientation_tag[4] = 0x01;
- orientation_tag[5] = 0x00;
- orientation_tag[6] = 0x00;
- orientation_tag[7] = 0x00;
- orientation_tag[8] = (unsigned char)(*orientation);
- orientation_tag[9] = 0x00;
- orientation_tag[10] = 0x00;
- orientation_tag[11] = 0x00;
- }
- /*if there is no other tag, then only insert orientation_tag,don't go to the while (1)*/
- if (tags_cnt == 1) {
- for (j = 0; j < 12 ; j++) {
- gl_dbg("orientation_tag- %02X", orientation_tag[j]);
- if (__gl_exif_write_1_byte(tmp_fd, orientation_tag[j]) < 0) {
- goto GL_EXIF_FAILED;
- }
- }
- }
- while (1) {
- if (--tags_cnt == 0) {
- break;
- }
-
- /* Every directory entry size is 12 */
- for (i = 0; i < 12; i++) {
- tmp_exif = __gl_exif_read_1_byte(fd);
- if (tmp_exif < 0) {
- goto GL_EXIF_FAILED;
- }
-
- tmp[i] = (unsigned char)tmp_exif;
- }
- /* Get Tag number */
- if (is_motorola) {
- tag_num = tmp[0];
- tag_num <<= 8;
- tag_num += tmp[1];
- } else {
- tag_num = tmp[1];
- tag_num <<= 8;
- tag_num += tmp[0];
- }
- gl_dbgW("tag num %02X!" , tag_num);
- /* to find Orientation Tag position */
- if (tag_num < 0x0112) {
-
- } else if (tag_num > 0x0112) {
- if (!b_found_position) {
- for (j = 0; j < 12 ; j++) {
- gl_dbg("orientation_tag- %02X", orientation_tag[j]);
- if (__gl_exif_write_1_byte(tmp_fd, orientation_tag[j]) < 0) {
- goto GL_EXIF_FAILED;
- }
- }
- b_found_position = true;
- }
- if (is_motorola) {
- data_type = tmp[2];
- data_type <<= 8;
- data_type += tmp[3];
-
- unit_num = tmp[4];
- unit_num <<= 8;
- unit_num += tmp[5];
- unit_num <<= 8;
- unit_num += tmp[6];
- unit_num <<= 8;
- unit_num += tmp[7];
- } else {
- data_type = tmp[3];
- data_type <<= 8;
- data_type += tmp[2];
-
- unit_num = tmp[7];
- unit_num <<= 8;
- unit_num += tmp[6];
- unit_num <<= 8;
- unit_num += tmp[5];
- unit_num <<= 8;
- unit_num += tmp[4];
- }
- gl_dbgW("data_type %02X!" , data_type);
- gl_dbgW("unit_num %02X!" , unit_num);
- if ((data_type < 1) || (data_type > 12)) {
- gl_dbgE("Wrong data type!");
- goto GL_EXIF_FAILED;
- }
-
- data_length = ifd_data_format[data_type] * unit_num;
- gl_dbgW("data_length %02X!" , data_length);
- /*data_length >4 ,next 4 bytes store the offset, so need to modify the offset*/
- if (data_length > 4) {
- if (is_motorola) {
- offset_value = tmp[8];
- offset_value <<= 8;
- offset_value += tmp[9];
- offset_value <<= 8;
- offset_value += tmp[10];
- offset_value <<= 8;
- offset_value += tmp[11];
- gl_dbgW("offset_value %02X!" , offset_value);
- /*add orientation offset*/
- offset_value += 12;
- gl_dbgW("changed offset_value %02X!" , offset_value);
- tmp[8] = (offset_value >> 24) & 0xff;
- tmp[9] = (offset_value >> 16) & 0xff;
- tmp[10] = (offset_value >> 8) & 0xff;
- tmp[11] = offset_value & 0xff;
- gl_dbg("tmp[8] %02X!" , tmp[8]);
- gl_dbg("tmp[9] %02X!" , tmp[9]);
- gl_dbg("tmp[10] %02X!" , tmp[10]);
- gl_dbg("tmp[11] %02X!" , tmp[11]);
- } else {
- offset_value = tmp[11];
- offset_value <<= 8;
- offset_value += tmp[10];
- offset_value <<= 8;
- offset_value += tmp[9];
- offset_value <<= 8;
- offset_value += tmp[8];
- gl_dbgW("offset_value %02X!" , offset_value);
- /*add orientation offset*/
- offset_value += 12;
- gl_dbgW("changed offset_value %02X!" , offset_value);
-
- tmp[11] = (offset_value >> 24) & 0xff;
- tmp[10] = (offset_value >> 16) & 0xff;
- tmp[9] = (offset_value >> 8) & 0xff;
- tmp[8] = offset_value & 0xff;
- gl_dbg("tmp[8] %02X!" , tmp[8]);
- gl_dbg("tmp[9] %02X!" , tmp[9]);
- gl_dbg("tmp[10] %02X!" , tmp[10]);
- gl_dbg("tmp[11] %02X!" , tmp[11]);
-
- }
-
- }
-
- }
- for (i = 0; i < 12 ; i++) {
- gl_dbg("- %02X", tmp[i]);
- if (__gl_exif_write_1_byte(tmp_fd, tmp[i]) < 0) {
- goto GL_EXIF_FAILED;
- }
-
- }
- memset(tmp, 0x00, 12);
-
- }
- memset(tmp, 0x00, GL_EXIF_BUF_LEN_MAX);
- /* Write JPEG image data to tmp file after EXIF header */
- while ((r_size = fread(tmp, 1, sizeof(tmp), fd)) > 0) {
- gl_dbg("r_size: %ld", r_size);
- if (fwrite(tmp, 1, r_size, tmp_fd) != r_size) {
- gl_dbgW("Write and read size are diff!");
- }
-
- memset(tmp, 0x00, GL_EXIF_BUF_LEN_MAX);
- }
- fclose(fd);
- fd = NULL;
- fd = fopen(file_path, "wb");
- if (!fd) {
- gl_sdbgE("Error creating file %s!", file_path);
- goto GL_EXIF_FAILED;
- }
-
- memset(tmp, 0x00, GL_EXIF_BUF_LEN_MAX);
- /* Write back tmp file after to JPEG image */
- int val = fseek(tmp_fd, 0, SEEK_SET);
- gl_dbg("return value is : %d", val);
- while ((r_size = fread(tmp, 1, sizeof(tmp), tmp_fd)) > 0) {
- gl_dbg("r_size: %ld", r_size);
- if (fwrite(tmp, 1, r_size, fd) != r_size) {
- gl_dbgW("Write and read size are diff!");
- }
- memset(tmp, 0x00, GL_EXIF_BUF_LEN_MAX);
- }
-
- ret = 0;
-
-GL_EXIF_FAILED:
-
- if (fd) {
- fclose(fd);
- fd = NULL;
- }
-
- if (tmp_fd) {
- fclose(tmp_fd);
- tmp_fd = NULL;
- }
-
- /* Delete tmp file */
- if (!gl_file_unlink(tmp_file)) {
- gl_dbgE("Delete file failed");
- }
-
- gl_dbg("All done");
- return ret;
-}
-
-static int __gl_exif_rw_jfif(FILE *fd, char *file_path,
- unsigned int *orientation, bool b_write)
-{
- GL_CHECK_VAL(fd, -1);
- GL_CHECK_VAL(file_path, -1);
- GL_CHECK_VAL(orientation, -1);
- unsigned char tmp[GL_EXIF_BUF_LEN_MAX] = { 0, };
- int i = 0;
- unsigned int length = 0;
- int tmp_exif = -1;
- bool is_motorola = false; /* Flag for byte order */
- unsigned int offset = 0;
- int ret = -1;
- /*unsigned char version = 0x00; */
-
- if (__gl_exif_read_2_bytes(fd, &length) < 0) {
- goto GL_EXIF_FAILED;
- }
- gl_dbg("length: %d", length);
-
- for (i = 0; i < 5; i++) {
- tmp_exif = __gl_exif_read_1_byte(fd);
- if (tmp_exif < 0) {
- goto GL_EXIF_FAILED;
- }
- tmp[i] = (unsigned char)tmp_exif;
- }
-
- /* JFIF0 */
- if (tmp[0] != 0x4A || tmp[1] != 0x46 || tmp[2] != 0x49 ||
- tmp[3] != 0x46 || tmp[4] != 0x00) {
- gl_dbgE("Not met Jfif!");
- goto GL_EXIF_FAILED;
- }
-
- for (i = 0; i < 2; i++) {
- tmp_exif = __gl_exif_read_1_byte(fd);
- if (tmp_exif < 0) {
- goto GL_EXIF_FAILED;
- }
- tmp[i] = (unsigned char)tmp_exif;
- }
-
- /* Check JFIF version */
- if (tmp[0] == 0x01 && tmp[1] == GL_EXIF_JFIF_00) {
- gl_dbg("Jfif 1.00");
- } else if (tmp[0] == 0x01 && tmp[1] == GL_EXIF_JFIF_01) {
- gl_dbg("Jfif 1.01");
- } else if (tmp[0] == 0x01 && tmp[1] == GL_EXIF_JFIF_02) {
- gl_dbg("Jfif 1.02");
- } else {
- gl_dbgE("Unknow Jfif version[%d.%d]!", tmp[0], tmp[1]);
- goto GL_EXIF_FAILED;
- }
-
- /* Save version */
- /*version = tmp[1]; */
-
- /* Find APP1 */
- bool b_tag_ff = false;
- while (1) {
- tmp_exif = __gl_exif_read_1_byte(fd);
- if (tmp_exif < 0) {
- goto GL_EXIF_FAILED;
- }
-
- tmp[0] = (unsigned char)tmp_exif;
-
- gl_dbg("- %02X", tmp[0]);
- if (!b_tag_ff) {
- /* Get first tag */
- if (tmp[0] == GL_EXIF_TAG) {
- gl_dbgW("0xFF!");
- b_tag_ff = true;
- }
- continue;
- }
-
- /* Get APP1 */
- if (tmp[0] == GL_EXIF_APP1) {
- gl_dbgW("Exif in APP1!");
- break;
- }
-
- gl_dbgW("No Exif in APP1!");
-
- /* Close file */
- fclose(fd);
- if (!b_write) {
- /* Normal orientation = 0degree = 1 */
- *orientation = 1;
- return 0;
- }
- return __gl_exif_add_exif_to_jfif(file_path, orientation);
- }
-
- /* Find Exif */
- while (1) {
- for (i = 0; i < 6; i++) {
- tmp_exif = __gl_exif_read_1_byte(fd);
- if (tmp_exif < 0) {
- gl_dbgW("Not met Exif!");
- goto GL_EXIF_FAILED;
- }
-
- tmp[i] = (unsigned char)tmp_exif;
- gl_dbg("- %02X", tmp[i]);
- }
- if (tmp[0] == 0x45 && tmp[1] == 0x78 && tmp[2] == 0x69 && tmp[3] == 0x66 &&
- tmp[4] == 0x00 && tmp[5] == 0x00) {
- gl_dbgW("Met Exif!");
- break;
- } else {
- gl_dbg("Not met Exif!");
- if (fseek(fd, -5, SEEK_CUR) < 0) {
- gl_dbgE("fseek failed!");
- goto GL_EXIF_FAILED;
- }
- continue;
- }
- }
-
- /* Read Exif body */
- for (i = 0; i < 4; i++) {
- tmp_exif = __gl_exif_read_1_byte(fd);
- if (tmp_exif < 0) {
- goto GL_EXIF_FAILED;
- }
- tmp[i] = (unsigned char)tmp_exif;
- }
-
- /* Check byte order and Tag Mark , "II(0x4949)" or "MM(0x4d4d)" */
- if (tmp[0] == 0x49 && tmp[1] == 0x49 && tmp[2] == 0x2A &&
- tmp[3] == 0x00) {
- gl_dbg("Intel");
- is_motorola = false;
- } else if (tmp[0] == 0x4D && tmp[1] == 0x4D && tmp[2] == 0x00 &&
- tmp[3] == 0x2A) {
- gl_dbg("Motorola");
- is_motorola = true;
- } else {
- goto GL_EXIF_FAILED;
- }
-
- for (i = 0; i < 4; i++) {
- tmp_exif = __gl_exif_read_1_byte(fd);
- if (tmp_exif < 0) {
- goto GL_EXIF_FAILED;
- }
-
- tmp[i] = (unsigned char)tmp_exif;
- gl_dbg("- %02X", tmp[i]);
- }
-
- /* Get first IFD offset (offset to IFD0) , MM-08000000, II-00000008 */
- if (is_motorola) {
- if (tmp[0] != 0 && tmp[1] != 0) {
- goto GL_EXIF_FAILED;
- }
- offset = tmp[2];
- offset <<= 8;
- offset += tmp[3];
- } else {
- if (tmp[3] != 0 && tmp[2] != 0) {
- goto GL_EXIF_FAILED;
- }
- offset = tmp[1];
- offset <<= 8;
- offset += tmp[0];
- }
- gl_dbg("offset: %d", offset);
-
- /* IFD: Image File Directory */
- /* Get the number of directory entries contained in this IFD, - 2 bytes, EE */
- unsigned int tags_cnt = 0;
- for (i = 0; i < 2; i++) {
- tmp_exif = __gl_exif_read_1_byte(fd);
- if (tmp_exif < 0) {
- goto GL_EXIF_FAILED;
- }
-
- tmp[i] = (unsigned char)tmp_exif;
- }
- if (is_motorola) {
- tags_cnt = tmp[0];
- tags_cnt <<= 8;
- tags_cnt += tmp[1];
- } else {
- tags_cnt = tmp[1];
- tags_cnt <<= 8;
- tags_cnt += tmp[0];
- }
- gl_dbg("tags_cnt: %d", tags_cnt);
- if (tags_cnt == 0) {
- gl_dbgE("tags_cnt == 0,no found orientation tag!");
- if (b_write) {
- gl_dbgW("to add an orientation tag!");
- fclose(fd);
- fd = NULL;
- return __gl_exif_add_orientation_tag(file_path, orientation);
-
- } else {
- /* Normal orientation = 0degree = 1 */
- *orientation = 1;
- ret = 0;
- }
- goto GL_EXIF_FAILED;
- }
-
- /* Search for Orientation Tag in IFD0 */
- unsigned int tag_num = 0;
- while (1) {
- /* Every directory entry size is 12 */
- for (i = 0; i < 12; i++) {
- tmp_exif = __gl_exif_read_1_byte(fd);
- if (tmp_exif < 0) {
- goto GL_EXIF_FAILED;
- }
-
- tmp[i] = (unsigned char)tmp_exif;
- }
- /* Get Tag number */
- if (is_motorola) {
- tag_num = tmp[0];
- tag_num <<= 8;
- tag_num += tmp[1];
- } else {
- tag_num = tmp[1];
- tag_num <<= 8;
- tag_num += tmp[0];
- }
- /* found Orientation Tag */
- if (tag_num == 0x0112) {
- gl_dbgW("Found orientation tag!");
- break;
- }
- if (--tags_cnt == 0) {
- gl_dbgW("tags_cnt == 0, no found orientation tag!");
- if (b_write) {
- gl_dbgW("to add an orientation tag!");
- fclose(fd);
- fd = NULL;
- return __gl_exif_add_orientation_tag(file_path, orientation);
-
- } else {
- /* Normal orientation = 0degree = 1 */
- *orientation = 1;
- ret = 0;
- }
- goto GL_EXIF_FAILED;
- }
- }
-
- /* |TT|ff|NNNN|DDDD| --- TT - 2 bytes, tag NO. ;ff - 2 bytes, data format
- NNNN - 4 bytes, entry count; DDDD - 4 bytes Data value */
- if (b_write) {
- gl_dbg("Write: %d", *orientation);
- /* Set the Orientation value */
- if (is_motorola) {
- tmp[9] = (unsigned char)(*orientation);
- } else {
- tmp[8] = (unsigned char)(*orientation);
- }
-
- /* Move pointer back to the entry start point */
- if (fseek(fd, -12, SEEK_CUR) < 0) {
- gl_dbgE("fseek failed!");
- goto GL_EXIF_FAILED;
- }
- fwrite(tmp, 1, 10, fd);
- } else {
- /* Get the Orientation value */
- if (is_motorola) {
- if (tmp[8] != 0) {
- gl_dbgE("tmp[8] != 0");
- goto GL_EXIF_FAILED;
- }
- *orientation = (unsigned int)tmp[9];
- } else {
- if (tmp[9] != 0) {
- gl_dbgE("tmp[9] != 0");
- goto GL_EXIF_FAILED;
- }
- *orientation = (unsigned int)tmp[8];
- }
- if (*orientation > 8) {
- gl_dbgE("*orient > 8");
- goto GL_EXIF_FAILED;
- }
- gl_dbg("Read: %d", *orientation);
- }
-
- ret = 0;
-
-GL_EXIF_FAILED:
-
- fclose(fd);
- gl_dbg("All done");
- return ret;
-}
-bool _gl_exif_check_img_type(char *file_path)
-{
- GL_CHECK_VAL(file_path, -1);
- int tmp_exif = -1;
- unsigned int i = 0;
- unsigned char exif_data[4] = { 0, };
- FILE *fd = NULL;
- bool ret = false;
-
- if ((fd = fopen(file_path, "rb")) == NULL) {
- gl_sdbgE("Can't open %s!", file_path);
- return -1;
- }
-
-
- /* Read File head, check for JPEG SOI + Exif APP1 */
- for (i = 0; i < 4; i++) {
- tmp_exif = __gl_exif_read_1_byte(fd);
- if (tmp_exif < 0) {
- goto GL_EXIF_FAILED;
- }
-
- exif_data[i] = (unsigned char)tmp_exif;
- }
-
- if (exif_data[0] == GL_EXIF_TAG && exif_data[1] == GL_EXIF_SOI) {
- gl_dbg("JPEG file");
- } else {
- gl_dbgE("Not a JPEG file!");
- goto GL_EXIF_FAILED;
- }
-
- if (exif_data[2] == GL_EXIF_TAG && exif_data[3] == GL_EXIF_APP1) {
- gl_dbgW("Exif in APP1!");
- ret = true;
- } else if (exif_data[2] == GL_EXIF_TAG &&
- exif_data[3] == GL_EXIF_APP0) {
- gl_dbgW("Jfif in APP0!");
- ret = true;
- } else {
- gl_dbgE("Not a Exif in APP1 or Jiff in APP2[%d]!", exif_data[3]);
- ret = false;
- }
-GL_EXIF_FAILED:
-
- fclose(fd);
- gl_dbg("");
- return ret;
-}
-
-static int __gl_exif_rw_orient(char *file_path, unsigned int *orient, bool b_write)
-{
- GL_CHECK_VAL(file_path, -1);
- gl_dbg("b_write: %d", b_write);
- unsigned int length = 0;
- unsigned int i = 0;
- bool is_motorola = false; /* Flag for byte order */
- unsigned int offset = 0;
- unsigned int jfif_offset = 0;
- unsigned int tags_cnt = 0;
- unsigned int tag_num = 0;
- int tmp_exif = -1;
- unsigned char exif_data[GL_EXIF_BUF_LEN_MAX] = { 0, };
- FILE *fd = NULL;
- int ret = -1;
-
- if (b_write) {
- if ((fd = fopen(file_path, "rb+")) == NULL) {
- gl_sdbgE("Can't open %s!", file_path);
- return -1;
- }
- } else {
- if ((fd = fopen(file_path, "rb")) == NULL) {
- gl_sdbgE("Can't open %s!", file_path);
- return -1;
- }
- }
-
- /* Read File head, check for JPEG SOI + Exif APP1 */
- for (i = 0; i < 4; i++) {
- tmp_exif = __gl_exif_read_1_byte(fd);
- if (tmp_exif < 0) {
- goto GL_EXIF_FAILED;
- }
-
- exif_data[i] = (unsigned char)tmp_exif;
- }
-
- if (exif_data[0] == GL_EXIF_TAG && exif_data[1] == GL_EXIF_SOI) {
- gl_dbg("JPEG file");
- } else {
- gl_dbgE("Not a JPEG file!");
- goto GL_EXIF_FAILED;
- }
-
- if (exif_data[2] == GL_EXIF_TAG && exif_data[3] == GL_EXIF_APP1) {
- gl_dbgW("Exif in APP1!");
- } else if (exif_data[2] == GL_EXIF_TAG &&
- exif_data[3] == GL_EXIF_APP0) {
- gl_dbgW("Jfif in APP0!");
- int ret = __gl_exif_rw_jfif(fd, file_path, orient, b_write);
- return ret;
- } else {
- gl_dbgE("Not a Exif in APP1 or Jiff in APP2[%d]!", exif_data[3]);
- goto GL_EXIF_FAILED;
- }
-
- /* Get the marker parameter length count */
- if (__gl_exif_read_2_bytes(fd, &length) < 0) {
- goto GL_EXIF_FAILED;
- }
- gl_dbg("length: %d", length);
- /* Length includes itself, so must be at least 2
- Following Exif data length must be at least 6 */
- if (length < 8) {
- gl_dbgE("length < 8");
- goto GL_EXIF_FAILED;
- }
- length -= 8;
-
- /* Length of an IFD entry */
- if (length < 12) {
- gl_dbgE("length < 12");
- goto GL_EXIF_FAILED;
- }
-
- /* Read Exif head, check for "Exif" */
- for (i = 0; i < 6; i++) {
- tmp_exif = __gl_exif_read_1_byte(fd);
- if (tmp_exif < 0) {
- goto GL_EXIF_FAILED;
- }
-
- exif_data[i] = (unsigned char)tmp_exif;
- }
-
- if (exif_data[0] != 0x45 || exif_data[1] != 0x78 ||
- exif_data[2] != 0x69 || exif_data[3] != 0x66 ||
- exif_data[4] != 0x00 || exif_data[5] != 0x00) {
- gl_dbgE("Not met Exif!");
- for (i = 0; i < 6; i++) {
- gl_dbg("- %02X", exif_data[i]);
- }
- goto GL_EXIF_FAILED;
- }
-
- /* Read Exif body */
- for (i = 0; i < length; i++) {
- tmp_exif = __gl_exif_read_1_byte(fd);
- if (tmp_exif < 0) {
- goto GL_EXIF_FAILED;
- }
- exif_data[i] = (unsigned char)tmp_exif;
- }
-
- /* Check byte order and Tag Mark , "II(0x4949)" or "MM(0x4d4d)" */
- if (exif_data[0] == 0x49 && exif_data[1] == 0x49 &&
- exif_data[2] == 0x2A && exif_data[3] == 0x00) {
- gl_dbg("Intel");
- is_motorola = false;
- } else if (exif_data[0] == 0x4D && exif_data[1] == 0x4D &&
- exif_data[2] == 0x00 && exif_data[3] == 0x2A) {
- gl_dbg("Motorola");
- is_motorola = true;
- } else {
- goto GL_EXIF_FAILED;
- }
-
- /* Get first IFD offset (offset to IFD0) , MM-00000008, II-08000000 */
- if (is_motorola) {
- if (exif_data[4] != 0 && exif_data[5] != 0) {
- goto GL_EXIF_FAILED;
- }
- offset = exif_data[6];
- offset <<= 8;
- offset += exif_data[7];
- } else {
- if (exif_data[7] != 0 && exif_data[6] != 0) {
- goto GL_EXIF_FAILED;
- }
- offset = exif_data[5];
- offset <<= 8;
- offset += exif_data[4];
- }
- /* check end of data segment */
- if (offset > length - 2) {
- gl_dbgE("offset > length - 2");
- goto GL_EXIF_FAILED;
- }
-
- /* IFD: Image File Directory */
- /* Get the number of directory entries contained in this IFD, - EEEE */
- if (is_motorola) {
- tags_cnt = exif_data[offset];
- tags_cnt <<= 8;
- tags_cnt += exif_data[offset + 1];
- } else {
- tags_cnt = exif_data[offset + 1];
- tags_cnt <<= 8;
- tags_cnt += exif_data[offset];
- }
- if (tags_cnt == 0) {
- gl_dbgE("tags_cnt == 0 - 2");
- goto GL_EXIF_FAILED;
- }
- offset += 2;
-
- /* check end of data segment */
- if (offset > length - 12) {
- gl_dbgE("offset > length - 12");
- goto GL_EXIF_FAILED;
- }
-
- /* Search for Orientation Tag in IFD0 */
- while (1) {
- /* Get Tag number */
- if (is_motorola) {
- tag_num = exif_data[offset];
- tag_num <<= 8;
- tag_num += exif_data[offset + 1];
- } else {
- tag_num = exif_data[offset + 1];
- tag_num <<= 8;
- tag_num += exif_data[offset];
- }
- /* found Orientation Tag */
- if (tag_num == 0x0112) {
- gl_dbgW("Found orientation tag!");
- break;
- }
- if (--tags_cnt == 0) {
- gl_dbgW("tags_cnt == 0, no found orientation tag!");
- if (b_write) {
- gl_dbgW("to add an orientation tag!");
- fclose(fd);
- fd = NULL;
- return __gl_exif_add_orientation_tag(file_path, orient);
-
- } else {
- /* Normal orientation = 0degree = 1 */
- *orient = 1;
- ret = 0;
- }
- goto GL_EXIF_FAILED;
- }
-
- /* Every directory entry size is 12 */
- offset += 12;
- }
-
- if (b_write) {
- gl_dbg("Write: %d", *orient);
- /* Set the Orientation value */
- if (is_motorola) {
- exif_data[offset + 9] = (unsigned char)(*orient);
- } else {
- exif_data[offset + 8] = (unsigned char)(*orient);
- }
-
- if (fseek(fd, jfif_offset + (4 + 2 + 6 + 2) + offset, SEEK_SET) < 0) {
- gl_dbgE("fseek failed!");
- goto GL_EXIF_FAILED;
- }
- fwrite(exif_data + 2 + offset, 1, 10, fd);
- } else {
- /* Get the Orientation value */
- if (is_motorola) {
- if (exif_data[offset + 8] != 0) {
- gl_dbgE("exif_data[offset+8] != 0");
- goto GL_EXIF_FAILED;
- }
- *orient = (unsigned int)exif_data[offset + 9];
- } else {
- if (exif_data[offset + 9] != 0) {
- gl_dbgE("exif_data[offset+9] != 0");
- goto GL_EXIF_FAILED;
- }
- *orient = (unsigned int)exif_data[offset + 8];
- }
- if (*orient > 8) {
- gl_dbgE("*orient > 8");
- goto GL_EXIF_FAILED;
- }
- gl_dbg("Read: %d", *orient);
- }
-
- ret = 0;
-
-GL_EXIF_FAILED:
-
- fclose(fd);
- gl_dbg("All done");
- return ret;
-}
-
-int _gl_exif_get_orientation(char *file_path, unsigned int *orientation)
-{
- GL_CHECK_VAL(orientation, -1);
- GL_CHECK_VAL(file_path, -1);
- gl_sdbg("file_path: %s", file_path);
-
- return __gl_exif_rw_orient(file_path, orientation, false);
-}
-
-int _gl_exif_set_orientation(char *file_path, unsigned int orientation)
-{
- GL_CHECK_VAL(file_path, -1);
- gl_sdbg("file_path: %s", file_path);
-
- return __gl_exif_rw_orient(file_path, &orientation, true);
-}
-
-int _gl_exif_get_rotated_orientation(unsigned int orientation, bool b_left)
-{
- int rotated_orientataion;
- gl_dbg("b_left: %d", b_left);
-
- switch (orientation) {
- case GL_ORIENTATION_ROT_0:
- /* true: 0 -> 270, false: 0 -> 90 */
- if (b_left) {
- rotated_orientataion = GL_ORIENTATION_ROT_270;
- } else {
- rotated_orientataion = GL_ORIENTATION_ROT_90;
- }
- break;
- case GL_ORIENTATION_ROT_90:
- /* true: 90 -> 0, false: 90 -> 180 */
- if (b_left) {
- rotated_orientataion = GL_ORIENTATION_ROT_0;
- } else {
- rotated_orientataion = GL_ORIENTATION_ROT_180;
- }
- break;
- case GL_ORIENTATION_ROT_180:
- /* true: 180 -> 90, false: 180 -> 270 */
- if (b_left) {
- rotated_orientataion = GL_ORIENTATION_ROT_90;
- } else {
- rotated_orientataion = GL_ORIENTATION_ROT_270;
- }
- break;
- case GL_ORIENTATION_ROT_270:
- /* true: 270 -> 180, false: 270 -> 0 */
- if (b_left) {
- rotated_orientataion = GL_ORIENTATION_ROT_180;
- } else {
- rotated_orientataion = GL_ORIENTATION_ROT_0;
- }
- break;
- default:
- gl_dbgE("Wrong oriectation: %d!", orientation);
- /* true: 0 -> 270, false: 0 -> 90 */
- if (b_left) {
- rotated_orientataion = GL_ORIENTATION_ROT_270;
- } else {
- rotated_orientataion = GL_ORIENTATION_ROT_90;
- }
- break;
- }
-
- gl_dbg("New orientation: %d", rotated_orientataion);
- return rotated_orientataion;
-}
-
-#endif
-
return ret;
}
-#if 0 //Unused function
-int _gl_fs_update_file_mtime(const char *path)
-{
- GL_CHECK_VAL(path, -1);
- struct timeval tv;
- gettimeofday(&tv, NULL);
- struct timeval times[2] = { {0, 0}, {0, 0} };
- times[0].tv_sec = tv.tv_sec;
- times[0].tv_usec = tv.tv_usec;
- times[1].tv_sec = tv.tv_sec;
- times[1].tv_usec = tv.tv_usec;
- if (utimes(path, times) < 0) {
- gl_dbgE("utimes failed!");
- return -1;
- }
- return 0;
-}
-#endif
-
int _gl_fs_get_file_stat(const char *filename, gl_node_info_s **node)
{
struct stat statbuf;
return 0;
}
-#if 0
-int _gl_ui_add_xpt_btns(Elm_Object_Item *nf_it, gl_ui_xpt_btn_e xpt_btn,
- Evas_Smart_Cb r_cb, Evas_Smart_Cb l_cb, void *data)
-{
- /* Get expanded title */
- Evas_Object *title = NULL;
- title = elm_object_item_part_content_get(nf_it, "title");
- GL_CHECK_VAL(title, -1);
- /* Camera */
- if (xpt_btn & GL_UI_XPT_CAMERA) {
- /* New-album , add left before right for customized TTS */
- if (xpt_btn & GL_UI_XPT_SHARE)
- _gl_expn_title_add_left_btn(title, GL_ICON_SHARE,
- _gl_str(GL_STR_ID_NEW_ALBUM),
- l_cb, data);
- _gl_expn_title_add_right_btn(title, GL_ICON_CAMERA,
- _gl_str(GL_STR_ID_CAMERA), r_cb,
- data);
- /* Select-all */
- } else if (xpt_btn & GL_UI_XPT_SEL_ALL) {
- if (xpt_btn & GL_UI_XPT_DONE)
- _gl_expn_title_add_left_btn(title, GL_ICON_DONE,
- _gl_str(GL_STR_ID_DONE),
- l_cb, data);
- _gl_expn_title_add_right_btn(title, GL_ICON_TITLE_SELECT_ALL,
- GL_STR_SELECT_ALL, r_cb, data);
- } else {
- gl_dbgE("Wrong mode!");
- }
- _gl_expn_title_set_tts(title);
- return 0;
-}
-
-Evas_Object *_gl_ui_get_xpt_btn(Elm_Object_Item *nf_it, gl_ui_xpt_btn_e ui_btn)
-{
- /* Get expanded title */
- Evas_Object *title = NULL;
- title = elm_object_item_part_content_get(nf_it, "title");
- GL_CHECK_NULL(title);
- gl_xtp_btn_e xpt_btn = GL_XPT_BTN_RIGHT;
- if (ui_btn & GL_UI_XPT_SHARE) {
- xpt_btn = GL_XPT_BTN_LEFT;
- }
- return _gl_expn_title_get_btn(title, xpt_btn);
-}
-
-int _gl_ui_disable_xpt_btn(Elm_Object_Item *nf_it, gl_ui_xpt_btn_e ui_btn, bool b_disabled)
-{
- Evas_Object *btn = NULL;
- btn = _gl_ui_get_xpt_btn(nf_it, ui_btn);
- if (btn) {
- elm_object_disabled_set(btn, b_disabled);
- } else {
- gl_dbgE("Failed to get xpt button!");
- }
- return 0;
-}
-
-int _gl_ui_clear_xpt_btns(Elm_Object_Item *nf_it)
-{
- /* Get expanded title */
- Evas_Object *title = NULL;
- title = elm_object_item_part_content_get(nf_it, "title");
- GL_CHECK_VAL(title, -1);
- _gl_expn_title_clear_btns(title);
- return 0;
-}
-#endif
-
Evas_Object *_gl_ui_create_gridview_ly(void *data, Evas_Object *parent)
{
GL_CHECK_NULL(parent);
#include "gl-data-type.h"
#include "gl-fs.h"
#include "gl-db-update.h"
-#ifdef _USE_ROTATE_BG
-#include "gl-exif.h"
-#endif
#include "gl-timeline.h"
#include "gl-file-util.h"
#include "gl-thumbs.h"
return 0;
}
-#ifdef _USE_ROTATE_BG
/* b_path == true, Use saved folder path to check cluster uuid
* b_select == true, Update albums in select view for tag adding
*/
return 0;
}
-#endif
-
int _gl_update_albums_data(void *data)
{
GL_CHECK_VAL(data, -1);
int _gl_update_albums_list(void *data)
{
-#ifdef _USE_ROTATE_BG
return _gl_refresh_albums_list(data, false, false);
-#else
- GL_CHECK_VAL(data, -1);
- gl_appdata *ad = (gl_appdata *)data;
- gl_cluster *cur_album = _gl_albums_get_current(data);
- char cluster_id[GL_MTYPE_ITEN_ID_LEN_MAX] = { 0, };
- bool b_get_cur_album = false;
-
- /* Save cluster ID to set new current_album from new albums list */
- if (cur_album && cur_album->cluster && cur_album->cluster->uuid) {
- g_strlcpy(cluster_id, cur_album->cluster->uuid,
- GL_MTYPE_ITEN_ID_LEN_MAX);
- b_get_cur_album = true;
- } else {
- gl_dbg("None album selected, current album is unavailable.");
- }
-
- _gl_data_get_cluster_list(ad);
- /* need to reset current album */
- _gl_albums_set_current(data, NULL);
- cur_album = NULL;
-
- if (b_get_cur_album) {
- _gl_data_get_cluster_by_id(ad, cluster_id, &cur_album);
- if (cur_album && cur_album->cluster) {
- _gl_albums_set_current(data, cur_album);
- gl_sdbg("Reset current album: %s",
- cur_album->cluster->display_name);
- Eina_List *sel_id_list = NULL;
- Eina_List *media_elist = NULL;
- int view_m = gl_get_view_mode(ad);
- if (view_m == GL_VIEW_THUMBS_EDIT ||
- view_m == GL_VIEW_THUMBS_SELECT) {
- gl_dbg("Edit view.");
- /* Get ID list of selected items */
- _gl_data_save_selected_str_ids(data, &sel_id_list);
- }
- _gl_data_clear_selected_info(ad);
- _gl_data_update_item_list(ad, &sel_id_list, &media_elist);
- _gl_thumbs_clear_and_set_list(ad, media_elist);
- return 0;
- } else {
- /* Clear items list if current album doesn't exist */
- if (ad->selinfo.elist) {
- _gl_data_clear_selected_info(ad);
- }
- }
- }
-
- return 0;
-#endif
}
/**
_gl_update_albums_list(ad);
/*update view soon after removing over*/
_gl_thumbs_update_view(ad);
-// _gl_thumbs_update_sequence(ad);
}
} else {
gl_dbgE("Wrong mode!");
return EINA_TRUE;
}
-/**
-* Parse medias type and count of selected items,
-* and set different type for share items.
-*/
-int gl_get_share_mode(void *data)
-{
- GL_CHECK_VAL(data, -1);
- gl_appdata *ad = (gl_appdata *)data;
- int share_mode = GL_SHARE_NONE;
- int image_cnt = 0;
- int video_cnt = 0;
- int sel_cnt = 0;
- int view_m = gl_get_view_mode(ad);
- if (view_m == GL_VIEW_ALBUMS_EDIT) {
- sel_cnt = ad->selinfo.sel_cnt;
- } else if (view_m == GL_VIEW_ALBUMS) {
- sel_cnt = ad->selinfo.sel_cnt;
- } else {
- GL_CHECK_VAL(ad->selinfo.elist, -1);
- sel_cnt = eina_list_count(ad->selinfo.elist);
- }
- image_cnt = ad->selinfo.images_cnt;
- if (image_cnt > sel_cnt) {
- gl_dbgE("Images count is wrong!");
- return -1;
- }
-
- video_cnt = sel_cnt - image_cnt;
- gl_dbg("Selected items count: %d, image count: %d, video count: %d.",
- sel_cnt, image_cnt, video_cnt);
-
- if (image_cnt && video_cnt) {
- share_mode = GL_SHARE_IMAGE_VIDEO;
- } else if (image_cnt) {
- if (ad->selinfo.jpeg_cnt == sel_cnt) {
- if (image_cnt == 1) {
- share_mode = GL_SHARE_IMAGE_ONE_JPEG;
- } else {
- share_mode = GL_SHARE_IMAGE_MULTI_JPEG;
- }
- } else {
- if (image_cnt == 1) {
- share_mode = GL_SHARE_IMAGE_ONE;
- } else {
- share_mode = GL_SHARE_IMAGE_MULTI;
- }
- }
- } else if (video_cnt) {
- if (video_cnt == 1) {
- share_mode = GL_SHARE_VIDEO_ONE;
- } else {
- share_mode = GL_SHARE_VIDEO_MULTI;
- }
- } else {
- gl_dbgE("Error: no video and image!");
- return -1;
- }
- gl_dbg("share_mode is %d.", share_mode);
-
- return share_mode;
-}
-
/**
* It's in thumbnails view, video list view, or selectioinfo view.
* Destroy invalid widegets or UGs.
*
*/
-#ifdef _USE_ROTATE_BG
#include "gl-rotate-bg.h"
-#include "gl-exif.h"
#include "gl-debug.h"
#include "gl-icons.h"
void *user_data;
} gl_bg;
-static int __gl_rotate_bg_image_rotate_180(Evas_Object *obj)
-{
- GL_CHECK_VAL(obj, -1);
- unsigned int *data = NULL;
- unsigned int *data2 = NULL;
- unsigned int *to = NULL;
- unsigned int *from = NULL;
- int x = 0;
- int hw = 0;
- int iw = 0;
- int ih = 0;
-
- evas_object_image_size_get(obj, &iw, &ih);
- int size = iw * ih * sizeof(unsigned int);
-
- /* EINA_FALSE for reading */
- data = evas_object_image_data_get(obj, EINA_FALSE);
- /* memcpy */
- data2 = calloc(1, size);
- GL_CHECK_VAL(data2, -1);
- memcpy(data2, data, size);
-
- data = evas_object_image_data_get(obj, EINA_TRUE);
-
- hw = iw * ih;
- x = hw;
- to = data;
- from = data2 + hw - 1;
- for (; --x >= 0;) {
- *to = *from;
- to++;
- from--;
- }
-
-
- GL_FREE(data2);
-
- evas_object_image_data_set(obj, data);
- evas_object_image_data_update_add(obj, 0, 0, iw, ih);
- return 0;
-}
-
-static int __gl_rotate_bg_image_rotate_90(Evas_Object *obj)
-{
- GL_CHECK_VAL(obj, -1);
- unsigned int *data = NULL;
- unsigned int *data2 = NULL;
- unsigned int *to = NULL;
- unsigned int *from = NULL;
- int x = 0;
- int y = 0;
- int w = 0;
- int hw = 0;
- int iw = 0;
- int ih = 0;
-
- evas_object_image_size_get(obj, &iw, &ih);
- int size = iw * ih * sizeof(unsigned int);
-
- /* EINA_FALSE for reading */
- data = evas_object_image_data_get(obj, EINA_FALSE);
- /* memcpy */
- data2 = calloc(1, size);
- GL_CHECK_VAL(data2, -1);
- memcpy(data2, data, size);
-
- /* set width, height */
- w = ih;
- ih = iw;
- iw = w;
- hw = w * ih;
-
- /* set width, height to image obj */
- evas_object_image_size_set(obj, iw, ih);
- data = evas_object_image_data_get(obj, EINA_TRUE);
- to = data + w - 1;
- hw = -hw - 1;
- from = data2;
-
- for (x = iw; --x >= 0;) {
- for (y = ih; --y >= 0;) {
- *to = *from;
- from++;
- to += w;
- }
-
- to += hw;
- }
-
- GL_FREE(data2);
-
- evas_object_image_data_set(obj, data);
- evas_object_image_data_update_add(obj, 0, 0, iw, ih);
- return 0;
-}
-
-static int __gl_rotate_bg_image_rotate_270(Evas_Object *obj)
-{
- GL_CHECK_VAL(obj, -1);
- unsigned int *data = NULL;
- unsigned int *data2 = NULL;
- unsigned int *to = NULL;
- unsigned int *from = NULL;
- int x = 0;
- int y = 0;
- int w = 0;
- int hw = 0;
- int iw = 0;
- int ih = 0;
-
- evas_object_image_size_get(obj, &iw, &ih);
- int size = iw * ih * sizeof(unsigned int);
-
- /* EINA_FALSE for reading */
- data = evas_object_image_data_get(obj, EINA_FALSE);
- /* memcpy */
- data2 = calloc(1, size);
- GL_CHECK_VAL(data2, -1);
- memcpy(data2, data, size);
-
- /* set width, height */
- w = ih;
- ih = iw;
- iw = w;
- hw = w * ih;
-
- /* set width, height to image obj */
- evas_object_image_size_set(obj, iw, ih);
- data = evas_object_image_data_get(obj, EINA_TRUE);
-
- to = data + hw - w;
- w = -w;
- hw = hw + 1;
- from = data2;
-
- for (x = iw; --x >= 0;) {
- for (y = ih; --y >= 0;) {
- *to = *from;
- from++;
- to += w;
- }
-
- to += hw;
- }
-
- GL_FREE(data2);
-
- evas_object_image_data_set(obj, data);
- evas_object_image_data_update_add(obj, 0, 0, iw, ih);
- return 0;
-}
-
-/* check its orientation */
-int __gl_rotate_bg_rotate_image(Evas_Object *obj, unsigned int orient)
-{
- switch (orient) {
- case GL_ORIENTATION_ROT_90:
- __gl_rotate_bg_image_rotate_90(obj);
- break;
- case GL_ORIENTATION_ROT_180:
- __gl_rotate_bg_image_rotate_180(obj);
- break;
- case GL_ORIENTATION_ROT_270:
- __gl_rotate_bg_image_rotate_270(obj);
- break;
- default:
- break;
- }
-
- return 0;
-}
-
static void __gl_rotate_bg_delete_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
{
if (data) {
return base;
}
-int _gl_rotate_bg_set_data(Evas_Object *bg, void *data)
-{
- GL_CHECK_VAL(bg, -1);
-
- gl_bg *bg_data = evas_object_data_get(bg, GL_ROTATE_BG_DATA_KEY);
- GL_CHECK_VAL(bg_data, -1);
- bg_data->user_data = data;
- return 0;
-}
-
-int _gl_rotate_bg_get_data(Evas_Object *bg, void **data)
-{
- GL_CHECK_VAL(data, -1);
- GL_CHECK_VAL(bg, -1);
-
- gl_bg *bg_data = evas_object_data_get(bg, GL_ROTATE_BG_DATA_KEY);
- GL_CHECK_VAL(bg_data, -1);
- *data = bg_data->user_data;
- return 0;
-}
-
int _gl_rotate_bg_set_file(Evas_Object *bg, const char *file, int w, int h)
{
GL_CHECK_VAL(file, -1);
return 0;
}
-int _gl_rotate_bg_get_file(Evas_Object *bg, char **file)
-{
- GL_CHECK_VAL(file, -1);
- GL_CHECK_VAL(bg, -1);
-
- gl_bg *bg_data = evas_object_data_get(bg, GL_ROTATE_BG_DATA_KEY);
- GL_CHECK_VAL(bg_data, -1);
- *file = bg_data->file;
- return 0;
-}
-
int _gl_rotate_bg_rotate_image(Evas_Object *bg, unsigned int orient)
{
GL_CHECK_VAL(bg, -1);
gl_bg *bg_data = evas_object_data_get(bg, GL_ROTATE_BG_DATA_KEY);
GL_CHECK_VAL(bg_data, -1);
-
- if (bg_data->file && g_strcmp0(bg_data->file, GL_ICON_NO_THUMBNAIL) &&
- g_strcmp0(bg_data->file, GL_ICON_CONTENTS_BROKEN)) {
- __gl_rotate_bg_rotate_image(bg_data->img, orient);
- } else {
- __gl_rotate_bg_rotate_image(bg_data->img, GL_ORIENTATION_ROT_0);
- }
if (!bg_data->b_preload) {
__gl_rotate_bg_custom_resize(bg_data, NULL, NULL, NULL);
}
return 0;
}
-
-#endif
#include "gl-pinchzoom.h"
#include "gl-strings.h"
#include "gl-icons.h"
-#ifdef _USE_ROTATE_BG
#include "gl-rotate-bg.h"
-#include "gl-exif.h"
-#endif
#include "gl-gesture.h"
/* Size of thumbnails in gridview */
{
GL_CHECK_NULL(parent);
-#ifdef _USE_ROTATE_BG
Evas_Object *bg = _gl_rotate_bg_add(parent, true);
-#else
- Evas_Object *bg = elm_bg_add(parent);
-#endif
if (bg == NULL) {
return NULL;
}
-#ifdef _USE_ROTATE_BG
_gl_rotate_bg_set_file(bg, path, w, h);
_gl_rotate_bg_rotate_image(bg, orient);
-#else
- elm_bg_file_set(bg, path, NULL);
- elm_bg_load_size_set(bg, w, h);
- evas_object_size_hint_max_set(bg, w, h);
- evas_object_size_hint_aspect_set(bg, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
- evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- evas_object_size_hint_align_set(bg, EVAS_HINT_FILL, EVAS_HINT_FILL);
-#endif
return bg;
}
Evas_Object *layout = elm_layout_add(obj);
GL_CHECK_NULL(layout);
-#ifdef _USE_ROTATE_BG
Evas_Object *bg = _gl_rotate_bg_add(layout, true);
-#else
- Evas_Object *bg = elm_bg_add(layout);
-#endif
if (bg == NULL) {
evas_object_del(layout);
return NULL;
}
-#ifdef _USE_ROTATE_BG
_gl_rotate_bg_set_file(bg, path, w, h);
- _gl_rotate_bg_rotate_image(bg, GL_ORIENTATION_ROT_0);
-#else
- elm_bg_file_set(bg, path, NULL);
- elm_bg_load_size_set(bg, w, h);
- evas_object_size_hint_max_set(bg, w, h);
- evas_object_size_hint_aspect_set(bg, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
- evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- evas_object_size_hint_align_set(bg, EVAS_HINT_FILL, EVAS_HINT_FILL);
-#endif
+ _gl_rotate_bg_rotate_image(bg, 0);
char *bs_style = GL_PHOTOFRAME_VIDEO;
if (zoom_level == GL_ZOOM_IN_ONE) {
#include "gl-controlbar.h"
#include "gallery.h"
#include "gl-icons.h"
-#ifdef _USE_ROTATE_BG
#include "gl-rotate-bg.h"
-#endif
#include "gl-gesture.h"
#include "gl-strings.h"
#include "gl-timeline.h"
GL_CHECK_NULL(obj);
Evas_Object *bg = NULL;
-#ifdef _USE_ROTATE_BG
bg = _gl_rotate_bg_add(obj, true);
-#else
- bg = elm_bg_add(obj);
-#endif
GL_CHECK_NULL(bg);
if (data) {
int hei = 0;
wid = (int)(GL_TILE_W * scale);
hei = (int)(GL_TILE_H * scale);
-#ifdef _USE_ROTATE_BG
_gl_rotate_bg_add_image(bg, wid, hei);
-#else
- elm_bg_load_size_set(bg, wid, hei);
-#endif
func(bg, data);
}
int widget_Destroy(widget_context_h context, widget_app_destroy_type_e reason, bundle *content, void *data)
{
-#if 0
- if (reason != WIDGET_APP_DESTROY_TYPE_PERMANENT) {
- // Save the current status at the bundle object.
- }
-#endif
struct widget_data *widget_data = NULL;
widget_data = (struct widget_data *)getWidgetData(context);