summaryrefslogtreecommitdiff
path: root/legacy/emotion/src/lib/emotion_smart.c
diff options
context:
space:
mode:
authorCedric BAIL <cedric.bail@free.fr>2011-09-02 13:10:22 +0000
committerCedric BAIL <cedric.bail@free.fr>2011-09-02 13:10:22 +0000
commit4f844f63f58c634c1b083ea6e450d484f11d7f7f (patch)
tree365064a81b00c35b5c0aa9f72852d6be318dda06 /legacy/emotion/src/lib/emotion_smart.c
parentd7771445b17ae5d00dcf99349a36c8fabb03485d (diff)
emotion: resize only when needed and fix typo.
SVN revision: 63089
Diffstat (limited to 'legacy/emotion/src/lib/emotion_smart.c')
-rw-r--r--legacy/emotion/src/lib/emotion_smart.c82
1 files changed, 11 insertions, 71 deletions
diff --git a/legacy/emotion/src/lib/emotion_smart.c b/legacy/emotion/src/lib/emotion_smart.c
index 1ad48fd73d..e5aa10ff2e 100644
--- a/legacy/emotion/src/lib/emotion_smart.c
+++ b/legacy/emotion/src/lib/emotion_smart.c
@@ -163,13 +163,13 @@ static void
163_emotion_image_data_zero(Evas_Object *img) 163_emotion_image_data_zero(Evas_Object *img)
164{ 164{
165 void *data; 165 void *data;
166 166
167 data = evas_object_image_data_get(img, 1); 167 data = evas_object_image_data_get(img, 1);
168 if (data) 168 if (data)
169 { 169 {
170 int w, h, sz = 0; 170 int w, h, sz = 0;
171 Evas_Colorspace cs; 171 Evas_Colorspace cs;
172 172
173 evas_object_image_size_get(img, &w, &h); 173 evas_object_image_size_get(img, &w, &h);
174 cs = evas_object_image_colorspace_get(img); 174 cs = evas_object_image_colorspace_get(img);
175 if (cs == EVAS_COLORSPACE_ARGB8888) 175 if (cs == EVAS_COLORSPACE_ARGB8888)
@@ -386,13 +386,10 @@ emotion_object_file_set(Evas_Object *obj, const char *file)
386 sd->module->file_close(sd->video); 386 sd->module->file_close(sd->video);
387 evas_object_image_data_set(sd->obj, NULL); 387 evas_object_image_data_set(sd->obj, NULL);
388 evas_object_image_size_set(sd->obj, 1, 1); 388 evas_object_image_size_set(sd->obj, 1, 1);
389 _emotion_image_data_zero(sd->obj);
389 sd->open = 0; 390 sd->open = 0;
390 if (!sd->module->file_open(sd->file, obj, sd->video)) 391 if (!sd->module->file_open(sd->file, obj, sd->video))
391 return EINA_FALSE; 392 return EINA_FALSE;
392 sd->module->size_get(sd->video, &w, &h);
393 evas_object_image_size_set(sd->obj, w, h);
394 _emotion_image_data_zero(sd->obj);
395 sd->ratio = sd->module->ratio_get(sd->video);
396 sd->pos = 0.0; 393 sd->pos = 0.0;
397 if (sd->play) sd->module->play(sd->video, 0.0); 394 if (sd->play) sd->module->play(sd->video, 0.0);
398 } 395 }
@@ -1242,7 +1239,6 @@ _emotion_frame_resize(Evas_Object *obj, int w, int h, double ratio)
1242 evas_object_image_size_get(sd->obj, &iw, &ih); 1239 evas_object_image_size_get(sd->obj, &iw, &ih);
1243 if ((w != iw) || (h != ih)) 1240 if ((w != iw) || (h != ih))
1244 { 1241 {
1245 evas_object_image_size_set(sd->obj, w, h);
1246 _emotion_image_data_zero(sd->obj); 1242 _emotion_image_data_zero(sd->obj);
1247 changed = 1; 1243 changed = 1;
1248 } 1244 }
@@ -1458,22 +1454,19 @@ _pixels_get(void *data, Evas_Object *obj)
1458 unsigned char *bgra_data; 1454 unsigned char *bgra_data;
1459 1455
1460 sd = data; 1456 sd = data;
1461 evas_object_image_size_get(obj, &iw, &ih);
1462 sd->module->video_data_size_get(sd->video, &w, &h); 1457 sd->module->video_data_size_get(sd->video, &w, &h);
1463 w = (w >> 1) << 1; 1458 w = (w >> 1) << 1;
1464 h = (h >> 1) << 1; 1459 h = (h >> 1) << 1;
1465 if ((w != iw) || (h != ih)) 1460
1461 evas_object_image_colorspace_set(obj, EVAS_COLORSPACE_YCBCR422P601_PL);
1462 evas_object_image_alpha_set(obj, 0);
1463 evas_object_image_size_set(obj, w, h);
1464 iw = w;
1465 ih = h;
1466
1467 if ((iw <= 1) || (ih <= 1))
1466 { 1468 {
1467 evas_object_image_colorspace_set(obj, EVAS_COLORSPACE_YCBCR422P601_PL);
1468 evas_object_image_alpha_set(obj, 0);
1469 evas_object_image_size_set(obj, w, h);
1470 _emotion_image_data_zero(sd->obj); 1469 _emotion_image_data_zero(sd->obj);
1471 iw = w;
1472 ih = h;
1473 }
1474 if ((iw < 1) || (ih < 1))
1475 {
1476// printf("pix get set 0 (1)\n");
1477 evas_object_image_pixels_dirty_set(obj, 0); 1470 evas_object_image_pixels_dirty_set(obj, 0);
1478 } 1471 }
1479 else 1472 else
@@ -1494,7 +1487,6 @@ _pixels_get(void *data, Evas_Object *obj)
1494 evas_object_image_data_update_add(obj, 0, 0, iw, ih); 1487 evas_object_image_data_update_add(obj, 0, 0, iw, ih);
1495 } 1488 }
1496 evas_object_image_data_set(obj, rows); 1489 evas_object_image_data_set(obj, rows);
1497// printf("pix get set 0 (2)\n");
1498 evas_object_image_pixels_dirty_set(obj, 0); 1490 evas_object_image_pixels_dirty_set(obj, 0);
1499 } 1491 }
1500 else if (format == EMOTION_FORMAT_BGRA) 1492 else if (format == EMOTION_FORMAT_BGRA)
@@ -1503,62 +1495,10 @@ _pixels_get(void *data, Evas_Object *obj)
1503 if (sd->module->bgra_data_get(sd->video, &bgra_data)) 1495 if (sd->module->bgra_data_get(sd->video, &bgra_data))
1504 { 1496 {
1505 evas_object_image_data_set(obj, bgra_data); 1497 evas_object_image_data_set(obj, bgra_data);
1506// printf("pix get set 0 (3)\n");
1507 evas_object_image_pixels_dirty_set(obj, 0); 1498 evas_object_image_pixels_dirty_set(obj, 0);
1508 } 1499 }
1509 } 1500 }
1510 } 1501 }
1511// no need for this because on any new frame decode info from the decoder
1512// module, the previous "current frame" is released (done) for us anyway
1513// sd->module->frame_done(sd->video);
1514
1515/*
1516 evas_object_image_size_get(obj, &iw, &ih);
1517 sd->module->video_data_size_get(sd->video, &w, &h);
1518 if ((w != iw) || (h != ih))
1519 {
1520 evas_object_image_size_set(obj, w, h);
1521 _emotion_image_data_zero(sd->obj);
1522 iw = w;
1523 ih = h;
1524 }
1525 format = sd->module->format_get(sd->video);
1526 if ((format == EMOTION_FORMAT_YV12) || (format == EMOTION_FORMAT_I420))
1527 {
1528 unsigned char **rows;
1529 Evas_Pixel_Import_Source ps;
1530
1531 ps.format = EVAS_PIXEL_FORMAT_YUV420P_601;
1532 ps.w = iw;
1533 ps.h = ih;
1534
1535 ps.rows = malloc(ps.h * 2 * sizeof(void *));
1536 if (!ps.rows)
1537 {
1538 sd->module->frame_done(sd->video);
1539 return;
1540 }
1541
1542 rows = (unsigned char **)ps.rows;
1543
1544 if (sd->module->yuv_rows_get(sd->video, iw, ih,
1545 rows,
1546 &rows[ps.h],
1547 &rows[ps.h + (ps.h / 2)]))
1548 evas_object_image_pixels_import(obj, &ps);
1549 evas_object_image_pixels_dirty_set(obj, 0);
1550 free(ps.rows);
1551 }
1552 else if (format == EMOTION_FORMAT_BGRA)
1553 {
1554 if (sd->module->bgra_data_get(sd->video, &bgra_data));
1555 {
1556 evas_object_image_data_set(obj, bgra_data);
1557 evas_object_image_pixels_dirty_set(obj, 0);
1558 }
1559 }
1560 sd->module->frame_done(sd->video);
1561 */
1562} 1502}
1563 1503
1564/*******************************************/ 1504/*******************************************/