[Swfdec] 2 commits - libswfdec/swfdec_resource.c libswfdec/swfdec_text_field_movie.c
Pekka Lampila
medar at kemper.freedesktop.org
Wed Nov 7 14:33:39 PST 2007
libswfdec/swfdec_resource.c | 1 +
libswfdec/swfdec_text_field_movie.c | 26 ++++++++++++++++----------
2 files changed, 17 insertions(+), 10 deletions(-)
New commits:
commit 4ff1496e5f2b1a38e4cf51232ebae71172bba13a
Author: Pekka Lampila <pekka.lampila at iki.fi>
Date: Thu Nov 8 00:27:06 2007 +0200
Fix compiler warning in swfdec_resource_loader_target_error
diff --git a/libswfdec/swfdec_resource.c b/libswfdec/swfdec_resource.c
index d6b5703..18abce4 100644
--- a/libswfdec/swfdec_resource.c
+++ b/libswfdec/swfdec_resource.c
@@ -275,6 +275,7 @@ swfdec_resource_loader_target_error (SwfdecLoaderTarget *target, SwfdecLoader *l
case SWFDEC_RESOURCE_NEW:
case SWFDEC_RESOURCE_COMPLETE:
case SWFDEC_RESOURCE_DONE:
+ default:
g_assert_not_reached ();
message = SWFDEC_AS_STR_EMPTY;
break;
commit ac6e33e3bac8b999c38dd8454c4b9978f2dd3bd8
Author: Pekka Lampila <pekka.lampila at iki.fi>
Date: Thu Nov 8 00:23:26 2007 +0200
Fixes to TextField's scrolling
diff --git a/libswfdec/swfdec_text_field_movie.c b/libswfdec/swfdec_text_field_movie.c
index 3668346..043efec 100644
--- a/libswfdec/swfdec_text_field_movie.c
+++ b/libswfdec/swfdec_text_field_movie.c
@@ -137,7 +137,12 @@ swfdec_text_field_movie_generate_paragraph (SwfdecTextFieldMovie *text,
paragraph->index_ = start_index;
paragraph->length = length;
- paragraph->newline = (text->input->str[start_index + length - 1] == '\n');
+ if (text->input->str[start_index + length - 1] == '\n' ||
+ text->input->str[start_index + length - 1] == '\r') {
+ paragraph->newline = TRUE;
+ } else {
+ paragraph->newline = FALSE;
+ }
paragraph->blocks = NULL;
paragraph->attrs = NULL;
@@ -748,7 +753,8 @@ swfdec_text_field_movie_render (SwfdecMovie *movie, cairo_t *cr,
first = TRUE;
linenum = 0;
- x = movie->original_extents.x0 + EXTRA_MARGIN + text_movie->hscroll;
+ x = movie->original_extents.x0 + EXTRA_MARGIN +
+ MIN (text_movie->hscroll, text_movie->hscroll_max);
y = movie->original_extents.y0 + EXTRA_MARGIN;
for (i = 0; layouts[i].layout != NULL && y < limit.y1; i++)
@@ -761,7 +767,8 @@ swfdec_text_field_movie_render (SwfdecMovie *movie, cairo_t *cr,
iter_line = pango_layout_get_iter (layout->layout);
- if (layout->bullet && linenum + 1 >= text_movie->scroll) {
+ if (layout->bullet && linenum + 1 >=
+ MIN (text_movie->scroll, text_movie->scroll_max)) {
PangoColor color_p;
PangoAttribute *attr;
PangoAttrIterator *attr_iter;
@@ -794,13 +801,13 @@ swfdec_text_field_movie_render (SwfdecMovie *movie, cairo_t *cr,
skipped = 0;
do {
- if (++linenum < text_movie->scroll)
+ if (++linenum < MIN (text_movie->scroll, text_movie->scroll_max))
continue;
pango_layout_iter_get_line_extents (iter_line, NULL, &rect);
pango_extents_to_pixels (NULL, &rect);
- if (linenum == text_movie->scroll)
+ if (linenum == MIN (text_movie->scroll, text_movie->scroll_max))
skipped = rect.y;
if (!first && y + rect.y + rect.height > movie->original_extents.y1)
@@ -828,7 +835,7 @@ swfdec_text_field_movie_render (SwfdecMovie *movie, cairo_t *cr,
cairo_rel_move_to (cr, 0, -layout->last_line_offset_y);
} while (pango_layout_iter_next_line (iter_line));
- if (linenum >= text_movie->scroll) {
+ if (linenum >= MIN (text_movie->scroll, text_movie->scroll_max)) {
cairo_rel_move_to (cr, 0, layout->height - skipped);
y += layout->height - skipped;
skipped = 0;
@@ -917,10 +924,9 @@ swfdec_text_field_movie_update_scroll (SwfdecTextFieldMovie *text,
text->scroll_changed = TRUE;
}
} else {
- if (text->scroll_bottom != MAX (CLAMP(text->scroll, 1, text->scroll_max) +
- (visible > 0 ? visible - 1 : 0), text->scroll)) {
- text->scroll_bottom = MAX (CLAMP(text->scroll, 1, text->scroll_max) +
- (visible > 0 ? visible - 1 : 0), text->scroll);
+ if (text->scroll_bottom < text->scroll ||
+ text->scroll_bottom > text->scroll_max + visible - 1) {
+ text->scroll_bottom = text->scroll;
text->scroll_changed = TRUE;
}
}
More information about the Swfdec
mailing list