gnash-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnash-commit] gnash ChangeLog server/fontlib.cpp server/movie...


From: Sandro Santilli
Subject: [Gnash-commit] gnash ChangeLog server/fontlib.cpp server/movie...
Date: Wed, 18 Oct 2006 14:23:27 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Sandro Santilli <strk>  06/10/18 14:23:27

Modified files:
        .              : ChangeLog 
        server         : fontlib.cpp movie_root.cpp 

Log message:
                * server/: fontlib.cpp, movie_root.cpp: don't directly access   
                  rect "to-be" private members.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.1298&r2=1.1299
http://cvs.savannah.gnu.org/viewcvs/gnash/server/fontlib.cpp?cvsroot=gnash&r1=1.23&r2=1.24
http://cvs.savannah.gnu.org/viewcvs/gnash/server/movie_root.cpp?cvsroot=gnash&r1=1.16&r2=1.17

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.1298
retrieving revision 1.1299
diff -u -b -r1.1298 -r1.1299
--- ChangeLog   18 Oct 2006 14:17:58 -0000      1.1298
+++ ChangeLog   18 Oct 2006 14:23:27 -0000      1.1299
@@ -1,5 +1,7 @@
 2006-10-18 Sandro Santilli <address@hidden>
 
+       * server/: fontlib.cpp, movie_root.cpp: don't directly access
+         rect "to-be" private members.
        * gui/gtk.cpp: don't directly access rect "to-be" private members.
        * server/rect.h: added shift_x, shift_y, scale_x and scale_x
          methods (toward making data members private).

Index: server/fontlib.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/fontlib.cpp,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -b -r1.23 -r1.24
--- server/fontlib.cpp  8 Oct 2006 16:11:37 -0000       1.23
+++ server/fontlib.cpp  18 Oct 2006 14:23:27 -0000      1.24
@@ -1,11 +1,11 @@
-// fontlib.cpp -- Thatcher Ulrich <address@hidden> 2003
+
 
 // This source code has been donated to the Public Domain.  Do
 // whatever you want with it.
 
 // A module to take care of all of gnash's loaded fonts.
 
-/* $Id: fontlib.cpp,v 1.23 2006/10/08 16:11:37 nihilus Exp $ */
+/* $Id: fontlib.cpp,v 1.24 2006/10/18 14:23:27 strk Exp $ */
 
 #include "container.h"
 #include "tu_file.h"
@@ -126,6 +126,9 @@
 
 
        // Integer-bounded 2D rectangle.
+       // 
+       // TODO: make the gnash::rect a templated class instead
+       //
        class recti
        {
        public:
@@ -548,13 +551,13 @@
                float   offset_y = s_rendering_box;
                rect    glyph_bounds;
                sh->compute_bound(&glyph_bounds);
-               if (glyph_bounds.m_x_min < 0)
+               if (glyph_bounds.get_x_min() < 0)
                {
-                       offset_x = - glyph_bounds.m_x_min;
+                       offset_x = - glyph_bounds.get_x_min();
                }
-               if (glyph_bounds.m_y_max > 0)
+               if (glyph_bounds.get_y_max() > 0)
                {
-                       offset_y = s_rendering_box - glyph_bounds.m_y_max;
+                       offset_y = s_rendering_box - glyph_bounds.get_y_max();
                }
 
                s_render_matrix.set_identity();
@@ -694,9 +697,9 @@
                                tg = identical_tg;
 
                                // Use our own offset, in case it's different.
-                               tg.m_uv_origin.m_x = tg.m_uv_bounds.m_x_min
+                               tg.m_uv_origin.m_x = tg.m_uv_bounds.get_x_min()
                                        + rgi.m_offset_x / 
GLYPH_CACHE_TEXTURE_SIZE;
-                               tg.m_uv_origin.m_y = tg.m_uv_bounds.m_y_min
+                               tg.m_uv_origin.m_y = tg.m_uv_bounds.get_y_min()
                                        + rgi.m_offset_y / 
GLYPH_CACHE_TEXTURE_SIZE;
 
                                if (identical_tg.is_renderable())
@@ -830,10 +833,14 @@
                                        texture_glyph   tg;
                                        tg.m_uv_origin.m_x = (pack_x + 
rgi.m_offset_x) / (GLYPH_CACHE_TEXTURE_SIZE);
                                        tg.m_uv_origin.m_y = (pack_y + 
rgi.m_offset_y) / (GLYPH_CACHE_TEXTURE_SIZE);
-                                       tg.m_uv_bounds.m_x_min = float(pack_x) 
/ (GLYPH_CACHE_TEXTURE_SIZE);
-                                       tg.m_uv_bounds.m_x_max = float(pack_x + 
width) / (GLYPH_CACHE_TEXTURE_SIZE);
-                                       tg.m_uv_bounds.m_y_min = float(pack_y) 
/ (GLYPH_CACHE_TEXTURE_SIZE);
-                                       tg.m_uv_bounds.m_y_max = float(pack_y + 
height) / (GLYPH_CACHE_TEXTURE_SIZE);
+                                       tg.m_uv_bounds.enclose_point(
+                                               float(pack_x) / 
(GLYPH_CACHE_TEXTURE_SIZE),
+                                               float(pack_y) / 
(GLYPH_CACHE_TEXTURE_SIZE)
+                                       );
+                                       tg.m_uv_bounds.expand_to_point(
+                                               float(pack_x + width) / 
(GLYPH_CACHE_TEXTURE_SIZE),
+                                               float(pack_y + height) / 
(GLYPH_CACHE_TEXTURE_SIZE)
+                                       );
 
                                        // Fill in bitmap info and push into 
the source font later.
                                        s_pending_glyphs.push_back(
@@ -1058,9 +1065,9 @@
                                        out->write_le16((uint16_t) (bi - 
bitmaps_used_base));
 
                                        // save rect, position.
-                                       
out->write_float32(tg.m_uv_bounds.m_x_min);
-                                       
out->write_float32(tg.m_uv_bounds.m_y_min);
-                                       
out->write_float32(tg.m_uv_bounds.m_x_max);
+                                       
out->write_float32(tg.m_uv_bounds.get_x_min());
+                                       
out->write_float32(tg.m_uv_bounds.get_y_min());
+                                       
out->write_float32(tg.m_uv_bounds.get_x_max());
                                        
out->write_float32(tg.m_uv_bounds.m_y_max);
                                        out->write_float32(tg.m_uv_origin.m_x);
                                        out->write_float32(tg.m_uv_origin.m_y);
@@ -1186,10 +1193,12 @@
                                tg.set_bitmap_info(owner->get_bitmap_info(bi + 
bitmaps_used_base));
 
                                // load glyph bounds and origin.
-                               tg.m_uv_bounds.m_x_min = in->read_float32();
-                               tg.m_uv_bounds.m_y_min = in->read_float32();
-                               tg.m_uv_bounds.m_x_max = in->read_float32();
-                               tg.m_uv_bounds.m_y_max = in->read_float32();
+                               float xmin = in->read_float32();
+                               float ymin = in->read_float32();
+                               float xmax = in->read_float32();
+                               float ymax = in->read_float32();
+                               tg.m_uv_bounds.enclose_point(xmin, ymin);
+                               tg.m_uv_bounds.expand_to_point(xmax, ymax);
                                tg.m_uv_origin.m_x = in->read_float32();
                                tg.m_uv_origin.m_y = in->read_float32();
 
@@ -1300,19 +1309,15 @@
                // @@ worth it to precompute these bounds?
 
                rect    bounds = tg.m_uv_bounds;
-               bounds.m_x_min -= tg.m_uv_origin.m_x;
-               bounds.m_x_max -= tg.m_uv_origin.m_x;
-               bounds.m_y_min -= tg.m_uv_origin.m_y;
-               bounds.m_y_max -= tg.m_uv_origin.m_y;
+               bounds.shift_x (-tg.m_uv_origin.m_x);
+               bounds.shift_y (-tg.m_uv_origin.m_y);
 
                // Scale from uv coords to the 1024x1024 glyph square.
                // @@ need to factor this out!
                static float    s_scale = GLYPH_CACHE_TEXTURE_SIZE * 
s_rendering_box / nominal_glyph_height;
 
-               bounds.m_x_min *= s_scale;
-               bounds.m_x_max *= s_scale;
-               bounds.m_y_min *= s_scale;
-               bounds.m_y_max *= s_scale;
+               bounds.scale_x(s_scale);
+               bounds.scale_y(s_scale);
                
                render::draw_bitmap(mat, tg.m_bitmap_info.get_ptr(), bounds, 
tg.m_uv_bounds, color);
        }

Index: server/movie_root.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/movie_root.cpp,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -b -r1.16 -r1.17
--- server/movie_root.cpp       16 Oct 2006 14:16:53 -0000      1.16
+++ server/movie_root.cpp       18 Oct 2006 14:23:27 -0000      1.17
@@ -434,12 +434,15 @@
 
     const rect& frame_size = m_def->get_frame_size();
 
+       // null frame size ? don't display !
+       if ( frame_size.is_null() ) return;
+
     gnash::render::begin_display(
         m_background_color,
         m_viewport_x0, m_viewport_y0,
         m_viewport_width, m_viewport_height,
-        frame_size.m_x_min, frame_size.m_x_max,
-        frame_size.m_y_min, frame_size.m_y_max);
+        frame_size.get_x_min(), frame_size.get_x_max(),
+        frame_size.get_y_min(), frame_size.get_y_max());
 
     m_movie->display();
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]