openoffice-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject svn commit: r1408383 - in /incubator/ooo/branches/alg/aw080/main/vcl/source/gdi: alpha.cxx bitmapex.cxx bmpfast.cxx outdev2.cxx outmap.cxx
Date Mon, 12 Nov 2012 18:02:49 GMT
Author: alg
Date: Mon Nov 12 18:02:48 2012
New Revision: 1408383

URL: http://svn.apache.org/viewvc?rev=1408383&view=rev
Log:
Added more tests for BitmapEx Mask/Alpha format

Modified:
    incubator/ooo/branches/alg/aw080/main/vcl/source/gdi/alpha.cxx
    incubator/ooo/branches/alg/aw080/main/vcl/source/gdi/bitmapex.cxx
    incubator/ooo/branches/alg/aw080/main/vcl/source/gdi/bmpfast.cxx
    incubator/ooo/branches/alg/aw080/main/vcl/source/gdi/outdev2.cxx
    incubator/ooo/branches/alg/aw080/main/vcl/source/gdi/outmap.cxx

Modified: incubator/ooo/branches/alg/aw080/main/vcl/source/gdi/alpha.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/alg/aw080/main/vcl/source/gdi/alpha.cxx?rev=1408383&r1=1408382&r2=1408383&view=diff
==============================================================================
--- incubator/ooo/branches/alg/aw080/main/vcl/source/gdi/alpha.cxx (original)
+++ incubator/ooo/branches/alg/aw080/main/vcl/source/gdi/alpha.cxx Mon Nov 12 18:02:48 2012
@@ -90,8 +90,14 @@ const Bitmap& AlphaMask::ImplGetBitmap()
 
 void AlphaMask::ImplSetBitmap( const Bitmap& rBitmap )
 {
-    DBG_ASSERT( ( 8 == rBitmap.GetBitCount() ) && rBitmap.HasGreyPalette(), "AlphaMask::ImplSetBitmap:
invalid bitmap" );
-	*(Bitmap*) this = rBitmap;
+    *(Bitmap*) this = rBitmap;
+
+#ifdef DBG_UTIL
+    if((8 != rBitmap.GetBitCount()) || !rBitmap.HasGreyPalette())
+    {
+        OSL_ENSURE(false, "AlphaMask::ImplSetBitmap: invalid bitmap");
+    }
+#endif
 }
 
 // -----------------------------------------------------------------------------

Modified: incubator/ooo/branches/alg/aw080/main/vcl/source/gdi/bitmapex.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/alg/aw080/main/vcl/source/gdi/bitmapex.cxx?rev=1408383&r1=1408382&r2=1408383&view=diff
==============================================================================
--- incubator/ooo/branches/alg/aw080/main/vcl/source/gdi/bitmapex.cxx (original)
+++ incubator/ooo/branches/alg/aw080/main/vcl/source/gdi/bitmapex.cxx Mon Nov 12 18:02:48
2012
@@ -160,11 +160,19 @@ BitmapEx::BitmapEx( const Bitmap& rBmp, 
         aMask.Scale(rBmp.GetSizePixel());
     }
 
+    if( !!aMask && aMask.GetBitCount() > 8 )
+    {
+        OSL_TRACE("BitmapEx: forced alpha to 8bit grey");
+        aMask.Convert(BMP_CONVERSION_8BIT_GREYS);
+    }
+
     // #i75531# the workaround below can go when
     // X11SalGraphics::drawAlphaBitmap()'s render acceleration
     // can handle the bitmap depth mismatch directly 
     if( aBitmap.GetBitCount() < aMask.GetBitCount() )
+    {
         aBitmap.Convert( BMP_CONVERSION_24BIT );
+    }
 }
 
 // ------------------------------------------------------------------

Modified: incubator/ooo/branches/alg/aw080/main/vcl/source/gdi/bmpfast.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/alg/aw080/main/vcl/source/gdi/bmpfast.cxx?rev=1408383&r1=1408382&r2=1408383&view=diff
==============================================================================
--- incubator/ooo/branches/alg/aw080/main/vcl/source/gdi/bmpfast.cxx (original)
+++ incubator/ooo/branches/alg/aw080/main/vcl/source/gdi/bmpfast.cxx Mon Nov 12 18:02:48 2012
@@ -677,8 +677,12 @@ bool ImplBlendToBitmap( TrueColorPixelPt
     BitmapBuffer& rDstBuffer, const BitmapBuffer& rSrcBuffer,
     const BitmapBuffer& rMskBuffer )
 {
-    //DBG_ASSERT( rMskBuffer.mnFormat == MSKFMT, "FastBmp BlendImage: wrong MSKFMT" );
-    DBG_ASSERT( rMskBuffer.mnFormat == BMP_FORMAT_8BIT_PAL, "FastBmp BlendImage: unusual
MSKFMT" );
+#ifdef DBG_UTIL
+    if(rMskBuffer.mnFormat != BMP_FORMAT_8BIT_PAL && rMskBuffer.mnFormat != BMP_FORMAT_8BIT_TC_MASK)
+    {
+        OSL_ENSURE(false, "FastBmp BlendImage: unusual MSKFMT");
+    }
+#endif
 
     const int nSrcLinestep = rSrcBuffer.mnScanlineSize;
     int nMskLinestep = rMskBuffer.mnScanlineSize;

Modified: incubator/ooo/branches/alg/aw080/main/vcl/source/gdi/outdev2.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/alg/aw080/main/vcl/source/gdi/outdev2.cxx?rev=1408383&r1=1408382&r2=1408383&view=diff
==============================================================================
--- incubator/ooo/branches/alg/aw080/main/vcl/source/gdi/outdev2.cxx (original)
+++ incubator/ooo/branches/alg/aw080/main/vcl/source/gdi/outdev2.cxx Mon Nov 12 18:02:48 2012
@@ -2023,9 +2023,12 @@ void OutputDevice::ImplDrawAlpha( const 
             BitmapReadAccess*	pP = ( (Bitmap&) rBmp ).AcquireReadAccess();
             BitmapReadAccess*	pA = ( (AlphaMask&) rAlpha ).AcquireReadAccess();
 
-            DBG_ASSERT( pA->GetScanlineFormat() == BMP_FORMAT_8BIT_PAL ||
-                        pA->GetScanlineFormat() == BMP_FORMAT_8BIT_TC_MASK, 
-                        "OutputDevice::ImplDrawAlpha(): non-8bit alpha no longer supported!"
);
+#ifdef DBG_UTIL
+            if(pA->GetScanlineFormat() != BMP_FORMAT_8BIT_PAL && pA->GetScanlineFormat()
!= BMP_FORMAT_8BIT_TC_MASK)
+            {
+                OSL_ENSURE(false, "OutputDevice::ImplDrawAlpha(): non-8bit alpha no longer
supported!");
+            }
+#endif
 
             // #i38887# reading from screen may sometimes fail
             if( aBmp.ImplGetImpBitmap() )

Modified: incubator/ooo/branches/alg/aw080/main/vcl/source/gdi/outmap.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/alg/aw080/main/vcl/source/gdi/outmap.cxx?rev=1408383&r1=1408382&r2=1408383&view=diff
==============================================================================
--- incubator/ooo/branches/alg/aw080/main/vcl/source/gdi/outmap.cxx (original)
+++ incubator/ooo/branches/alg/aw080/main/vcl/source/gdi/outmap.cxx Mon Nov 12 18:02:48 2012
@@ -2248,17 +2248,29 @@ long* OutputDevice::LogicToLogic( long* 
 
 // -----------------------------------------------------------------------
 
-#define CHEKCMAPUNITSFORSTATIC( aMapA, aMapB ) \
-    OSL_ENSURE((MAP_PIXEL == aMapA && MAP_PIXEL != aMapB) && (MAP_PIXEL !=
aMapA && MAP_PIXEL == aMapB), \
-    "Caution: When using the static LogicToLogic methods to convert between pixels and logic
sizes, \
-    not the correct system DPI is used, but a DPI of 75 is guessed. To use the correct DPI,
use e.g. \
-    the OutputDevice from Application::GetDefaultDevice() (!)");
+#ifdef DBG_UTIL
+void CheckMapUnitsForStatic(MapUnit aMapA, MapUnit aMapB)
+{
+    if(aMapA != aMapB)
+    {
+        if((MAP_PIXEL == aMapA && MAP_PIXEL != aMapB) || (MAP_PIXEL != aMapA &&
MAP_PIXEL == aMapB))
+        {
+            OSL_ENSURE(false, \
+            "Caution: When using the static LogicToLogic methods to convert between pixels
and logic sizes,/n\
+            not the correct system DPI is used, but a DPI of 75 is guessed. To use the correct
DPI, use e.g./n\
+            the OutputDevice from Application::GetDefaultDevice() (!)");
+        }
+    }
+}
+#endif
 
 Point OutputDevice::LogicToLogic( const Point& rPtSource,
 								  const MapMode& rMapModeSource,
 								  const MapMode& rMapModeDest )
 {
-    CHEKCMAPUNITSFORSTATIC(rMapModeSource.GetMapUnit(), rMapModeDest.GetMapUnit())
+#ifdef DBG_UTIL
+    CheckMapUnitsForStatic(rMapModeSource.GetMapUnit(), rMapModeDest.GetMapUnit());
+#endif
 	if ( rMapModeSource == rMapModeDest )
 		return rPtSource;
 
@@ -2295,7 +2307,9 @@ Size OutputDevice::LogicToLogic( const S
 								 const MapMode& rMapModeSource,
 								 const MapMode& rMapModeDest )
 {
-    CHEKCMAPUNITSFORSTATIC(rMapModeSource.GetMapUnit(), rMapModeDest.GetMapUnit())
+#ifdef DBG_UTIL
+    CheckMapUnitsForStatic(rMapModeSource.GetMapUnit(), rMapModeDest.GetMapUnit());
+#endif
 	if ( rMapModeSource == rMapModeDest )
 		return rSzSource;
 
@@ -2330,7 +2344,9 @@ basegfx::B2DPolygon OutputDevice::LogicT
                                                 const MapMode& rMapModeSource,
                                                 const MapMode& rMapModeDest )
 {
-    CHEKCMAPUNITSFORSTATIC(rMapModeSource.GetMapUnit(), rMapModeDest.GetMapUnit())
+#ifdef DBG_UTIL
+    CheckMapUnitsForStatic(rMapModeSource.GetMapUnit(), rMapModeDest.GetMapUnit());
+#endif
 	if ( rMapModeSource == rMapModeDest )
 		return rPolySource;
 
@@ -2376,7 +2392,9 @@ basegfx::B2DPolyPolygon OutputDevice::Lo
                                                     const MapMode& rMapModeSource,
                                                     const MapMode& rMapModeDest )
 {
-    CHEKCMAPUNITSFORSTATIC(rMapModeSource.GetMapUnit(), rMapModeDest.GetMapUnit())
+#ifdef DBG_UTIL
+    CheckMapUnitsForStatic(rMapModeSource.GetMapUnit(), rMapModeDest.GetMapUnit());
+#endif
 	if ( rMapModeSource == rMapModeDest )
 		return rPolySource;
 
@@ -2422,7 +2440,9 @@ Rectangle OutputDevice::LogicToLogic( co
 									  const MapMode& rMapModeSource,
 									  const MapMode& rMapModeDest )
 {
-    CHEKCMAPUNITSFORSTATIC(rMapModeSource.GetMapUnit(), rMapModeDest.GetMapUnit())
+#ifdef DBG_UTIL
+    CheckMapUnitsForStatic(rMapModeSource.GetMapUnit(), rMapModeDest.GetMapUnit());
+#endif
 	if ( rMapModeSource == rMapModeDest )
 		return rRectSource;
 
@@ -2471,7 +2491,9 @@ long OutputDevice::LogicToLogic( long nL
 	if ( eUnitSource == eUnitDest )
 		return nLongSource;
 
-    CHEKCMAPUNITSFORSTATIC(eUnitSource, eUnitDest)
+#ifdef DBG_UTIL
+    CheckMapUnitsForStatic(eUnitSource, eUnitDest);
+#endif
 	ENTER2( eUnitSource, eUnitDest );
 	ENTER3( eUnitSource, eUnitDest );
 
@@ -2498,7 +2520,9 @@ basegfx::B2DHomMatrix OutputDevice::GetT
 
 double OutputDevice::GetFactorLogicToLogic(MapUnit eUnitSource, MapUnit eUnitDest)
 {
-    CHEKCMAPUNITSFORSTATIC(eUnitSource, eUnitDest)
+#ifdef DBG_UTIL
+    CheckMapUnitsForStatic(eUnitSource, eUnitDest);
+#endif
 	if ( eUnitSource == eUnitDest )
 		return 1.0;
 



Mime
View raw message