Pekka Lampila
2007-Oct-29 16:38 UTC
[Swfdec] libswfdec/swfdec_text_field_movie_as.c libswfdec/swfdec_text_field_movie.c
libswfdec/swfdec_text_field_movie.c | 10 ++++++++-- libswfdec/swfdec_text_field_movie_as.c | 4 ++-- 2 files changed, 10 insertions(+), 4 deletions(-) New commits: commit 8f0b361eaa2bc5ce89b19494bfe88f4786dbcd97 Author: Pekka Lampila <pekka.lampila at iki.fi> Date: Mon Oct 29 17:06:28 2007 +0200 Some more fixes to size handling in TextField diff --git a/libswfdec/swfdec_text_field_movie.c b/libswfdec/swfdec_text_field_movie.c index f10f529..13c5a75 100644 --- a/libswfdec/swfdec_text_field_movie.c +++ b/libswfdec/swfdec_text_field_movie.c @@ -783,6 +783,12 @@ swfdec_text_field_movie_get_text_size (SwfdecTextFieldMovie *text, int *width, *height += layouts[i].height; } + // align to get integer amount after TWIPS_TO_DOUBLE + if (width != NULL && *width % SWFDEC_TWIPS_SCALE_FACTOR != 0) + *width += SWFDEC_TWIPS_SCALE_FACTOR - *width % SWFDEC_TWIPS_SCALE_FACTOR; + if (height != NULL && *height % SWFDEC_TWIPS_SCALE_FACTOR != 0) + *height += SWFDEC_TWIPS_SCALE_FACTOR - *height % SWFDEC_TWIPS_SCALE_FACTOR; + swfdec_text_field_movie_free_layouts (layouts); } @@ -800,8 +806,8 @@ swfdec_text_field_movie_auto_size (SwfdecTextFieldMovie *text) return FALSE; swfdec_text_field_movie_get_text_size (text, &width, &height); - width += 2 * EXTRA_MARGIN; - height += 2 * EXTRA_MARGIN; + width += SWFDEC_DOUBLE_TO_TWIPS (2 * EXTRA_MARGIN); + height += SWFDEC_DOUBLE_TO_TWIPS (2 * EXTRA_MARGIN); if ((text->text->word_wrap || graphic->extents.x1 - graphic->extents.x0 == width) && diff --git a/libswfdec/swfdec_text_field_movie_as.c b/libswfdec/swfdec_text_field_movie_as.c index dd5203f..248d878 100644 --- a/libswfdec/swfdec_text_field_movie_as.c +++ b/libswfdec/swfdec_text_field_movie_as.c @@ -424,7 +424,7 @@ swfdec_text_field_movie_get_textHeight (SwfdecAsContext *cx, SWFDEC_AS_CHECK (SWFDEC_TYPE_TEXT_FIELD_MOVIE, &text, ""); swfdec_text_field_movie_get_text_size (text, NULL, &height); - SWFDEC_AS_VALUE_SET_NUMBER (ret, height); + SWFDEC_AS_VALUE_SET_NUMBER (ret, SWFDEC_TWIPS_TO_DOUBLE (height)); } static void @@ -438,7 +438,7 @@ swfdec_text_field_movie_get_textWidth (SwfdecAsContext *cx, SWFDEC_AS_CHECK (SWFDEC_TYPE_TEXT_FIELD_MOVIE, &text, ""); swfdec_text_field_movie_get_text_size (text, &width, NULL); - SWFDEC_AS_VALUE_SET_NUMBER (ret, width); + SWFDEC_AS_VALUE_SET_NUMBER (ret, SWFDEC_TWIPS_TO_DOUBLE (width)); } /*
Reasonably Related Threads
- 2 commits - libswfdec/swfdec_sound.c libswfdec/swfdec_text_field_movie_as.c libswfdec/swfdec_text_field_movie.c libswfdec/swfdec_text_field_movie_html.c
- 5 commits - libswfdec/swfdec_text_field.c libswfdec/swfdec_text_field_movie_as.c libswfdec/swfdec_text_field_movie.c libswfdec/swfdec_xml.c libswfdec/swfdec_xml_node.c
- 5 commits - libswfdec/swfdec_as_object.c libswfdec/swfdec_loader.c libswfdec/swfdec_style_sheet.c libswfdec/swfdec_text_field_movie_as.c libswfdec/swfdec_text_field_movie.c test/swfdec_test_test.c
- 3 commits - doc/Makefile.am libswfdec/swfdec_text_field_movie_as.c
- 4 commits - libswfdec/swfdec_sound_object.c libswfdec/swfdec_text_field_movie_as.c libswfdec/swfdec_text_field_movie.c test/crashfinder.c test/Makefile.am