summaryrefslogtreecommitdiff
path: root/src/lib/emile
diff options
context:
space:
mode:
authorjiin.moon <jiin.moon@samsung.com>2015-06-03 10:57:27 +0200
committerCedric BAIL <cedric@osg.samsung.com>2015-06-03 13:46:44 +0200
commit63a12d7d26f53b22b7794eb61897de930614bac7 (patch)
tree707c69c48c78d36524828931cf029cfd9edd54b2 /src/lib/emile
parent0c729faf688a518f10f75a890e7364d4f1e76939 (diff)
emile: fix region load for jpeg image with orientation different set.
Summary: If you try to load the jpeg image with an orientation mode defined using elm_photocam, you can see the broken image(in canse of 90 degree) or even segmentation fault can happen (in case of 180,270 degree) @fix Test Plan: photocam menu on elementary_test Reviewers: Hermet, cedric Subscribers: cedric Differential Revision: https://phab.enlightenment.org/D2593 Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
Diffstat (limited to 'src/lib/emile')
-rw-r--r--src/lib/emile/emile_image.c44
1 files changed, 22 insertions, 22 deletions
diff --git a/src/lib/emile/emile_image.c b/src/lib/emile/emile_image.c
index 018745cf12..dc1bed2d11 100644
--- a/src/lib/emile/emile_image.c
+++ b/src/lib/emile/emile_image.c
@@ -1048,7 +1048,7 @@ _rotate_region(unsigned int *r_x, unsigned int *r_y,
1048 else 1048 else
1049 { 1049 {
1050 *r_x = y; 1050 *r_x = y;
1051 *r_y = output_h - (x + y); 1051 *r_y = output_h - (x + w);
1052 *r_w = h; 1052 *r_w = h;
1053 *r_h = w; 1053 *r_h = w;
1054 } 1054 }
@@ -2124,7 +2124,7 @@ done:
2124 uint16_t *to16; 2124 uint16_t *to16;
2125 int hw; 2125 int hw;
2126 2126
2127 hw = w * h; 2127 hw = ie_w * ie_h;
2128 to = pixels; 2128 to = pixels;
2129 to8 = pixels; 2129 to8 = pixels;
2130 to16 = pixels; 2130 to16 = pixels;
@@ -2135,23 +2135,23 @@ done:
2135 if (prop->cspace == EMILE_COLORSPACE_GRY8) 2135 if (prop->cspace == EMILE_COLORSPACE_GRY8)
2136 { 2136 {
2137 if (prop->flipped) 2137 if (prop->flipped)
2138 _rotate_change_wh8(to8 + hw - 1, ptrg_rotate, w, h, hw - 1, -h); 2138 _rotate_change_wh8(to8 + hw - 1, ptrg_rotate, ie_w, ie_h, hw - 1, -ie_h);
2139 else 2139 else
2140 _rotate_change_wh8(to8 + h - 1, ptrg_rotate, w, h, -hw - 1, h); 2140 _rotate_change_wh8(to8 + ie_h - 1, ptrg_rotate, ie_w, ie_h, -hw - 1, ie_h);
2141 } 2141 }
2142 else if (prop->cspace == EMILE_COLORSPACE_AGRY88) 2142 else if (prop->cspace == EMILE_COLORSPACE_AGRY88)
2143 { 2143 {
2144 if (prop->flipped) 2144 if (prop->flipped)
2145 _rotate_change_wh16(to16 + hw - 1, ptrag_rotate, w, h, hw - 1, -h); 2145 _rotate_change_wh16(to16 + hw - 1, ptrag_rotate, ie_w, ie_h, hw - 1, -ie_h);
2146 else 2146 else
2147 _rotate_change_wh16(to16 + h - 1, ptrag_rotate, w, h, -hw - 1, h); 2147 _rotate_change_wh16(to16 + ie_h - 1, ptrag_rotate, ie_w, ie_h, -hw - 1, ie_h);
2148 } 2148 }
2149 else 2149 else
2150 { 2150 {
2151 if (prop->flipped) 2151 if (prop->flipped)
2152 _rotate_change_wh(to + hw - 1, ptr_rotate, w, h, hw - 1, -h); 2152 _rotate_change_wh(to + hw - 1, ptr_rotate, ie_w, ie_h, hw - 1, -ie_h);
2153 else 2153 else
2154 _rotate_change_wh(to + h - 1, ptr_rotate, w, h, -hw - 1, h); 2154 _rotate_change_wh(to + ie_h - 1, ptr_rotate, ie_w, ie_h, -hw - 1, ie_h);
2155 } 2155 }
2156 break; 2156 break;
2157 2157
@@ -2159,23 +2159,23 @@ done:
2159 if (prop->cspace == EMILE_COLORSPACE_GRY8) 2159 if (prop->cspace == EMILE_COLORSPACE_GRY8)
2160 { 2160 {
2161 if (prop->flipped) 2161 if (prop->flipped)
2162 _flip_vertical8(to8, w, h); 2162 _flip_vertical8(to8, ie_w, ie_h);
2163 else 2163 else
2164 _rotate8_180(to8, w, h); 2164 _rotate8_180(to8, ie_w, ie_h);
2165 } 2165 }
2166 else if (prop->cspace == EMILE_COLORSPACE_AGRY88) 2166 else if (prop->cspace == EMILE_COLORSPACE_AGRY88)
2167 { 2167 {
2168 if (prop->flipped) 2168 if (prop->flipped)
2169 _flip_vertical16(to16, w, h); 2169 _flip_vertical16(to16, ie_w, ie_h);
2170 else 2170 else
2171 _rotate16_180(to16, w, h); 2171 _rotate16_180(to16, ie_w, ie_h);
2172 } 2172 }
2173 else 2173 else
2174 { 2174 {
2175 if (prop->flipped) 2175 if (prop->flipped)
2176 _flip_vertical(to, w, h); 2176 _flip_vertical(to, ie_w, ie_h);
2177 else 2177 else
2178 _rotate_180(to, w, h); 2178 _rotate_180(to, ie_w, ie_h);
2179 } 2179 }
2180 break; 2180 break;
2181 2181
@@ -2183,23 +2183,23 @@ done:
2183 if (prop->cspace == EMILE_COLORSPACE_GRY8) 2183 if (prop->cspace == EMILE_COLORSPACE_GRY8)
2184 { 2184 {
2185 if (prop->flipped) 2185 if (prop->flipped)
2186 _rotate_change_wh8(to8, ptrg_rotate, w, h, -hw + 1, h); 2186 _rotate_change_wh8(to8, ptrg_rotate, ie_w, ie_h, -hw + 1, ie_h);
2187 else 2187 else
2188 _rotate_change_wh8(to8 + hw - h, ptrg_rotate, w, h, hw + 1, -h); 2188 _rotate_change_wh8(to8 + hw - ie_h, ptrg_rotate, ie_w, ie_h, hw + 1, -ie_h);
2189 } 2189 }
2190 else if (prop->cspace == EMILE_COLORSPACE_AGRY88) 2190 else if (prop->cspace == EMILE_COLORSPACE_AGRY88)
2191 { 2191 {
2192 if (prop->flipped) 2192 if (prop->flipped)
2193 _rotate_change_wh16(to16, ptrag_rotate, w, h, -hw + 1, h); 2193 _rotate_change_wh16(to16, ptrag_rotate, w, h, -hw + 1, h);
2194 else 2194 else
2195 _rotate_change_wh16(to16 + hw - h, ptrag_rotate, w, h, hw + 1, -h); 2195 _rotate_change_wh16(to16 + hw - ie_h, ptrag_rotate, ie_w, ie_h, hw + 1, -ie_h);
2196 } 2196 }
2197 else 2197 else
2198 { 2198 {
2199 if (prop->flipped) 2199 if (prop->flipped)
2200 _rotate_change_wh(to, ptr_rotate, w, h, -hw + 1, h); 2200 _rotate_change_wh(to, ptr_rotate, ie_w, ie_h, -hw + 1, ie_h);
2201 else 2201 else
2202 _rotate_change_wh(to + hw - h, ptr_rotate, w, h, hw + 1, -h); 2202 _rotate_change_wh(to + hw - ie_h, ptr_rotate, ie_w, ie_h, hw + 1, -ie_h);
2203 } 2203 }
2204 break; 2204 break;
2205 2205
@@ -2207,11 +2207,11 @@ done:
2207 if (prop->flipped) 2207 if (prop->flipped)
2208 { 2208 {
2209 if (prop->cspace == EMILE_COLORSPACE_GRY8) 2209 if (prop->cspace == EMILE_COLORSPACE_GRY8)
2210 _flip_horizontal8(to8, w, h); 2210 _flip_horizontal8(to8, ie_w, ie_h);
2211 else if (prop->cspace == EMILE_COLORSPACE_AGRY88) 2211 else if (prop->cspace == EMILE_COLORSPACE_AGRY88)
2212 _flip_horizontal16(to16, w, h); 2212 _flip_horizontal16(to16, ie_w, ie_h);
2213 else 2213 else
2214 _flip_horizontal(to, w, h); 2214 _flip_horizontal(to, ie_w, ie_h);
2215 } 2215 }
2216 break; 2216 break;
2217 } 2217 }