diff options
-rw-r--r-- | cui/source/tabpages/tpbitmap.cxx | 33 | ||||
-rw-r--r-- | drawinglayer/source/processor2d/vclprocessor2d.cxx | 15 | ||||
-rw-r--r-- | svx/source/xoutdev/xattrbmp.cxx | 6 |
3 files changed, 38 insertions, 16 deletions
diff --git a/cui/source/tabpages/tpbitmap.cxx b/cui/source/tabpages/tpbitmap.cxx index 17e89cbba57a..89a51a8b26f2 100644 --- a/cui/source/tabpages/tpbitmap.cxx +++ b/cui/source/tabpages/tpbitmap.cxx @@ -354,29 +354,40 @@ IMPL_LINK_NOARG(SvxBitmapTabPage, ChangeBitmapHdl_Impl) Color aPixelColor = aFront; Color aBackColor = aBack; - m_pBitmapCtl->SetPixelColor( aPixelColor ); - m_pBitmapCtl->SetBackgroundColor( aBackColor ); + // #i123564# This causes the wrong color to be selected + // as foreground color when the 1st bitmap in the bitmap + // list is selected. I see no reason why this is done, + // thus I will take it out + // + //if( 0 == m_pLbBitmaps->GetSelectEntryPos() ) + //{ + // m_pLbColor->SelectEntry( Color( COL_BLACK ) ); + // ChangePixelColorHdl_Impl( this ); + //} + //else + + m_pLbColor->SelectEntry( aPixelColor ); - // if the entry is not in the listbox, - // the color is added temporarily - if( 0 == m_pLbBitmaps->GetSelectEntryPos() ) - { - m_pLbColor->SelectEntry( Color( COL_BLACK ) ); - ChangePixelColorHdl_Impl( this ); - } - else - m_pLbColor->SelectEntry( aPixelColor ); if( m_pLbColor->GetSelectEntryCount() == 0 ) { m_pLbColor->InsertEntry( aPixelColor, OUString() ); m_pLbColor->SelectEntry( aPixelColor ); } + m_pLbBackgroundColor->SelectEntry( aBackColor ); + if( m_pLbBackgroundColor->GetSelectEntryCount() == 0 ) { m_pLbBackgroundColor->InsertEntry( aBackColor, OUString() ); m_pLbBackgroundColor->SelectEntry( aBackColor ); } + + // update m_pBitmapCtl, rXFSet and m_pCtlPreview + m_pBitmapCtl->SetPixelColor( aPixelColor ); + m_pBitmapCtl->SetBackgroundColor( aBackColor ); + rXFSet.Put(XFillBitmapItem(OUString(), Graphic(m_pBitmapCtl->GetBitmapEx()))); + m_pCtlPreview->SetAttributes( aXFillAttr.GetItemSet() ); + m_pCtlPreview->Invalidate(); } else { diff --git a/drawinglayer/source/processor2d/vclprocessor2d.cxx b/drawinglayer/source/processor2d/vclprocessor2d.cxx index cf5289a484bd..1cd768e9a31a 100644 --- a/drawinglayer/source/processor2d/vclprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclprocessor2d.cxx @@ -484,8 +484,9 @@ namespace drawinglayer aGraphicRange.transform(mpOutputDevice->GetViewTransformation() * aLocalTransform); // extract discrete size of graphic - const sal_Int32 nBWidth(basegfx::fround(aGraphicRange.getWidth())); - const sal_Int32 nBHeight(basegfx::fround(aGraphicRange.getHeight())); + // caution: when getting to zero, nothing would be painted; thus, do not allow this + const sal_Int32 nBWidth(std::max(sal_Int32(1), basegfx::fround(aGraphicRange.getWidth()))); + const sal_Int32 nBHeight(std::max(sal_Int32(1), basegfx::fround(aGraphicRange.getHeight()))); // only do something when bitmap fill has a size in discrete units if(nBWidth > 0 && nBHeight > 0) @@ -497,9 +498,17 @@ namespace drawinglayer static bool bEnablePreScaling(true); const bool bPreScaled(bEnablePreScaling && nBWidth * nBHeight < (250 * 250)); + // ... but only up to a maximum size, else it gets too expensive if(bPreScaled) { - // ... but only up to a maximum size, else it gets too expensive + // if color depth is below 24bit, expand before scaling for better quality. + // This is even needed for low colors, else the scale will produce + // a bitmap in gray or Black/White (!) + if(aBitmapEx.GetBitCount() < 24) + { + aBitmapEx.Convert(BMP_CONVERSION_24BIT); + } + aBitmapEx.Scale(aNeededBitmapSizePixel, BMP_SCALE_INTERPOLATE); } diff --git a/svx/source/xoutdev/xattrbmp.cxx b/svx/source/xoutdev/xattrbmp.cxx index 89d2261aa165..e98c4d5bbbea 100644 --- a/svx/source/xoutdev/xattrbmp.cxx +++ b/svx/source/xoutdev/xattrbmp.cxx @@ -264,8 +264,10 @@ bool SVX_DLLPUBLIC isHistorical8x8(const BitmapEx& rBitmapEx, BitmapColor& o_rBa { const BitmapPalette& rPalette = pRead->GetPalette(); - o_rBack = rPalette[1]; - o_rFront = rPalette[0]; + // #i123564# bachground and foregrund were exchanged; of course + // rPalette[0] is the background color + o_rFront = rPalette[1]; + o_rBack = rPalette[0]; return true; } |