[Libreoffice-commits] .: Branch 'libreoffice-3-5' - canvas/source

2012-03-19 Thread Tor Lillqvist
 canvas/source/vcl/canvashelper.cxx |   24 
 1 file changed, 12 insertions(+), 12 deletions(-)

New commits:
commit 0ad246127fe8f9d788793ceb8dc327e25ef4a699
Author: Thorsten Behrens tbehr...@suse.com
Date:   Wed Mar 7 00:31:56 2012 +0100

Return proper transparency value even for ignore_color.

Rather unexpectedly, calling setupOutDevState() with IGNORE_COLOR
does not return a proper transparency, but null. Fixed now.

(cherry picked from commit 4b475f31eb9b290b477bb6992ff28e52248cee5d)

Signed-off-by: Tor Lillqvist tlillqv...@suse.com

diff --git a/canvas/source/vcl/canvashelper.cxx 
b/canvas/source/vcl/canvashelper.cxx
index c5c5943..5d4c40a 100644
--- a/canvas/source/vcl/canvashelper.cxx
+++ b/canvas/source/vcl/canvashelper.cxx
@@ -1269,21 +1269,21 @@ namespace vclcanvas
 p2ndOutDev-SetClipRegion( aClipRegion );
 }
 
-if( eColorType != IGNORE_COLOR )
-{
-Color aColor( COL_WHITE );
+Color aColor( COL_WHITE );
 
-if( renderState.DeviceColor.getLength()  2 )
-{
-aColor = ::vcl::unotools::stdColorSpaceSequenceToColor(
-renderState.DeviceColor );
-}
+if( renderState.DeviceColor.getLength()  2 )
+{
+aColor = ::vcl::unotools::stdColorSpaceSequenceToColor(
+renderState.DeviceColor );
+}
 
-// extract alpha, and make color opaque
-// afterwards. Otherwise, OutputDevice won't draw anything
-nTransparency = aColor.GetTransparency();
-aColor.SetTransparency(0);
+// extract alpha, and make color opaque
+// afterwards. Otherwise, OutputDevice won't draw anything
+nTransparency = aColor.GetTransparency();
+aColor.SetTransparency(0);
 
+if( eColorType != IGNORE_COLOR )
+{
 switch( eColorType )
 {
 case LINE_COLOR:
___
Libreoffice-commits mailing list
Libreoffice-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: Branch 'libreoffice-3-5' - canvas/source

2012-03-19 Thread Tor Lillqvist
 canvas/source/vcl/canvashelper.cxx |   45 +++--
 canvas/source/vcl/canvashelper_texturefill.cxx |   38 +++--
 2 files changed, 42 insertions(+), 41 deletions(-)

New commits:
commit e5cf9610961b0f6978e15b2a81b0f9aa769e0298
Author: Thorsten Behrens tbehr...@suse.com
Date:   Wed Mar 7 00:34:52 2012 +0100

Use transparency for gradients fdo#45219

vclcanvas has 1bpp alpha - so cut-off transparency at 98%
This looks for all practical cases close enough to full alpha.

(cherry picked from commit 3f5efa1e76e187070d412d102e4c057679065bcc)

Signed-off-by: Tor Lillqvist tlillqv...@suse.com

diff --git a/canvas/source/vcl/canvashelper.cxx 
b/canvas/source/vcl/canvashelper.cxx
index 5d4c40a..3649ccf 100644
--- a/canvas/source/vcl/canvashelper.cxx
+++ b/canvas/source/vcl/canvashelper.cxx
@@ -155,8 +155,9 @@ namespace vclcanvas
 tools::OutDevStateKeeper aStateKeeper( mpProtectedOutDev );
 
 rOutDev.EnableMapMode( sal_False );
-rOutDev.SetLineColor( COL_TRANSPARENT );
-rOutDev.SetFillColor( COL_TRANSPARENT );
+rOutDev.SetLineColor( COL_WHITE );
+rOutDev.SetFillColor( COL_WHITE );
+rOutDev.SetClipRegion();
 rOutDev.DrawRect( Rectangle( Point(),
  rOutDev.GetOutputSizePixel()) );
 
@@ -166,8 +167,9 @@ namespace vclcanvas
 
 rOutDev2.SetDrawMode( DRAWMODE_DEFAULT );
 rOutDev2.EnableMapMode( sal_False );
-rOutDev2.SetLineColor( COL_TRANSPARENT );
-rOutDev2.SetFillColor( COL_TRANSPARENT );
+rOutDev2.SetLineColor( COL_WHITE );
+rOutDev2.SetFillColor( COL_WHITE );
+rOutDev2.SetClipRegion();
 rOutDev2.DrawRect( Rectangle( Point(),
   rOutDev2.GetOutputSizePixel()) );
 rOutDev2.SetDrawMode( DRAWMODE_BLACKLINE | DRAWMODE_BLACKFILL 
| DRAWMODE_BLACKTEXT |
@@ -500,19 +502,11 @@ namespace vclcanvas
 
 if( mp2ndOutDev )
 {
-// HACK. Normally, CanvasHelper does not care
-// about actually what mp2ndOutDev is...
-// well, here we do  assume a 1bpp target.
-if( nTransparency  127 )
-{
-mp2ndOutDev-getOutDev().SetDrawMode( DRAWMODE_WHITELINE | 
DRAWMODE_WHITEFILL | DRAWMODE_WHITETEXT |
-  
DRAWMODE_WHITEGRADIENT | DRAWMODE_WHITEBITMAP );
-mp2ndOutDev-getOutDev().SetFillColor( COL_WHITE );
-mp2ndOutDev-getOutDev().DrawPolyPolygon( aPolyPoly );
-mp2ndOutDev-getOutDev().SetDrawMode( DRAWMODE_BLACKLINE | 
DRAWMODE_BLACKFILL | DRAWMODE_BLACKTEXT |
-  
DRAWMODE_BLACKGRADIENT | DRAWMODE_BLACKBITMAP );
-}
-else
+// HACK. Normally, CanvasHelper does not care about
+// actually what mp2ndOutDev is...  well, here we do 
+// assume a 1bpp target - everything beyond 97%
+// transparency is fully transparent
+if( nTransparency  253 )
 {
 mp2ndOutDev-getOutDev().DrawPolyPolygon( aPolyPoly );
 }
@@ -715,8 +709,25 @@ namespace vclcanvas
 aBmpEx );
 
 if( mp2ndOutDev )
+{
+// HACK. Normally, CanvasHelper does not care about
+// actually what mp2ndOutDev is...  well, here we do 
+// assume a 1bpp target - everything beyond 97%
+// transparency is fully transparent
+if( aBmpEx.IsAlpha() )
+{
+Bitmap aMask( aBmpEx.GetAlpha().GetBitmap() );
+aMask.MakeMono( 253 );
+aBmpEx = BitmapEx( aBmpEx.GetBitmap(), aMask );
+}
+else if( aBmpEx.IsTransparent() )
+{
+aBmpEx = BitmapEx( aBmpEx.GetBitmap(), 
aBmpEx.GetMask() );
+}
+
 mp2ndOutDev-getOutDev().DrawBitmapEx( 
::vcl::unotools::pointFromB2DPoint( aOutputPos ),
aBmpEx );
+}
 
 // Returning a cache object is not useful, the XBitmap
 // itself serves this purpose
diff --git a/canvas/source/vcl/canvashelper_texturefill.cxx 
b/canvas/source/vcl/canvashelper_texturefill.cxx
index 325d2b6..3811ebd 100644
--- a/canvas/source/vcl/canvashelper_texturefill.cxx
+++ b/canvas/source/vcl/canvashelper_texturefill.cxx
@@ -555,8 +555,6 @@ namespace vclcanvas
   

[Libreoffice-commits] .: Branch 'libreoffice-3-5' - canvas/source

2012-03-19 Thread Tor Lillqvist
 canvas/source/vcl/canvashelper_texturefill.cxx |   52 -
 1 file changed, 52 deletions(-)

New commits:
commit a95769b378b9d4d77d4409cd72dcdccf32e32744
Author: Thorsten Behrens tbehr...@suse.com
Date:   Tue Mar 6 23:09:58 2012 +0100

Remove nasty xor hack for non-Mac vclcanvas

This nowadays really is a pessimization.

(cherry picked from commit 315d82d741c37d1b77f5687b1bdc48a37fb9f29f)

Signed-off-by: Tor Lillqvist tlillqv...@suse.com

diff --git a/canvas/source/vcl/canvashelper_texturefill.cxx 
b/canvas/source/vcl/canvashelper_texturefill.cxx
index 3811ebd..1021d33 100644
--- a/canvas/source/vcl/canvashelper_texturefill.cxx
+++ b/canvas/source/vcl/canvashelper_texturefill.cxx
@@ -615,7 +615,6 @@ namespace vclcanvas
 }
 }
 else
-#if defined(QUARTZ) // TODO: other ports should avoid the XOR-trick too 
(implementation vs. interface!)
 {
 const Region aPolyClipRegion( rPoly );
 
@@ -641,57 +640,6 @@ namespace vclcanvas
 p2ndOutDev-DrawPolyPolygon( rPoly );
 }
 }
-#else // TODO: remove once doing the XOR-trick in the canvas-layer becomes 
redundant
-{
-// output gradient the hard way: XORing out the polygon
-rOutDev.Push( PUSH_RASTEROP );
-rOutDev.SetRasterOp( ROP_XOR );
-doGradientFill( rOutDev,
-rValues,
-rColors,
-aTotalTransform,
-aPolygonDeviceRectOrig,
-nStepCount,
-true );
-rOutDev.SetFillColor( COL_BLACK );
-rOutDev.SetRasterOp( ROP_0 );
-rOutDev.DrawPolyPolygon( rPoly );
-rOutDev.SetRasterOp( ROP_XOR );
-doGradientFill( rOutDev,
-rValues,
-rColors,
-aTotalTransform,
-aPolygonDeviceRectOrig,
-nStepCount,
-true );
-rOutDev.Pop();
-
-if( p2ndOutDev )
-{
-p2ndOutDev-Push( PUSH_RASTEROP );
-p2ndOutDev-SetRasterOp( ROP_XOR );
-doGradientFill( *p2ndOutDev,
-rValues,
-rColors,
-aTotalTransform,
-aPolygonDeviceRectOrig,
-nStepCount,
-true );
-p2ndOutDev-SetFillColor( COL_BLACK );
-p2ndOutDev-SetRasterOp( ROP_0 );
-p2ndOutDev-DrawPolyPolygon( rPoly );
-p2ndOutDev-SetRasterOp( ROP_XOR );
-doGradientFill( *p2ndOutDev,
-rValues,
-rColors,
-aTotalTransform,
-aPolygonDeviceRectOrig,
-nStepCount,
-true );
-p2ndOutDev-Pop();
-}
-}
-#endif // complex-clipping vs. XOR-trick
 
 #if OSL_DEBUG_LEVEL  3
 // extra-verbosity
___
Libreoffice-commits mailing list
Libreoffice-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits