CVSROOT: /cvsroot/gnash Module name: gnash Changes by: Udo Giacomozzi <udog> 07/08/29 17:34:07
Modified files: . : ChangeLog configure.ac backend : render_handler_agg.cpp render_handler_agg.h gui : fb.cpp Log message: fixes for PPC pixel formats CVSWeb URLs: http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.4148&r2=1.4149 http://cvs.savannah.gnu.org/viewcvs/gnash/configure.ac?cvsroot=gnash&r1=1.408&r2=1.409 http://cvs.savannah.gnu.org/viewcvs/gnash/backend/render_handler_agg.cpp?cvsroot=gnash&r1=1.102&r2=1.103 http://cvs.savannah.gnu.org/viewcvs/gnash/backend/render_handler_agg.h?cvsroot=gnash&r1=1.19&r2=1.20 http://cvs.savannah.gnu.org/viewcvs/gnash/gui/fb.cpp?cvsroot=gnash&r1=1.37&r2=1.38 Patches: Index: ChangeLog =================================================================== RCS file: /cvsroot/gnash/gnash/ChangeLog,v retrieving revision 1.4148 retrieving revision 1.4149 diff -u -b -r1.4148 -r1.4149 --- ChangeLog 29 Aug 2007 17:29:39 -0000 1.4148 +++ ChangeLog 29 Aug 2007 17:34:06 -0000 1.4149 @@ -1,3 +1,12 @@ +2007-08-29 Udo Giacomozzi <[EMAIL PROTECTED]> + + * configure.ac: added pixel formats ARGB32 and ABGR32; allow "all" value for + --with-pixelformat + * backend/render_handler_agg.cpp: implement the two new pixel formats and + check for the host endianess; some initial changes in AGG cache class which + currently is not used, however + * backend/render_handler_agg.h, gui/fb.cpp: updated comments + 2007-08-29 Sandro Santilli <[EMAIL PROTECTED]> * server/as_environment.cpp (get_variable): more verbosity in Index: configure.ac =================================================================== RCS file: /cvsroot/gnash/gnash/configure.ac,v retrieving revision 1.408 retrieving revision 1.409 diff -u -b -r1.408 -r1.409 --- configure.ac 27 Aug 2007 21:15:10 -0000 1.408 +++ configure.ac 29 Aug 2007 17:34:06 -0000 1.409 @@ -15,7 +15,7 @@ dnl Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA dnl -dnl $Id: configure.ac,v 1.408 2007/08/27 21:15:10 nihilus Exp $ +dnl $Id: configure.ac,v 1.409 2007/08/29 17:34:06 udog Exp $ AC_PREREQ(2.50) AC_INIT(gnash, cvs) @@ -358,12 +358,21 @@ while test -n "${withval}" ; do val=`echo ${withval} | cut -d ' ' -f 1` [case "${val}" in + all) + # allow special value "all" set by user (handled below) + ;; rgba32|RGBA32) AC_DEFINE(PIXELFORMAT_RGBA32, [1], [RGBA32]) ;; bgra32|BGRA32) AC_DEFINE(PIXELFORMAT_BGRA32, [1], [BGRA32]) ;; + argb32|ARGB32) + AC_DEFINE(PIXELFORMAT_ARGB32, [1], [ARGB32]) + ;; + abgr32|ABGR32) + AC_DEFINE(PIXELFORMAT_ABGR32, [1], [ABGR32]) + ;; rgb24|RGB24) AC_DEFINE(PIXELFORMAT_RGB24, [1], [RGB24]) ;; @@ -376,8 +385,7 @@ rgb565|RGB565) AC_DEFINE(PIXELFORMAT_RGB565, [1], [RGB565]) ;; - *) AC_MSG_ERROR([invalid pixel format ${withval} given (accept: RGB555|RG -B565|RGB24|BGR24|BGRA32|RGBA32)]) + *) AC_MSG_ERROR([invalid pixel format ${withval} given (accept: all|RGB555|RGB565|RGB24|BGR24|BGRA32|RGBA32|ARGB32|ABGR32)]) ;; esac] withval=`echo ${withval} | cut -d ' ' -f 2-6` @@ -401,6 +409,8 @@ AC_DEFINE(PIXELFORMAT_BGR24, [1], [BGR24 pixel format]) AC_DEFINE(PIXELFORMAT_RGBA32, [1], [RGBA32 pixel format]) AC_DEFINE(PIXELFORMAT_BGRA32, [1], [BGRA32 pixel format]) + AC_DEFINE(PIXELFORMAT_ARGB32, [1], [ARGB32 pixel format]) + AC_DEFINE(PIXELFORMAT_ABGR32, [1], [ABGR32 pixel format]) #fi fi fi Index: backend/render_handler_agg.cpp =================================================================== RCS file: /cvsroot/gnash/gnash/backend/render_handler_agg.cpp,v retrieving revision 1.102 retrieving revision 1.103 diff -u -b -r1.102 -r1.103 --- backend/render_handler_agg.cpp 29 Aug 2007 04:30:37 -0000 1.102 +++ backend/render_handler_agg.cpp 29 Aug 2007 17:34:06 -0000 1.103 @@ -17,7 +17,7 @@ -/* $Id: render_handler_agg.cpp,v 1.102 2007/08/29 04:30:37 nihilus Exp $ */ +/* $Id: render_handler_agg.cpp,v 1.103 2007/08/29 17:34:06 udog Exp $ */ // Original version by Udo Giacomozzi and Hannes Mayr, // INDUNET GmbH (www.indunet.it) @@ -189,6 +189,7 @@ namespace gnash { + // --- CACHE ------------------------------------------------------------------- /// This class holds a completely transformed path (fixed position). Speeds /// up characters that stay fixed on a certain position on the stage. @@ -196,21 +197,48 @@ class agg_transformed_path { +public: /// Original transformation matrix matrix m_mat; - /// Number of cache hits - int hits; + /// Normal or rounded coordinates? + bool m_rounded; - /// Number of cache misses - int misses; + /// Number of cache hits + int m_hits; - /// Contents of this cache item. First dimension is fill style - std::vector <std::vector <agg::path_storage> > data; + /// Contents of this cache item (AGG path). + std::vector <agg::path_storage> m_data; }; class agg_cache_manager : private render_cache_manager { + + std::vector <agg_transformed_path> m_items; + + /// Looks for a matching pre-computed path in the cache list + /// Returns NULL if no cache item matches + std::vector <agg::path_storage>* search(const matrix& mat, bool rounded) { + + size_t ccount = m_items.size(); + + for (size_t cno=0; cno<ccount; cno++) { + agg_transformed_path& item = m_items[cno]; + + if ((item.m_mat == mat) && (item.m_rounded == rounded)) { + + // Found it! + return &item.m_data; + + } + } + + // could not find a matching item + return NULL; + + } + + }; @@ -661,19 +689,12 @@ assert(m_pixf != NULL); assert(scale_set); - // clear the stage using the background color for (unsigned int i=0; i<_clipbounds.size(); i++) clear_framebuffer(_clipbounds[i], agg::rgba8_pre(background_color.m_r, background_color.m_g, background_color.m_b, background_color.m_a)); - // calculate final pixel scale - /*double scaleX, scaleY; - scaleX = (double)xres / (double)viewport_width / 20.0; // 20=TWIPS - scaleY = (double)yres / (double)viewport_height / 20.0; - scale = scaleX<scaleY ? scaleX : scaleY;*/ - // reset status variables m_drawing_mask = false; } @@ -2149,15 +2170,35 @@ +// detect the endianess of the host (would prefer to NOT have this function +// here) +bool is_little_endian_host() { + + union { + uint16_t word; + struct { + uint8_t b1; + uint8_t b2; + }; + } u; + + u.b1 = 1; + u.b2 = 2; + + return u.word == 0x0201; + +} -// TODO: Replace "pixelformat" with a enum! DSOEXPORT render_handler_agg_base* create_render_handler_agg(const char *pixelformat) { if (!pixelformat) return NULL; - log_msg("framebuffer pixel format is %s", pixelformat); + if (is_little_endian_host()) + log_msg("framebuffer pixel format is %s (little-endian host)", pixelformat); + else + log_msg("framebuffer pixel format is %s (big-endian host)", pixelformat); #ifdef PIXELFORMAT_RGB555 if (!strcmp(pixelformat, "RGB555")) @@ -2188,6 +2229,15 @@ #ifdef PIXELFORMAT_BGRA32 if (!strcmp(pixelformat, "BGRA32")) return new render_handler_agg<agg::pixfmt_bgra32_pre> (32); +#endif +#ifdef PIXELFORMAT_RGBA32 + if (!strcmp(pixelformat, "ARGB32")) + return new render_handler_agg<agg::pixfmt_argb32_pre> (32); + else +#endif +#ifdef PIXELFORMAT_BGRA32 + if (!strcmp(pixelformat, "ABGR32")) + return new render_handler_agg<agg::pixfmt_abgr32_pre> (32); else #endif @@ -2200,11 +2250,23 @@ return NULL; // avoid compiler warning } + DSOEXPORT char *agg_detect_pixel_format(unsigned int rofs, unsigned int rsize, unsigned int gofs, unsigned int gsize, unsigned int bofs, unsigned int bsize, unsigned int bpp) { + if (!is_little_endian_host()) { + + // Swap bits for big endian hosts, because the following tests assume + // little endians. The pixel format string matches the bytes in memory. + + rofs = bpp - rofs - rsize; + gofs = bpp - gofs - gsize; + bofs = bpp - bofs - bsize; + + } + // 15 bits RGB (hicolor) if ((rofs==10) && (rsize==5) && (gofs==5) && (gsize==5) @@ -2243,6 +2305,22 @@ else return "RGBA32"; + } else + // special 32 bits (mostly on big endian hosts) + if ((rofs==8) && (rsize==8) + && (gofs==16) && (gsize==8) + && (bofs==24) && (bsize==8)) { + + return "ARGB32"; + + } else + // special 32 bits (mostly on big endian hosts) + if ((rofs==24) && (rsize==8) + && (gofs==16) && (gsize==8) + && (bofs==8) && (bsize==8)) { + + return "ABGR32"; + } return NULL; // unknown format Index: backend/render_handler_agg.h =================================================================== RCS file: /cvsroot/gnash/gnash/backend/render_handler_agg.h,v retrieving revision 1.19 retrieving revision 1.20 diff -u -b -r1.19 -r1.20 --- backend/render_handler_agg.h 1 Jul 2007 10:53:47 -0000 1.19 +++ backend/render_handler_agg.h 29 Aug 2007 17:34:07 -0000 1.20 @@ -71,6 +71,7 @@ /// Detect pixel format based on bit mask. If the pixel format is unknown, /// NULL is returned. Note that a successfully detected pixel format does /// not necessarily mean that the pixel format is available (compiled in). +/// The bit offsets are assumed to be in host byte order! DSOEXPORT char* agg_detect_pixel_format(unsigned int rofs, unsigned int rsize, unsigned int gofs, unsigned int gsize, unsigned int bofs, unsigned int bsize, Index: gui/fb.cpp =================================================================== RCS file: /cvsroot/gnash/gnash/gui/fb.cpp,v retrieving revision 1.37 retrieving revision 1.38 diff -u -b -r1.37 -r1.38 --- gui/fb.cpp 12 Jul 2007 13:34:20 -0000 1.37 +++ gui/fb.cpp 29 Aug 2007 17:34:07 -0000 1.38 @@ -271,6 +271,11 @@ var_screeninfo.blue.length); log_msg("Total bits per pixel: %d", var_screeninfo.bits_per_pixel); + /* NOTE: agg_detect_pixel_format() assumes bit positions in host byte order. + I don't know if this matches the information provided by var_screeninfo, so + you know what to do when colors look wrong (or pixel format can't be detected) + on big-endian machines! - Udo */ + char* pixelformat = agg_detect_pixel_format( var_screeninfo.red.offset, var_screeninfo.red.length, var_screeninfo.green.offset, var_screeninfo.green.length, _______________________________________________ Gnash-commit mailing list Gnash-commit@gnu.org http://lists.gnu.org/mailman/listinfo/gnash-commit