Modified: 
openoffice/trunk/main/svx/source/sdr/contact/viewobjectcontactofe3d.cxx
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/main/svx/source/sdr/contact/viewobjectcontactofe3d.cxx?rev=1539043&r1=1539042&r2=1539043&view=diff
==============================================================================
--- openoffice/trunk/main/svx/source/sdr/contact/viewobjectcontactofe3d.cxx 
(original)
+++ openoffice/trunk/main/svx/source/sdr/contact/viewobjectcontactofe3d.cxx Tue 
Nov  5 16:13:12 2013
@@ -50,23 +50,30 @@ namespace sdr
                {
                }
 
-               drawinglayer::primitive3d::Primitive3DSequence 
ViewObjectContactOfE3d::createPrimitive3DSequence(const DisplayInfo& 
rDisplayInfo) const
-               {
-                       // get the view-independent Primitive from the 
viewContact
-                       const ViewContactOfE3d& rViewContactOfE3d(dynamic_cast< 
const ViewContactOfE3d& >(GetViewContact()));
-                       drawinglayer::primitive3d::Primitive3DSequence 
xRetval(rViewContactOfE3d.getViewIndependentPrimitive3DSequence());
+        drawinglayer::primitive3d::Primitive3DSequence 
ViewObjectContactOfE3d::createPrimitive3DSequence(const DisplayInfo& 
rDisplayInfo) const
+        {
+            // get the view-independent Primitive from the viewContact
+            const ViewContactOfE3d& rViewContactOfE3d(dynamic_cast< const 
ViewContactOfE3d& >(GetViewContact()));
+            drawinglayer::primitive3d::Primitive3DSequence 
xRetval(rViewContactOfE3d.getViewIndependentPrimitive3DSequence());
+
+            // handle ghosted
+            if(isPrimitiveGhosted(rDisplayInfo))
+            {
+                const ::basegfx::BColor aRGBWhite(1.0, 1.0, 1.0);
+                const ::basegfx::BColorModifierSharedPtr aBColorModifier(
+                    new basegfx::BColorModifier_interpolate(
+                        aRGBWhite, 
+                        0.5));
+                const drawinglayer::primitive3d::Primitive3DReference 
xReference(
+                    new drawinglayer::primitive3d::ModifiedColorPrimitive3D(
+                        xRetval, 
+                        aBColorModifier));
 
-                       // handle ghosted
-                       if(isPrimitiveGhosted(rDisplayInfo))
-                       {
-                               const ::basegfx::BColor aRGBWhite(1.0, 1.0, 
1.0);
-                               const ::basegfx::BColorModifier 
aBColorModifier(aRGBWhite, 0.5, ::basegfx::BCOLORMODIFYMODE_INTERPOLATE);
-                               const 
drawinglayer::primitive3d::Primitive3DReference xReference(new 
drawinglayer::primitive3d::ModifiedColorPrimitive3D(xRetval, aBColorModifier));
                 xRetval = 
drawinglayer::primitive3d::Primitive3DSequence(&xReference, 1);
-                       }
+            }
 
-                       return xRetval;
-               }
+            return xRetval;
+        }
 
                drawinglayer::primitive2d::Primitive2DSequence 
ViewObjectContactOfE3d::createPrimitive2DSequence(const DisplayInfo& 
rDisplayInfo) const
                {

Modified: 
openoffice/trunk/main/svx/source/sdr/contact/viewobjectcontactofe3dscene.cxx
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/main/svx/source/sdr/contact/viewobjectcontactofe3dscene.cxx?rev=1539043&r1=1539042&r2=1539043&view=diff
==============================================================================
--- 
openoffice/trunk/main/svx/source/sdr/contact/viewobjectcontactofe3dscene.cxx 
(original)
+++ 
openoffice/trunk/main/svx/source/sdr/contact/viewobjectcontactofe3dscene.cxx 
Tue Nov  5 16:13:12 2013
@@ -110,16 +110,22 @@ namespace sdr
                                        }
                                }
 
-                               // handle ghosted
-                               if(isPrimitiveGhosted(rDisplayInfo))
-                               {
-                                       const ::basegfx::BColor aRGBWhite(1.0, 
1.0, 1.0);
-                                       const ::basegfx::BColorModifier 
aBColorModifier(aRGBWhite, 0.5, ::basegfx::BCOLORMODIFYMODE_INTERPOLATE);
-                    const drawinglayer::primitive2d::Primitive2DReference 
xReference(new drawinglayer::primitive2d::ModifiedColorPrimitive2D(xRetval, 
aBColorModifier));
+                // handle ghosted
+                if(isPrimitiveGhosted(rDisplayInfo))
+                {
+                    const ::basegfx::BColor aRGBWhite(1.0, 1.0, 1.0);
+                    const ::basegfx::BColorModifierSharedPtr aBColorModifier(
+                        new basegfx::BColorModifier_interpolate(
+                            aRGBWhite, 
+                            0.5));
+                    const drawinglayer::primitive2d::Primitive2DReference 
xReference(
+                        new 
drawinglayer::primitive2d::ModifiedColorPrimitive2D(
+                            xRetval, 
+                            aBColorModifier));
 
                     xRetval = 
drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
-                               }
-                       }
+                }
+            }
 
                        if(bIsActiveVC)
                        {

Modified: openoffice/trunk/main/vcl/source/gdi/bitmapex.cxx
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/main/vcl/source/gdi/bitmapex.cxx?rev=1539043&r1=1539042&r2=1539043&view=diff
==============================================================================
--- openoffice/trunk/main/vcl/source/gdi/bitmapex.cxx (original)
+++ openoffice/trunk/main/vcl/source/gdi/bitmapex.cxx Tue Nov  5 16:13:12 2013
@@ -1018,108 +1018,158 @@ BitmapEx BitmapEx::getTransformed(
 
 BitmapEx BitmapEx::ModifyBitmapEx(const basegfx::BColorModifierStack& 
rBColorModifierStack) const
 {
-       Bitmap aChangedBitmap(GetBitmap());
-       bool bDone(false);
+    Bitmap aChangedBitmap(GetBitmap());
+    bool bDone(false);
 
-       for(sal_uInt32 a(rBColorModifierStack.count()); a && !bDone; )
-       {
-               const basegfx::BColorModifier& rModifier = 
rBColorModifierStack.getBColorModifier(--a);
-                       
-               switch(rModifier.getMode())
-               {
-                       case basegfx::BCOLORMODIFYMODE_REPLACE :
-                       {
-                               // complete replace
-                               if(IsTransparent())
-                               {
-                                       // clear bitmap with dest color
-                                   if(aChangedBitmap.GetBitCount() <= 8)
-                                   {
-                        // do NOT use erase; for e.g. 8bit Bitmaps, the 
nearest color to the given
-                        // erase color is determined and used -> this may be 
different from what is
-                        // wanted here. Better create a new bitmap with the 
needed color explicitely
-                               BitmapReadAccess* pReadAccess = 
aChangedBitmap.AcquireReadAccess();
-                        OSL_ENSURE(pReadAccess, "Got no Bitmap ReadAccess 
?!?");
+    for(sal_uInt32 a(rBColorModifierStack.count()); a && !bDone; )
+    {
+        const basegfx::BColorModifierSharedPtr& rModifier = 
rBColorModifierStack.getBColorModifier(--a);
+        const basegfx::BColorModifier_replace* pReplace = dynamic_cast< const 
basegfx::BColorModifier_replace* >(rModifier.get());
+
+        if(pReplace)
+        {
+            // complete replace
+            if(IsTransparent())
+            {
+                // clear bitmap with dest color
+                if(aChangedBitmap.GetBitCount() <= 8)
+                {
+                    // do NOT use erase; for e.g. 8bit Bitmaps, the nearest 
color to the given
+                    // erase color is determined and used -> this may be 
different from what is
+                    // wanted here. Better create a new bitmap with the needed 
color explicitely
+                    BitmapReadAccess* pReadAccess = 
aChangedBitmap.AcquireReadAccess();
+                    OSL_ENSURE(pReadAccess, "Got no Bitmap ReadAccess ?!?");
+
+                    if(pReadAccess)
+                    {
+                        BitmapPalette aNewPalette(pReadAccess->GetPalette());
+                        aNewPalette[0] = 
BitmapColor(Color(pReplace->getBColor()));
+                        aChangedBitmap = Bitmap(
+                            aChangedBitmap.GetSizePixel(), 
+                            aChangedBitmap.GetBitCount(), 
+                            &aNewPalette);
+                        delete pReadAccess;
+                    }
+                }
+                else
+                {
+                    aChangedBitmap.Erase(Color(pReplace->getBColor()));
+                }
+            }
+            else
+            {
+                // erase bitmap, caller will know to paint direct
+                aChangedBitmap.SetEmpty();
+            }
+                    
+            bDone = true;
+        }
+        else
+        {
+            BitmapWriteAccess* pContent = aChangedBitmap.AcquireWriteAccess();
 
-                        if(pReadAccess)
+            if(pContent)
+            {
+                const double fConvertColor(1.0 / 255.0);
+
+                if(pContent->HasPalette())
+                {
+                    const sal_uInt16 nCount(pContent->GetPaletteEntryCount());
+
+                    for(sal_uInt16 a(0); a < nCount; a++)
+                    {
+                        const BitmapColor& rCol = 
pContent->GetPaletteColor(a); 
+                        const basegfx::BColor aBSource(
+                            rCol.GetRed() * fConvertColor,
+                            rCol.GetGreen() * fConvertColor,
+                            rCol.GetBlue() * fConvertColor);
+                        const basegfx::BColor 
aBDest(rModifier->getModifiedColor(aBSource));
+                        pContent->SetPaletteColor(a, 
BitmapColor(Color(aBDest)));
+                    }
+                }
+                else if(BMP_FORMAT_24BIT_TC_BGR == 
pContent->GetScanlineFormat())
+                {
+                    for(sal_uInt32 y(0L); y < (sal_uInt32)pContent->Height(); 
y++)
+                    {
+                        Scanline pScan = pContent->GetScanline(y);
+
+                        for(sal_uInt32 x(0L); x < 
(sal_uInt32)pContent->Width(); x++)
                         {
-                                           BitmapPalette 
aNewPalette(pReadAccess->GetPalette());
-                            aNewPalette[0] = 
BitmapColor(Color(rModifier.getBColor()));
-                                           aChangedBitmap = Bitmap(
-                                aChangedBitmap.GetSizePixel(), 
-                                aChangedBitmap.GetBitCount(), 
-                                &aNewPalette);
-                            delete pReadAccess;
+                            const basegfx::BColor aBSource(
+                                *(pScan + 2)* fConvertColor,
+                                *(pScan + 1) * fConvertColor,
+                                *pScan * fConvertColor);
+                            const basegfx::BColor 
aBDest(rModifier->getModifiedColor(aBSource));
+                            *pScan++ = static_cast< sal_uInt8 
>(aBDest.getBlue() * 255.0);
+                            *pScan++ = static_cast< sal_uInt8 
>(aBDest.getGreen() * 255.0);
+                            *pScan++ = static_cast< sal_uInt8 
>(aBDest.getRed() * 255.0);
                         }
-                                   }
-                                   else
-                                   {
-                                               
aChangedBitmap.Erase(Color(rModifier.getBColor()));
                     }
-                               }
-                               else
-                               {
-                                       // erase bitmap, caller will know to 
paint direct
-                                       aChangedBitmap.SetEmpty();
-                               }
-                                       
-                               bDone = true;
-                               break;
-                       }
-
-                       default : // BCOLORMODIFYMODE_INTERPOLATE, 
BCOLORMODIFYMODE_GRAY, BCOLORMODIFYMODE_BLACKANDWHITE
-                       {
-                               BitmapWriteAccess* pContent = 
aChangedBitmap.AcquireWriteAccess();
-
-                               if(pContent)
-                               {
-                                       const double fConvertColor(1.0 / 255.0);
-
-                                       for(sal_uInt32 y(0L); y < 
(sal_uInt32)pContent->Height(); y++)
-                                       {
-                                               for(sal_uInt32 x(0L); x < 
(sal_uInt32)pContent->Width(); x++)
-                                               {
-                                                       const BitmapColor 
aBMCol(pContent->GetColor(y, x));
-                                                       const basegfx::BColor 
aBSource(
-                                                               
(double)aBMCol.GetRed() * fConvertColor, 
-                                                               
(double)aBMCol.GetGreen() * fConvertColor, 
-                                                               
(double)aBMCol.GetBlue() * fConvertColor);
-                                                       const basegfx::BColor 
aBDest(rModifier.getModifiedColor(aBSource));
-                                                               
-                                                       pContent->SetPixel(y, 
x, BitmapColor(Color(aBDest)));
-                                               }
-                                       }
-
-                                       delete pContent;
-                               }
-                                       
-                               break;
-                       }
-               }
-       }
-
-       if(aChangedBitmap.IsEmpty())
-       {
-               return BitmapEx();
-       }
-       else
-       {
-               if(IsTransparent())
-               {
-                       if(IsAlpha())
-                       {
-                               return BitmapEx(aChangedBitmap, GetAlpha());
-                       }
-                       else
-                       {
-                               return BitmapEx(aChangedBitmap, GetMask());
-                       }
-               }
-               else
-               {
-                       return BitmapEx(aChangedBitmap);
-               }
-       }
+                }
+                else if(BMP_FORMAT_24BIT_TC_RGB == 
pContent->GetScanlineFormat())
+                {
+                    for(sal_uInt32 y(0L); y < (sal_uInt32)pContent->Height(); 
y++)
+                    {
+                        Scanline pScan = pContent->GetScanline(y);
+
+                        for(sal_uInt32 x(0L); x < 
(sal_uInt32)pContent->Width(); x++)
+                        {
+                            const basegfx::BColor aBSource(
+                                *pScan * fConvertColor,
+                                *(pScan + 1) * fConvertColor,
+                                *(pScan + 2) * fConvertColor);
+                            const basegfx::BColor 
aBDest(rModifier->getModifiedColor(aBSource));
+                            *pScan++ = static_cast< sal_uInt8 
>(aBDest.getRed() * 255.0);
+                            *pScan++ = static_cast< sal_uInt8 
>(aBDest.getGreen() * 255.0);
+                            *pScan++ = static_cast< sal_uInt8 
>(aBDest.getBlue() * 255.0);
+                        }
+                    }
+                }
+                else
+                {
+                    for(sal_uInt32 y(0L); y < (sal_uInt32)pContent->Height(); 
y++)
+                    {
+                        for(sal_uInt32 x(0L); x < 
(sal_uInt32)pContent->Width(); x++)
+                        {
+                            const BitmapColor aBMCol(pContent->GetColor(y, x));
+                            const basegfx::BColor aBSource(
+                                (double)aBMCol.GetRed() * fConvertColor, 
+                                (double)aBMCol.GetGreen() * fConvertColor, 
+                                (double)aBMCol.GetBlue() * fConvertColor);
+                            const basegfx::BColor 
aBDest(rModifier->getModifiedColor(aBSource));
+                                
+                            pContent->SetPixel(y, x, 
BitmapColor(Color(aBDest)));
+                        }
+                    }
+                }
+
+                delete pContent;
+            }
+        }
+    }
+
+    if(aChangedBitmap.IsEmpty())
+    {
+        return BitmapEx();
+    }
+    else
+    {
+        if(IsTransparent())
+        {
+            if(IsAlpha())
+            {
+                return BitmapEx(aChangedBitmap, GetAlpha());
+            }
+            else
+            {
+                return BitmapEx(aChangedBitmap, GetMask());
+            }
+        }
+        else
+        {
+            return BitmapEx(aChangedBitmap);
+        }
+    }
 }
 
 // 
-----------------------------------------------------------------------------


Reply via email to