Opened 17 years ago

Closed 17 years ago

#2235 closed defect (fixed)

[AGG] PIXMAP symbols render incorrectly on PPC builds

Reported by: zjames Owned by: tbonfort
Priority: normal Milestone: 5.0 release
Component: AGG Version: svn-trunk (development)
Severity: normal Keywords:
Cc:

Description

When rendering symbols of type PIXMAP with the AGG renderer, the colors are rendered incorrectly. This only occurs on a PPC OS X machine (a machine with big endian architecture). GD renders the same PIXMAP correctly.

A similar problem with vectors in early builds of the agg driver was corrected with a patch at mapagg.cpp:98 to handle byte order differences but I can't figure out what needs to change inside the templates in the pixmap code.

#ifdef CPL_MSB typedef agg::pixfmt_alpha_blend_rgba<agg::blender_argb32,mapserv_row_ptr_cache<int>,int> pixelFormat; #else typedef agg::pixfmt_alpha_blend_rgba<agg::blender_bgra32_plain,mapserv_row_ptr_cache<int>,int> pixelFormat; #endif

Attachments (2)

agg.png (986 bytes ) - added by zjames 17 years ago.
agg pixmap - incorrect color
gd.png (886 bytes ) - added by zjames 17 years ago.
gd pixmap - correct colors

Download all attachments as: .zip

Change History (5)

by zjames, 17 years ago

Attachment: agg.png added

agg pixmap - incorrect color

by zjames, 17 years ago

Attachment: gd.png added

gd pixmap - correct colors

comment:1 by tbonfort, 17 years ago

I'm not equipped to try this out, so could you please try this patch?

I always wondered why this CPL_MSB ifdef was here, was just hoping someone else would cope with it ;)

Index: mapagg.cpp
===================================================================
--- mapagg.cpp	(revision 6595)
+++ mapagg.cpp	(working copy)
@@ -96,8 +96,10 @@
 #define LINESPACE 1.33 //space beween text lines... from GD
 
 #ifdef CPL_MSB
+typedef agg::pixfmt_argb32 GDpixfmt; 
 typedef agg::pixfmt_alpha_blend_rgba<agg::blender_argb32,mapserv_row_ptr_cache<int>,int> pixelFormat;
 #else
+typedef agg::pixfmt_bgra32 GDpixfmt;
 typedef agg::pixfmt_alpha_blend_rgba<agg::blender_bgra32_plain,mapserv_row_ptr_cache<int>,int> pixelFormat;
 #endif
 
@@ -102,7 +104,7 @@
 #endif
 
 
-typedef agg::pixfmt_bgra32 GDpixfmt; 
+
 typedef agg::rgba8 color_type;
 typedef agg::font_engine_freetype_int16 font_engine_type;
 typedef agg::font_cache_manager<font_engine_type> font_manager_type;
@@ -307,10 +309,8 @@
             int tilewidth, int tileheight, 
             colorObj *color, colorObj *backgroundcolor, double width) {
         ras_aa.reset();
-        typedef agg::pixfmt_bgra32 pixfmt;
-        typedef agg::rgba8 color_type;
         typedef agg::wrap_mode_repeat wrap_type;
-        typedef agg::image_accessor_wrap<pixfmt,wrap_type,wrap_type> img_source_type;
+        typedef agg::image_accessor_wrap<GDpixfmt,wrap_type,wrap_type> img_source_type;
         typedef agg::span_pattern_rgba<img_source_type> span_gen_type;
         agg::int8u*           m_pattern;
         agg::rendering_buffer m_pattern_rbuf;
@@ -317,9 +317,9 @@
         m_pattern = new agg::int8u[tilewidth * tileheight * 4];
         m_pattern_rbuf.attach(m_pattern, tilewidth,tileheight, tilewidth*4);
 
-        pixfmt pixf(m_pattern_rbuf);
-        agg::renderer_base<pixfmt> rb(pixf);
-        agg::renderer_scanline_aa_solid<agg::renderer_base<pixfmt> > rs(rb);
+        GDpixfmt pixf(m_pattern_rbuf);
+        agg::renderer_base<GDpixfmt> rb(pixf);
+        agg::renderer_scanline_aa_solid<agg::renderer_base<GDpixfmt> > rs(rb);
 
         if(backgroundcolor!=NULL && MS_VALID_COLOR(*backgroundcolor))
             rb.clear(msToAGGColor(backgroundcolor));

comment:2 by zjames, 17 years ago

That did it. Thanks Thomas - MSBers everywhere salute you :)

comment:3 by tbonfort, 17 years ago

Resolution: fixed
Status: newclosed

fixed in r6596

Note: See TracTickets for help on using tickets.