summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsj <sj@openoffice.org>2009-12-16 17:55:41 +0100
committersj <sj@openoffice.org>2009-12-16 17:55:41 +0100
commit8939f29a75911f10371ba1d8bc70cc88e418e5bd (patch)
tree9d64c07b36788b61eb75ffd16a91c5aa78c9f2af
parentd5a8b4a9cf542b6567ccd69a67a96ade941cfba3 (diff)
impress181: #i74384# fixed max value color handling
-rw-r--r--goodies/source/filter.vcl/ipbm/ipbm.cxx6
1 files changed, 4 insertions, 2 deletions
diff --git a/goodies/source/filter.vcl/ipbm/ipbm.cxx b/goodies/source/filter.vcl/ipbm/ipbm.cxx
index 227490fc9d8e..c0b0f6012116 100644
--- a/goodies/source/filter.vcl/ipbm/ipbm.cxx
+++ b/goodies/source/filter.vcl/ipbm/ipbm.cxx
@@ -106,7 +106,7 @@ BOOL PBMReader::ReadPBM( SvStream & rPBM, Graphic & rGraphic )
if ( ( mbStatus = ImplReadHeader() ) == FALSE )
return FALSE;
- if ( mnWidth == 0 || mnHeight == 0 )
+ if ( ( mnMaxVal == 0 ) || ( mnWidth == 0 ) || ( mnHeight == 0 ) )
return FALSE;
// 0->PBM, 1->PGM, 2->PPM
@@ -466,7 +466,9 @@ BOOL PBMReader::ImplReadBody()
if ( nCount == 3 )
{
nCount = 0;
- mpAcc->SetPixel( nHeight, nWidth++, BitmapColor( (BYTE)nRGB[ 0 ], (BYTE)nRGB[ 1 ], (BYTE)nRGB[ 2 ] ) );
+ mpAcc->SetPixel( nHeight, nWidth++, BitmapColor( static_cast< BYTE >( ( nRGB[ 0 ] * 255 ) / mnMaxVal ),
+ static_cast< BYTE >( ( nRGB[ 1 ] * 255 ) / mnMaxVal ),
+ static_cast< BYTE >( ( nRGB[ 2 ] * 255 ) / mnMaxVal ) ) );
nCount = 0;
nRGB[ 0 ] = nRGB[ 1 ] = nRGB[ 2 ] = 0;
if ( nWidth == mnWidth )