*dest++ = b ;
if ( mask )
- *maskdest++ = *masksource++ ;
+ {
+ *maskdest++ = 0xFF - *masksource++ ;
+ masksource++ ;
+ masksource++ ;
+ }
else if ( hasAlpha )
*maskdest++ = a ;
else
for ( int y = 0 ; y < h ; ++y , sourcemaskstart += maskrowbytes)
{
unsigned char *sourcemask = sourcemaskstart ;
- for ( int x = 0 ; x < w ; ++x , sourcemask++ , destalpha += 4 )
+ for ( int x = 0 ; x < w ; ++x , sourcemask+=3 , destalpha += 4 )
{
- *destalpha = *sourcemask ;
+ *destalpha = 0xFF - *sourcemask ;
}
}
}
for (int yy = 0; yy < destheight; ++yy, source += sourcelinesize , dest += destlinesize)
{
- memcpy( dest , source , destlinesize ) ;
+ for (int xx = 0; xx < destlinesize; xx++ )
+ *(dest+xx) = 0xFF - *(source+xx*3) ;
}
maskbuf.UngetWriteBuf( maskbufsize ) ;
if ( hasMask )
{
- if ( *maskp++ == 0 )
+ if ( *maskp++ == 0xFF )
{
r = MASK_RED ;
g = MASK_GREEN ;
}
else if ( r == MASK_RED && g == MASK_GREEN && b == MASK_BLUE )
b = MASK_BLUE_REPLACEMENT ;
+ maskp++ ;
+ maskp++ ;
}
else if ( hasAlpha )
*alpha++ = a ;
return m_memBuf.GetData() ;
}
-// this can be a k8IndexedGrayPixelFormat GWorld, because it never stores other values than black or white
-// so no QD colorizing will occur when blitting
+// The default ColorTable for k8IndexedGrayPixelFormat in Intel seems to be broken, so we'll use an non-indexed
+// bitmap mask instead, in order to keep the code simple, the change is done for ppc implementations as well
void wxMask::RealizeNative()
{
}
Rect rect = { 0 , 0 , m_height , m_width } ;
- verify_noerr( NewGWorldFromPtr( (GWorldPtr*) &m_maskBitmap , k8IndexedGrayPixelFormat , &rect , NULL , NULL , 0 ,
+
+ verify_noerr( NewGWorldFromPtr( (GWorldPtr*) &m_maskBitmap , k24RGBPixelFormat , &rect , NULL , NULL , 0 ,
(char*) m_memBuf.GetData() , m_bytesPerRow ) ) ;
}
{
m_width = bitmap.GetWidth() ;
m_height = bitmap.GetHeight() ;
- m_bytesPerRow = ( m_width + 3 ) & 0xFFFFFFC ;
+ m_bytesPerRow = ( m_width * 3 + 3 ) & 0xFFFFFFC ;
size_t size = m_bytesPerRow * m_height ;
unsigned char * destdatabase = (unsigned char*) m_memBuf.GetWriteBuf( size ) ;
b = *srcdata++ ;
if ( ( r + g + b ) > 0x10 )
- *destdata++ = 0x00 ;
- else
+ {
+ *destdata++ = 0xFF ;
+ *destdata++ = 0xFF ;
*destdata++ = 0xFF ;
+ }
+ else
+ {
+ *destdata++ = 0x00 ;
+ *destdata++ = 0x00 ;
+ *destdata++ = 0x00 ;
+ }
}
}
{
m_width = bitmap.GetWidth() ;
m_height = bitmap.GetHeight() ;
- m_bytesPerRow = ( m_width + 3 ) & 0xFFFFFFC ;
+ m_bytesPerRow = ( m_width * 3 + 3 ) & 0xFFFFFFC ;
size_t size = m_bytesPerRow * m_height ;
unsigned char * destdatabase = (unsigned char*) m_memBuf.GetWriteBuf( size ) ;
b = *srcdata++ ;
if ( colour == wxColour( r , g , b) )
- *destdata++ = 0x00 ;
- else
+ {
*destdata++ = 0xFF ;
+ *destdata++ = 0xFF ;
+ *destdata++ = 0xFF ;
+ }
+ else
+ {
+ *destdata++ = 0x00 ;
+ *destdata++ = 0x00 ;
+ *destdata++ = 0x00 ;
+ }
}
}