search for: swfdec_twips_scale_factor

Displaying 20 results from an estimated 22 matches for "swfdec_twips_scale_factor".

2007 Oct 29
0
libswfdec/swfdec_text_field_movie_as.c libswfdec/swfdec_text_field_movie.c
...xt_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); }...
2007 Sep 13
0
test/swfdec-extract.c
...l. diff --git a/test/swfdec-extract.c b/test/swfdec-extract.c index 73e49fa..4c79a7f 100644 --- a/test/swfdec-extract.c +++ b/test/swfdec-extract.c @@ -201,7 +201,7 @@ export_graphic (SwfdecGraphic *graphic, cr = cairo_create (surface); cairo_translate (cr, - floor (graphic->extents.x0 / SWFDEC_TWIPS_SCALE_FACTOR), - floor (graphic->extents.y0 / SWFDEC_TWIPS_SCALE_FACTOR)); - cairo_scale (cr, 1 / SWFDEC_TWIPS_SCALE_FACTOR, 1 / SWFDEC_TWIPS_SCALE_FACTOR); + cairo_scale (cr, 1.0 / SWFDEC_TWIPS_SCALE_FACTOR, 1.0 / SWFDEC_TWIPS_SCALE_FACTOR); swfdec_graphic_render (graphic, cr, &trans, &gra...
2007 Jul 21
0
12 commits - configure.ac doc/Makefile.am doc/swfdec-sections.txt libswfdec/jpeg libswfdec/swfdec_as_array.c libswfdec/swfdec_as_object.c libswfdec/swfdec_as_strings.c libswfdec/swfdec_player.c libswfdec/swfdec_player.h libswfdec/swfdec_player_internal.h
...->stage_height - y); g_signal_emit (player, signals[INVALIDATE], 0, x, y, width, height); swfdec_rect_init_empty (&player->invalid); } @@ -736,8 +807,10 @@ swfdec_player_do_handle_mouse (SwfdecPla double x, double y, int button) { swfdec_player_lock (player); - x *= SWFDEC_TWIPS_SCALE_FACTOR; - y *= SWFDEC_TWIPS_SCALE_FACTOR; + x -= player->offset_x; + y -= player->offset_y; + x = x * SWFDEC_TWIPS_SCALE_FACTOR / player->scale_x; + y = y * SWFDEC_TWIPS_SCALE_FACTOR / player->scale_y; SWFDEC_LOG ("handling mouse at %g %g %d", x, y, button); if (player-&gt...
2007 Apr 13
0
5 commits - libswfdec/Makefile.am libswfdec/swfdec_color.c libswfdec/swfdec_color.h libswfdec/swfdec_font.c libswfdec/swfdec_loadertarget.c libswfdec/swfdec_movie.h libswfdec/swfdec_pattern.c libswfdec/swfdec_pattern.h libswfdec/swfdec_player.c
...oder.c @@ -194,9 +194,11 @@ swf_parse_header2 (SwfdecSwfDecoder * s) swfdec_bits_get_rect (&s->b, &rect); if (rect.x0 != 0.0 || rect.y0 != 0.0) - SWFDEC_ERROR ("SWF window doesn't start at 0 0 but at %g %g\n", rect.x0, rect.y0); - dec->width = ceil (rect.x1 / SWFDEC_TWIPS_SCALE_FACTOR); - dec->height = ceil (rect.y1 / SWFDEC_TWIPS_SCALE_FACTOR); + SWFDEC_ERROR ("SWF window doesn't start at 0 0 but at %g %g", rect.x0, rect.y0); + SWFDEC_INFO ("SWF size: %g x %g pixels", rect.x1 / SWFDEC_TWIPS_SCALE_FACTOR, + rect.y1 / SWFDEC_TWIPS_SCALE_FACTOR...
2007 Jun 10
0
Branch 'as' - 5 commits - libswfdec/swfdec_mouse_as.c libswfdec/swfdec_movie_asprops.c test/trace
...asprops.c b/libswfdec/swfdec_movie_asprops.c index ff5f416..c037a2c 100644 --- a/libswfdec/swfdec_movie_asprops.c +++ b/libswfdec/swfdec_movie_asprops.c @@ -327,7 +327,7 @@ mc_xmouse_get (SwfdecMovie *movie, Swfde double x, y; swfdec_movie_get_mouse (movie, &x, &y); - x = rint (x * SWFDEC_TWIPS_SCALE_FACTOR) / SWFDEC_TWIPS_SCALE_FACTOR; + x = SWFDEC_TWIPS_TO_DOUBLE (rint (x)); SWFDEC_AS_VALUE_SET_NUMBER (rval, x); } @@ -337,7 +337,7 @@ mc_ymouse_get (SwfdecMovie *movie, Swfde double x, y; swfdec_movie_get_mouse (movie, &x, &y); - y = rint (y * SWFDEC_TWIPS_SCALE_FACTOR) / SWFDE...
2007 Aug 22
0
8 commits - libswfdec/swfdec_movie.c libswfdec/swfdec_movie.h libswfdec/swfdec_player.c libswfdec/swfdec_player_internal.h libswfdec/swfdec_sprite_movie_as.c vivified/core
...ovie_rect, &other_rect)); } else if (argc >= 2) { - SwfdecRect movie_rect; double x, y; + gboolean shape, ret; - x = swfdec_as_value_to_number (cx, &argv[0]); - y = swfdec_as_value_to_number (cx, &argv[1]); + x = swfdec_as_value_to_number (cx, &argv[0]) * SWFDEC_TWIPS_SCALE_FACTOR; + y = swfdec_as_value_to_number (cx, &argv[1]) * SWFDEC_TWIPS_SCALE_FACTOR; + shape = (argc >= 3 && swfdec_as_value_to_boolean (cx, &argv[2])); - if (argc >= 3) { - if (swfdec_as_value_to_boolean (cx, &argv[2])) { - SWFDEC_FIXME ("hitTest's shapeF...
2007 Dec 13
0
libswfdec-gtk/swfdec_gtk_player.c libswfdec/swfdec_as_date.c libswfdec/swfdec_audio.c libswfdec/swfdec_audio_event.c libswfdec/swfdec_button_movie.c libswfdec/swfdec_interval.c libswfdec/swfdec_key_as.c libswfdec/swfdec_mouse_as.c libswfdec/swfdec_movie.c
...andle_mouse (SwfdecPlayer *player, void swfdec_player_global_to_stage (SwfdecPlayer *player, double *x, double *y) { + SwfdecPlayerPrivate *priv = player->priv; + g_return_if_fail (SWFDEC_IS_PLAYER (player)); g_return_if_fail (x != NULL); g_return_if_fail (y != NULL); - *x = *x / SWFDEC_TWIPS_SCALE_FACTOR * player->scale_x + player->offset_x; - *y = *y / SWFDEC_TWIPS_SCALE_FACTOR * player->scale_y + player->offset_y; + *x = *x / SWFDEC_TWIPS_SCALE_FACTOR * priv->scale_x + priv->offset_x; + *y = *y / SWFDEC_TWIPS_SCALE_FACTOR * priv->scale_y + priv->offset_y; } void sw...
2007 Dec 03
0
12 commits - libswfdec/Makefile.am libswfdec/swfdec_as_strings.c libswfdec/swfdec_as_types.c libswfdec/swfdec_as_types.h libswfdec/swfdec_gradient_pattern.c libswfdec/swfdec_gradient_pattern.h libswfdec/swfdec_movie_as_drawing.c libswfdec/swfdec_pattern.c
...t *cx = o->context; + SwfdecAsValue val; + + /* FIXME: This function does not call valueOf in the right order */ + if (swfdec_as_object_get_variable (o, SWFDEC_AS_STR_matrixType, &val)) { + const char *s = swfdec_as_value_to_string (cx, &val); + cairo_matrix_init_translate (mat, SWFDEC_TWIPS_SCALE_FACTOR / 2.0, SWFDEC_TWIPS_SCALE_FACTOR / 2.0); + cairo_matrix_scale (mat, SWFDEC_TWIPS_SCALE_FACTOR / 32768.0, SWFDEC_TWIPS_SCALE_FACTOR / 32768.0); + if (s == SWFDEC_AS_STR_box) { + double x, y, w, h, r; + cairo_matrix_t input; + swfdec_as_object_get_variable (o, SWFDEC_AS_STR_x, &a...
2007 Mar 22
0
7 commits - configure.ac doc/swfdec-docs.sgml libswfdec/js libswfdec/swfdec_buffer.c libswfdec/swfdec_buffer.h libswfdec/swfdec_js_movie.c test/trace
...e; - movie = JS_GetPrivate (cx, obj); - g_assert (movie); + movie = swfdec_scriptable_from_object (cx, obj, SWFDEC_TYPE_MOVIE); + if (movie == NULL) { + SWFDEC_WARNING ("not a movie"); + return JS_TRUE; + } swfdec_movie_get_mouse (movie, &x, &y); x = rint (x * SWFDEC_TWIPS_SCALE_FACTOR) / SWFDEC_TWIPS_SCALE_FACTOR; @@ -1102,8 +1225,11 @@ mc_ymouse_get (JSContext *cx, JSObject * double x, y; SwfdecMovie *movie; - movie = JS_GetPrivate (cx, obj); - g_assert (movie); + movie = swfdec_scriptable_from_object (cx, obj, SWFDEC_TYPE_MOVIE); + if (movie == NULL) { + SWFDEC_...
2007 Nov 12
0
13 commits - libswfdec/Makefile.am libswfdec/swfdec_decoder.c libswfdec/swfdec_decoder.h libswfdec/swfdec_flv_decoder.c libswfdec/swfdec_flv_decoder.h libswfdec/swfdec_image.c libswfdec/swfdec_image_decoder.c libswfdec/swfdec_image_decoder.h
...ot; #include "swfdec_sprite.h" @@ -128,6 +129,12 @@ swfdec_movie_update_extents (SwfdecMovie *movie) SwfdecRect *extents = &movie->extents; *rect = movie->draw_extents; + if (movie->image) { + SwfdecRect image_extents = { 0, 0, + movie->image->width * SWFDEC_TWIPS_SCALE_FACTOR, + movie->image->height * SWFDEC_TWIPS_SCALE_FACTOR }; + swfdec_rect_union (rect, rect, &image_extents); + } for (walk = movie->list; walk; walk = walk->next) { swfdec_rect_union (rect, rect, &SWFDEC_MOVIE (walk->data)->extents); } @@ -880,6 +887,20 @@...
2007 Feb 17
0
2 commits - doc/swfdec-sections.txt libswfdec/swfdec_color.h libswfdec/swfdec_player.c libswfdec/swfdec_player.h libswfdec/swfdec_player_internal.h libswfdec/swfdec_sprite.c libswfdec/swfdec_sprite.h libswfdec/swfdec_sprite_movie.c
...= SWFDEC_COLOR_COMBINE (0xFF, 0xFF, 0xFF, 0xFF); player->mouse_visible = TRUE; player->mouse_cursor = SWFDEC_MOUSE_CURSOR_NORMAL; @@ -1154,14 +1164,8 @@ swfdec_player_render (SwfdecPlayer *play cairo_rectangle (cr, x, y, width, height); cairo_clip (cr); cairo_scale (cr, 1.0 / SWFDEC_TWIPS_SCALE_FACTOR, 1.0 / SWFDEC_TWIPS_SCALE_FACTOR); - /* FIXME: find a nicer way to render the background */ - if (player->roots == NULL || - !SWFDEC_IS_SPRITE_MOVIE (player->roots->data) || - !swfdec_sprite_movie_paint_background (SWFDEC_SPRITE_MOVIE (player->roots->data), cr)) { - SW...
2007 Mar 02
0
12 commits - libswfdec/Makefile.am libswfdec/swfdec_audio_flv.c libswfdec/swfdec_flv_decoder.c libswfdec/swfdec_js.c libswfdec/swfdec_js.h libswfdec/swfdec_js_video.c libswfdec/swfdec_loader.c libswfdec/swfdec_loader_internal.h
...git a/libswfdec/swfdec_video_movie.c b/libswfdec/swfdec_video_movie.c index 49e1f4d..cf74a92 100644 --- a/libswfdec/swfdec_video_movie.c +++ b/libswfdec/swfdec_video_movie.c @@ -46,7 +46,9 @@ swfdec_video_movie_render (SwfdecMovie * if (movie->image == NULL) return; - cairo_scale (cr, SWFDEC_TWIPS_SCALE_FACTOR, SWFDEC_TWIPS_SCALE_FACTOR); + cairo_scale (cr, + (mov->original_extents.x1 - mov->original_extents.x0) / movie->image_width, + (mov->original_extents.y1 - mov->original_extents.y0) / movie->image_height); cairo_set_source_surface (cr, movie->image, 0.0, 0.0);...
2007 Jun 13
0
Branch 'as' - libswfdec/swfdec_swf_decoder.c
...set it to 1 diff --git a/libswfdec/swfdec_swf_decoder.c b/libswfdec/swfdec_swf_decoder.c index 66c6e34..33fb719 100644 --- a/libswfdec/swfdec_swf_decoder.c +++ b/libswfdec/swfdec_swf_decoder.c @@ -239,6 +239,10 @@ swf_parse_header2 (SwfdecSwfDecoder * s) dec->height = MAX (0, ceil (rect.y1 / SWFDEC_TWIPS_SCALE_FACTOR)); swfdec_bits_syncbits (&s->b); dec->rate = swfdec_bits_get_u16 (&s->b); + if (dec->rate == 0) { + SWFDEC_INFO ("rate is 0, setting to 1"); + dec->rate = 1; + } SWFDEC_LOG ("rate = %g", dec->rate / 256.0); dec->frames_total = swf...
2007 Feb 19
0
2 commits - libswfdec/swfdec_script.c test/swfdec-extract.c
...rinterr ("Sprites can not be exported\n"); return FALSE; } if (SWFDEC_IS_BUTTON (graphic)) { - g_printerr ("Buttons can not be exported"); + g_printerr ("Buttons can not be exported\n"); return FALSE; } width = ceil (graphic->extents.x1 / SWFDEC_TWIPS_SCALE_FACTOR)
2007 Feb 19
0
22 commits - libswfdec/js libswfdec/swfdec_debugger.c libswfdec/swfdec_js.c libswfdec/swfdec_js_global.c libswfdec/swfdec_js_movie.c libswfdec/swfdec_movie.c libswfdec/swfdec_player.c libswfdec/swfdec_player_internal.h libswfdec/swfdec_script.c
...mc_rotation_set (JSContext *cx, JSObject } static JSBool +mc_xmouse_get (JSContext *cx, JSObject *obj, jsval id, jsval *vp) +{ + double x, y; + SwfdecMovie *movie; + + movie = JS_GetPrivate (cx, obj); + g_assert (movie); + + swfdec_movie_get_mouse (movie, &x, &y); + x = rint (x * SWFDEC_TWIPS_SCALE_FACTOR) / SWFDEC_TWIPS_SCALE_FACTOR; + return JS_NewNumberValue (cx, x, vp); +} + +static JSBool +mc_ymouse_get (JSContext *cx, JSObject *obj, jsval id, jsval *vp) +{ + double x, y; + SwfdecMovie *movie; + + movie = JS_GetPrivate (cx, obj); + g_assert (movie); + + swfdec_movie_get_mouse (movie, &amp...
2008 Jan 07
0
12 commits - configure.ac doc/swfdec.types Makefile.am test/crashfinder.c test/dump.c test/Makefile.am test/swfdec-extract.c test/swfdec_out.c test/swfdec_out.h test/swfedit.c test/swfedit_file.c test/swfedit_file.h test/swfedit_list.c test/swfedit_list.h
..., 256, 0 }; - - if (SWFDEC_IS_SPRITE (graphic)) { - g_printerr ("Sprites can not be exported\n"); - return FALSE; - } - if (SWFDEC_IS_BUTTON (graphic)) { - g_printerr ("Buttons can not be exported\n"); - return FALSE; - } - width = ceil (graphic->extents.x1 / SWFDEC_TWIPS_SCALE_FACTOR) - - floor (graphic->extents.x0 / SWFDEC_TWIPS_SCALE_FACTOR); - height = ceil (graphic->extents.y1 / SWFDEC_TWIPS_SCALE_FACTOR) - - floor (graphic->extents.y0 / SWFDEC_TWIPS_SCALE_FACTOR); - surface = surface_create_for_filename (filename, width, height); - cr = cairo_create (su...
2007 Dec 10
0
6 commits - libswfdec/Makefile.am libswfdec/swfdec_as_interpret.c libswfdec/swfdec_color_as.c libswfdec/swfdec_graphic_movie.c libswfdec/swfdec_image_decoder.c libswfdec/swfdec_morph_movie.c libswfdec/swfdec_movie_as_drawing.c
...use_move (SwfdecMovie *movie, double x, double y) } static void +swfdec_movie_do_invalidate (SwfdecMovie *movie, const cairo_matrix_t *matrix, gboolean last) +{ + GList *walk; + SwfdecRect rect; + + if (movie->image) { + rect.x0 = rect.y0 = 0; + rect.x1 = movie->image->width * SWFDEC_TWIPS_SCALE_FACTOR; + rect.y1 = movie->image->height * SWFDEC_TWIPS_SCALE_FACTOR; + } else { + swfdec_rect_init_empty (&rect); + } + swfdec_rect_union (&rect, &rect, &movie->draw_extents); + swfdec_rect_transform (&rect, &rect, matrix); + swfdec_player_invalidate (SWFDEC_PL...
2007 Jun 12
0
Branch 'as' - 3 commits - libswfdec/swfdec_as_array.c libswfdec/swfdec_as_context.c libswfdec/swfdec_as_math.c libswfdec/swfdec_as_native_function.c libswfdec/swfdec_as_number.c libswfdec/swfdec_as_object.c libswfdec/swfdec_as_string.c
...argv[4]); + rect.x0 = swfdec_as_value_to_number (cx, &argv[1]); + rect.y0 = swfdec_as_value_to_number (cx, &argv[2]); + rect.x1 = swfdec_as_value_to_number (cx, &argv[3]); + rect.y1 = swfdec_as_value_to_number (cx, &argv[4]); swfdec_rect_scale (&rect, &rect, SWFDEC_TWIPS_SCALE_FACTOR); swfdec_player_set_drag_movie (player, movie, center, &rect); } else { @@ -227,13 +238,15 @@ swfdec_sprite_movie_startDrag (SwfdecAsO } static void -swfdec_sprite_movie_stopDrag (SwfdecAsObject *obj, guint argc, SwfdecAsValue *argv, SwfdecAsValue *rval) +swfdec_sprite_movie_stopDra...
2007 Jun 05
0
Branch 'as' - 8 commits - libswfdec/Makefile.am libswfdec/swfdec_as_context.c libswfdec/swfdec_as_frame.c libswfdec/swfdec_as_frame.h libswfdec/swfdec_as_interpret.c libswfdec/swfdec_as_number.c libswfdec/swfdec_as_scope.h
...ean center = FALSE; if (argc > 0) { @@ -213,11 +214,9 @@ swfdec_sprite_movie_startDrag (SwfdecAsO rect.x1 = swfdec_as_value_to_number (obj->context, &argv[3]); rect.y1 = swfdec_as_value_to_number (obj->context, &argv[4]); swfdec_rect_scale (&rect, &rect, SWFDEC_TWIPS_SCALE_FACTOR); - swfdec_player_set_drag_movie (SWFDEC_ROOT_MOVIE (movie->root)->player, movie, - center, &rect); + swfdec_player_set_drag_movie (player, movie, center, &rect); } else { - swfdec_player_set_drag_movie (SWFDEC_ROOT_MOVIE (movie->root)->player, movie, - center, NULL)...
2008 Jan 01
0
4 commits - libswfdec/swfdec_as_internal.h libswfdec/swfdec_as_object.c libswfdec/swfdec_as_types.c libswfdec/swfdec_as_types.h libswfdec/swfdec_sprite_movie_as.c test/trace
...|| !SWFDEC_AS_VALUE_IS_NUMBER (xv)) + return; + yv = swfdec_as_object_peek_variable (o, SWFDEC_AS_STR_y); + if (yv == NULL || !SWFDEC_AS_VALUE_IS_NUMBER (yv)) + return; + + x = SWFDEC_AS_VALUE_GET_NUMBER (xv); + y = SWFDEC_AS_VALUE_GET_NUMBER (yv); + x = swfdec_as_double_to_integer (x * SWFDEC_TWIPS_SCALE_FACTOR); + y = swfdec_as_double_to_integer (y * SWFDEC_TWIPS_SCALE_FACTOR); + swfdec_movie_local_to_global (movie, &x, &y); + SWFDEC_AS_VALUE_SET_NUMBER (xv, SWFDEC_TWIPS_TO_DOUBLE ((SwfdecTwips) x)); + SWFDEC_AS_VALUE_SET_NUMBER (yv, SWFDEC_TWIPS_TO_DOUBLE ((SwfdecTwips) y)); } SWFDEC_AS_...