ooo-build r14336 - in trunk: . patches/test



Author: thorstenb
Date: Sat Oct 18 00:57:38 2008
New Revision: 14336
URL: http://svn.gnome.org/viewvc/ooo-build?rev=14336&view=rev

Log:
    * patches/test/opengl-canvas.diff: text working via glyph outlines
    now, much improvements in details
    * patches/test/vcl-bmp-correctness.diff: backup - fixing a lot of
    errors in vcl's canvasbitmap, and an omission in unx salbmp.cxx



Added:
   trunk/patches/test/vcl-bmp-correctness.diff
Modified:
   trunk/ChangeLog
   trunk/patches/test/opengl-canvas.diff

Modified: trunk/patches/test/opengl-canvas.diff
==============================================================================
--- trunk/patches/test/opengl-canvas.diff	(original)
+++ trunk/patches/test/opengl-canvas.diff	Sat Oct 18 00:57:38 2008
@@ -15,21 +15,22 @@
  canvas/source/opengl/makefile.mk                   |   65 ++
  canvas/source/opengl/ogl_bitmapcanvashelper.cxx    |  107 +++
  canvas/source/opengl/ogl_bitmapcanvashelper.hxx    |  106 +++
- canvas/source/opengl/ogl_canvasbitmap.cxx          |   62 ++
+ canvas/source/opengl/ogl_canvasbitmap.cxx          |   62 +
  canvas/source/opengl/ogl_canvasbitmap.hxx          |   81 ++
- canvas/source/opengl/ogl_canvascustomsprite.cxx    |  151 ++++
- canvas/source/opengl/ogl_canvascustomsprite.hxx    |  100 +++
+ canvas/source/opengl/ogl_canvascustomsprite.cxx    |  152 ++++
+ canvas/source/opengl/ogl_canvascustomsprite.hxx    |  100 ++
  canvas/source/opengl/ogl_canvasfont.cxx            |   88 ++
  canvas/source/opengl/ogl_canvasfont.hxx            |   72 ++
- canvas/source/opengl/ogl_canvashelper.cxx          |  707 ++++++++++++++++++++
- canvas/source/opengl/ogl_canvashelper.hxx          |  227 ++++++
- canvas/source/opengl/ogl_spritecanvas.cxx          |  202 ++++++
- canvas/source/opengl/ogl_spritecanvas.hxx          |  126 ++++
- canvas/source/opengl/ogl_spritedevicehelper.cxx    |  529 +++++++++++++++
+ canvas/source/opengl/ogl_canvashelper.cxx          |  829 ++++++++++++++++++++
+ canvas/source/opengl/ogl_canvashelper.hxx          |  227 +++++
+ canvas/source/opengl/ogl_spritecanvas.cxx          |  202 +++++
+ canvas/source/opengl/ogl_spritecanvas.hxx          |  126 +++
+ canvas/source/opengl/ogl_spritedevicehelper.cxx    |  529 +++++++++++++
  canvas/source/opengl/ogl_spritedevicehelper.hxx    |  119 +++
- canvas/source/opengl/ogl_textlayout.cxx            |  222 ++++++
+ canvas/source/opengl/ogl_textlayout.cxx            |  222 +++++
  canvas/source/opengl/ogl_textlayout.hxx            |   83 ++
  canvas/source/opengl/ogl_tools.hxx                 |   35 +
+ canvas/source/tools/canvastools.cxx                |   10 
  canvas/source/vcl/canvashelper.hxx                 |    1 
  cppcanvas/inc/cppcanvas/spritecanvas.hxx           |    4 
  cppcanvas/source/wrapper/implspritecanvas.cxx      |    4 
@@ -45,7 +46,7 @@
  sdext/source/presenter/PresenterSlideShowView.cxx  |   48 +
  sdext/source/presenter/PresenterSlideShowView.hxx  |    7 
  slideshow/source/engine/waitsymbol.cxx             |   13 
- 40 files changed, 3206 insertions(+), 45 deletions(-)
+ 41 files changed, 3334 insertions(+), 50 deletions(-)
  create mode 100644 canvas/source/opengl/exports.dxp
  create mode 100644 canvas/source/opengl/exports.map
  create mode 100644 canvas/source/opengl/makefile.mk
@@ -161,7 +162,7 @@
 +};
 diff --git canvas/source/opengl/makefile.mk canvas/source/opengl/makefile.mk
 new file mode 100644
-index 0000000..38aa412
+index 0000000..59973e6
 --- /dev/null
 +++ canvas/source/opengl/makefile.mk
 @@ -0,0 +1,65 @@
@@ -208,7 +209,7 @@
 +
 +
 +SHL1TARGET=$(TARGET).uno
-+SHL1STDLIBS= $(VCLLIB) $(TKLIB) $(CPPULIB) $(SALLIB) $(COMPHELPERLIB) $(CPPUHELPERLIB) $(BASEGFXLIB) $(CANVASTOOLSLIB)
++SHL1STDLIBS= $(VCLLIB) $(TOOLSLIB) $(TKLIB) $(CPPULIB) $(SALLIB) $(COMPHELPERLIB) $(CPPUHELPERLIB) $(BASEGFXLIB) $(CANVASTOOLSLIB)
 +
 +.IF "$(GUI)"=="UNX"
 +	SHL1STDLIBS += -lGL -lGLU -lX11
@@ -612,10 +613,10 @@
 +#endif
 diff --git canvas/source/opengl/ogl_canvascustomsprite.cxx canvas/source/opengl/ogl_canvascustomsprite.cxx
 new file mode 100644
-index 0000000..d791791
+index 0000000..4606018
 --- /dev/null
 +++ canvas/source/opengl/ogl_canvascustomsprite.cxx
-@@ -0,0 +1,151 @@
+@@ -0,0 +1,152 @@
 +/*************************************************************************
 + *
 + *    OpenOffice.org - a multi-platform office productivity suite
@@ -669,6 +670,7 @@
 +        ENSURE_OR_THROW( rRefDevice.get(),
 +                         "CanvasCustomSprite::CanvasCustomSprite(): Invalid sprite canvas" );
 +
++        maCanvasHelper.init( *rRefDevice.get() );
 +    }
 +    
 +    void SAL_CALL CanvasCustomSprite::disposing()
@@ -756,8 +758,8 @@
 +            {
 +                maTransformation.m00, maTransformation.m10, 0, 0,
 +                maTransformation.m01, maTransformation.m11, 0, 0,
-+                maTransformation.m02, maTransformation.m12, 1, 0,
-+                0,   0,   0, 1
++                0,                    0,                    1, 0,
++                maTransformation.m02, maTransformation.m12, 0, 1
 +            };
 +        glMultMatrixd(aGLTransform);
 +
@@ -1047,10 +1049,10 @@
 +#endif
 diff --git canvas/source/opengl/ogl_canvashelper.cxx canvas/source/opengl/ogl_canvashelper.cxx
 new file mode 100644
-index 0000000..f37605e
+index 0000000..2ab8711
 --- /dev/null
 +++ canvas/source/opengl/ogl_canvashelper.cxx
-@@ -0,0 +1,707 @@
+@@ -0,0 +1,829 @@
 +/*************************************************************************
 + *
 + *    OpenOffice.org - a multi-platform office productivity suite
@@ -1083,6 +1085,10 @@
 +#include <com/sun/star/rendering/PathCapType.hpp>
 +#include <com/sun/star/rendering/PathJoinType.hpp>
 +
++#include <vcl/virdev.hxx>
++#include <vcl/metric.hxx>
++#include <vcl/font.hxx>
++
 +#include "ogl_canvasfont.hxx"
 +#include "ogl_canvasbitmap.hxx"
 +#include "ogl_spritecanvas.hxx"
@@ -1092,6 +1098,8 @@
 +#include <GL/glu.h>
 +#include <GL/glext.h>
 +
++#include <boost/scoped_array.hpp>
++
 +
 +using namespace ::com::sun::star;
 +
@@ -1126,11 +1134,11 @@
 +
 +    struct CanvasHelper::Action
 +    {
-+        ::basegfx::B2DHomMatrix   maTransform;
-+        GLenum                    meSrcBlendMode;
-+        GLenum                    meDstBlendMode;
-+        rendering::ARGBColor      maARGBColor;
-+        ::basegfx::B2DPolyPolygon maPolyPoly;
++        ::basegfx::B2DHomMatrix         maTransform;
++        GLenum                          meSrcBlendMode;
++        GLenum                          meDstBlendMode;
++        rendering::ARGBColor            maARGBColor;
++        ::basegfx::B2DPolyPolygonVector maPolyPolys;
 +
 +        ::boost::function6< bool,
 +                            const CanvasHelper&,
@@ -1138,16 +1146,20 @@
 +                            GLenum,
 +                            GLenum,
 +                            const rendering::ARGBColor&,
-+                            const ::basegfx::B2DPolyPolygon& > maFunction;
++                            const ::basegfx::B2DPolyPolygonVector& > maFunction;
 +    };
 +
 +    namespace
 +    {
 +        void renderPolyPolygon( const ::basegfx::B2DPolyPolygon& rPolyPoly )
 +        {
-+            for( sal_uInt32 i=0; i<rPolyPoly.count(); i++ ) 
++            ::basegfx::B2DPolyPolygon aPolyPoly(rPolyPoly);
++            if( aPolyPoly.areControlPointsUsed() )
++                aPolyPoly = rPolyPoly.getDefaultAdaptiveSubdivision();
++
++            for( sal_uInt32 i=0; i<aPolyPoly.count(); i++ ) 
 +            {
-+                const ::basegfx::B2DPolygon& rPolygon( rPolyPoly.getB2DPolygon(i) );
++                const ::basegfx::B2DPolygon& rPolygon( aPolyPoly.getB2DPolygon(i) );
 +
 +                const sal_uInt32 nPts=rPolygon.count();
 +                const sal_uInt32 nExtPts=nPts + rPolygon.isClosed();
@@ -1169,8 +1181,8 @@
 +                {
 +                    rTransform.get(0,0), rTransform.get(1,0), 0, 0,
 +                    rTransform.get(0,1), rTransform.get(1,1), 0, 0,
-+                    rTransform.get(0,2), rTransform.get(1,2), 1, 0,
-+                    0,                   0,                   0, 1
++                    0,                   0,                   1, 0,
++                    rTransform.get(0,2), rTransform.get(1,2), 0, 1
 +                };
 +            glMultMatrixd(aGLTransform);
 +
@@ -1226,36 +1238,46 @@
 +            return true;
 +        }
 +
-+        bool lcl_drawPolyPolygon( const CanvasHelper&              /*rHelper*/,
-+                                  const ::basegfx::B2DHomMatrix&   rTransform,
-+                                  GLenum                           eSrcBlend,
-+                                  GLenum                           eDstBlend,
-+                                  const rendering::ARGBColor&      rColor,
-+                                  const ::basegfx::B2DPolyPolygon& rPolyPolygon )
++        bool lcl_drawPolyPolygon( const CanvasHelper&                    /*rHelper*/,
++                                  const ::basegfx::B2DHomMatrix&         rTransform,
++                                  GLenum                                 eSrcBlend,
++                                  GLenum                                 eDstBlend,
++                                  const rendering::ARGBColor&            rColor,
++                                  const ::basegfx::B2DPolyPolygonVector& rPolyPolygons )
 +        {
 +            TransformationPreserver aPreserver;
 +            setupState(rTransform, eSrcBlend, eDstBlend, rColor);
 +
-+            glBegin(GL_LINES);
-+            renderPolyPolygon(rPolyPolygon);
-+            glEnd();
++            ::basegfx::B2DPolyPolygonVector::const_iterator aCurr=rPolyPolygons.begin();
++            const ::basegfx::B2DPolyPolygonVector::const_iterator aEnd=rPolyPolygons.end();
++            while( aCurr != aEnd )
++            {
++                glBegin(GL_LINE_STRIP);
++                renderPolyPolygon(*aCurr++);
++                glEnd();
++            }
 +
 +            return true;
 +        }
 +
-+        bool lcl_fillPolyPolygon( const CanvasHelper&              /*rHelper*/,
-+                                  const ::basegfx::B2DHomMatrix&   rTransform,
-+                                  GLenum                           eSrcBlend,
-+                                  GLenum                           eDstBlend,
-+                                  const rendering::ARGBColor&      rColor,
-+                                  const ::basegfx::B2DPolyPolygon& rPolyPolygon )
++        bool lcl_fillPolyPolygon( const CanvasHelper&                    /*rHelper*/,
++                                  const ::basegfx::B2DHomMatrix&         rTransform,
++                                  GLenum                                 eSrcBlend,
++                                  GLenum                                 eDstBlend,
++                                  const rendering::ARGBColor&            rColor,
++                                  const ::basegfx::B2DPolyPolygonVector& rPolyPolygons )
 +        {
 +            TransformationPreserver aPreserver;
 +            setupState(rTransform, eSrcBlend, eDstBlend, rColor);
 +
-+            glBegin(GL_POLYGON);
-+            renderPolyPolygon(rPolyPolygon);
-+            glEnd();
++            ::basegfx::B2DPolyPolygonVector::const_iterator aCurr=rPolyPolygons.begin();
++            const ::basegfx::B2DPolyPolygonVector::const_iterator aEnd=rPolyPolygons.end();
++            while( aCurr != aEnd )
++            {
++                glBegin(GL_POLYGON);
++                renderPolyPolygon(*aCurr++);
++                glEnd();
++            }
 +
 +            return true;
 +        }
@@ -1292,19 +1314,30 @@
 +            // TODO(E3): handle limited texture sizes -
 +            // glGetIntegerv(GL_MAX_TEXTURE_SIZE)
 +
-+            gluBuild2DMipmaps(GL_TEXTURE_2D, 
-+                              4, 
-+                              rPixelSize.Width, 
-+                              rPixelSize.Height, 
-+                              GL_RGBA, 
-+                              GL_UNSIGNED_BYTE,
-+                              &rPixelData[0]);
++            glTexImage2D(GL_TEXTURE_2D,
++                         0,
++                         4,
++                         rPixelSize.Width, 
++                         rPixelSize.Height, 
++                         0,
++                         GL_RGBA, 
++                         GL_UNSIGNED_INT_8_8_8_8_REV,
++                         &rPixelData[0]);
 +            glEnable(GL_TEXTURE_2D);
++            glTexParameteri(GL_TEXTURE_2D,
++                            GL_TEXTURE_MIN_FILTER,
++                            GL_NEAREST);
++            glTexParameteri(GL_TEXTURE_2D,
++                            GL_TEXTURE_MAG_FILTER,
++                            GL_NEAREST);
++            glDisable(GL_BLEND);
++            glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL);
++
 +            glBegin(GL_TRIANGLE_STRIP);
 +            glTexCoord2f(0,0); glVertex2d(0,0);
-+            glTexCoord2f(1,0); glVertex2d(rPixelSize.Width, 0);
-+            glTexCoord2f(1,1); glVertex2d(rPixelSize.Width, rPixelSize.Height);
 +            glTexCoord2f(0,1); glVertex2d(0, rPixelSize.Height);
++            glTexCoord2f(1,0); glVertex2d(rPixelSize.Width,0);
++            glTexCoord2f(1,1); glVertex2d(rPixelSize.Width,rPixelSize.Height);
 +            glEnd();
 +
 +            glDeleteTextures(1, &nTexture);
@@ -1417,9 +1450,9 @@
 +            Action& rAct=mpRecordedActions->back();
 +
 +            setupGraphicsState( rAct, viewState, renderState );
-+            rAct.maPolyPoly = 
-+                ::basegfx::unotools::b2DPolyPolygonFromXPolyPolygon2D(xPolyPolygon);
-+            rAct.maPolyPoly.makeUnique(); // own copy, for thread safety
++            rAct.maPolyPolys.push_back(
++                ::basegfx::unotools::b2DPolyPolygonFromXPolyPolygon2D(xPolyPolygon));
++            rAct.maPolyPolys.back().makeUnique(); // own copy, for thread safety
 +
 +            rAct.maFunction = &lcl_drawPolyPolygon;
 +        }
@@ -1443,9 +1476,9 @@
 +            Action& rAct=mpRecordedActions->back();
 +
 +            setupGraphicsState( rAct, viewState, renderState );
-+            rAct.maPolyPoly = 
-+                ::basegfx::unotools::b2DPolyPolygonFromXPolyPolygon2D(xPolyPolygon);
-+            rAct.maPolyPoly.makeUnique(); // own copy, for thread safety
++            rAct.maPolyPolys.push_back( 
++                ::basegfx::unotools::b2DPolyPolygonFromXPolyPolygon2D(xPolyPolygon));
++            rAct.maPolyPolys.back().makeUnique(); // own copy, for thread safety
 +
 +            // TODO(F3): fallback to drawPolyPolygon currently
 +            rAct.maFunction = &lcl_drawPolyPolygon;
@@ -1502,9 +1535,9 @@
 +            Action& rAct=mpRecordedActions->back();
 +
 +            setupGraphicsState( rAct, viewState, renderState );
-+            rAct.maPolyPoly = 
-+                ::basegfx::unotools::b2DPolyPolygonFromXPolyPolygon2D(xPolyPolygon);
-+            rAct.maPolyPoly.makeUnique(); // own copy, for thread safety
++            rAct.maPolyPolys.push_back(
++                ::basegfx::unotools::b2DPolyPolygonFromXPolyPolygon2D(xPolyPolygon));
++            rAct.maPolyPolys.back().makeUnique(); // own copy, for thread safety
 +
 +            rAct.maFunction = &lcl_fillPolyPolygon;
 +        }
@@ -1513,11 +1546,11 @@
 +        return uno::Reference< rendering::XCachedPrimitive >(NULL);
 +    }
 +
-+    uno::Reference< rendering::XCachedPrimitive > CanvasHelper::fillTexturedPolyPolygon( const rendering::XCanvas* 							/*pCanvas*/, 
++    uno::Reference< rendering::XCachedPrimitive > CanvasHelper::fillTexturedPolyPolygon( const rendering::XCanvas*                          /*pCanvas*/, 
 +                                                                                         const uno::Reference< rendering::XPolyPolygon2D >& /*xPolyPolygon*/,
-+                                                                                         const rendering::ViewState& 						/*viewState*/,
-+                                                                                         const rendering::RenderState& 						/*renderState*/,
-+                                                                                         const uno::Sequence< rendering::Texture >& 		/*textures*/ )
++                                                                                         const rendering::ViewState&                        /*viewState*/,
++                                                                                         const rendering::RenderState&                      /*renderState*/,
++                                                                                         const uno::Sequence< rendering::Texture >&         /*textures*/ )
 +    {
 +        // TODO(P1): Provide caching here.
 +        return uno::Reference< rendering::XCachedPrimitive >(NULL);
@@ -1566,10 +1599,101 @@
 +    }
 +
 +    uno::Reference< rendering::XCachedPrimitive > CanvasHelper::drawTextLayout( const rendering::XCanvas*                       /*pCanvas*/, 
-+                                                                                const uno::Reference< rendering::XTextLayout >& /*xLayoutetText*/, 
-+                                                                                const rendering::ViewState&                     /*viewState*/, 
-+                                                                                const rendering::RenderState&                   /*renderState*/ )
++                                                                                const uno::Reference< rendering::XTextLayout >& xLayoutetText, 
++                                                                                const rendering::ViewState&                     viewState, 
++                                                                                const rendering::RenderState&                   renderState )
 +    {
++        ENSURE_OR_THROW( xLayoutetText.is(), 
++                          "CanvasHelper::drawTextLayout: text is NULL");
++
++        if( mpDevice )
++        {
++            VirtualDevice aVDev;
++            aVDev.EnableOutput(FALSE);
++
++            CanvasFont* pFont=dynamic_cast<CanvasFont*>(xLayoutetText->getFont().get());
++            const rendering::StringContext& rTxt=xLayoutetText->getText();
++            if( pFont && rTxt.Length )
++            {
++                // create the font
++                const rendering::FontRequest& rFontRequest = pFont->getFontRequest();
++                const geometry::Matrix2D&     rFontMatrix = pFont->getFontMatrix();
++                ::Font aFont(
++                    rFontRequest.FontDescription.FamilyName,
++                    rFontRequest.FontDescription.StyleName,
++                    Size( 0, ::basegfx::fround(rFontRequest.CellSize)));
++
++                aFont.SetAlign( ALIGN_BASELINE );
++                aFont.SetCharSet( (rFontRequest.FontDescription.IsSymbolFont==util::TriState_YES) ? RTL_TEXTENCODING_SYMBOL : RTL_TEXTENCODING_UNICODE );
++                aFont.SetVertical( (rFontRequest.FontDescription.IsVertical==util::TriState_YES) ? TRUE : FALSE );
++                aFont.SetWeight( static_cast<FontWeight>(rFontRequest.FontDescription.FontDescription.Weight) );
++                aFont.SetItalic( (rFontRequest.FontDescription.FontDescription.Letterform<=8) ? ITALIC_NONE : ITALIC_NORMAL );
++
++                // adjust to stretched font
++                if(!::rtl::math::approxEqual(rFontMatrix.m00, rFontMatrix.m11))
++                {
++                    const Size aSize = aVDev.GetFontMetric( aFont ).GetSize();
++                    const double fDividend( rFontMatrix.m10 + rFontMatrix.m11 );
++                    double fStretch = (rFontMatrix.m00 + rFontMatrix.m01);
++
++                    if( !::basegfx::fTools::equalZero( fDividend) )
++                        fStretch /= fDividend;
++
++                    const sal_Int32 nNewWidth = ::basegfx::fround( aSize.Width() * fStretch );
++
++                    aFont.SetWidth( nNewWidth );
++                }
++
++                // set font
++                aVDev.SetFont(aFont);
++
++                const Point aEmptyPoint(0, 0);
++                const String aText(rTxt.Text.getStr());
++
++                mpRecordedActions->push_back( Action() );
++                Action& rAct=mpRecordedActions->back();
++                
++                setupGraphicsState( rAct, viewState, renderState );
++                
++                // handle custom spacing, if there
++                uno::Sequence<double> aLogicalAdvancements=xLayoutetText->queryLogicalAdvancements();
++                if( aLogicalAdvancements.getLength() )
++                {
++                    // create the DXArray
++                    const sal_Int32 nLen( aLogicalAdvancements.getLength() );
++                    ::boost::scoped_array<sal_Int32> pDXArray( new sal_Int32[nLen] );
++                    for( sal_Int32 i=0; i<nLen; ++i )
++                        pDXArray[i] = basegfx::fround( aLogicalAdvancements[i] );
++
++                    // get the glyphs
++                    aVDev.GetTextOutlines(rAct.maPolyPolys,
++                                          rTxt.Text,
++                                          0,
++                                          (xub_StrLen)rTxt.StartPosition,
++                                          (xub_StrLen)rTxt.Length,
++                                          TRUE,
++                                          0,
++                                          pDXArray.get() );
++                }
++                else
++                {
++                    // get the glyphs
++                    aVDev.GetTextOutlines(rAct.maPolyPolys,
++                                          rTxt.Text,
++                                          0,
++                                          (xub_StrLen)rTxt.StartPosition,
++                                          (xub_StrLen)rTxt.Length );
++                }
++
++                // own copy, for thread safety 
++                std::for_each(rAct.maPolyPolys.begin(),
++                              rAct.maPolyPolys.end(),
++                              ::boost::mem_fn(&::basegfx::B2DPolyPolygon::makeUnique));
++                
++                rAct.maFunction = &lcl_fillPolyPolygon;
++            }
++        }        
++        
 +        // TODO
 +        return uno::Reference< rendering::XCachedPrimitive >(NULL);
 +    }
@@ -1749,7 +1873,7 @@
 +                                    aCurr->meSrcBlendMode,
 +                                    aCurr->meDstBlendMode,
 +                                    aCurr->maARGBColor,
-+                                    aCurr->maPolyPoly ) )
++                                    aCurr->maPolyPolys ) )
 +                return false;
 +
 +            ++aCurr;
@@ -2333,7 +2457,7 @@
 +#endif
 diff --git canvas/source/opengl/ogl_spritedevicehelper.cxx canvas/source/opengl/ogl_spritedevicehelper.cxx
 new file mode 100644
-index 0000000..d0fdf07
+index 0000000..f5209de
 --- /dev/null
 +++ canvas/source/opengl/ogl_spritedevicehelper.cxx
 @@ -0,0 +1,529 @@
@@ -2574,7 +2698,7 @@
 +            // need the backside for mirror effects
 +            glDisable(GL_CULL_FACE);
 +
-+            // no perspective, we're 2D
++            // no perspective, we're 2D 
 +            glMatrixMode(GL_PROJECTION);
 +            glLoadIdentity();
 +
@@ -2847,7 +2971,7 @@
 +    {
 +        if( mpChildWindow )
 +            mpChildWindow->SetPosSizePixel(
-+                0,0,rBounds.Width, rBounds.Height);
++                0,0,rBounds.Width,rBounds.Height);
 +    }
 +
 +    void SpriteDeviceHelper::dumpScreenContent() const
@@ -3310,7 +3434,7 @@
 +#endif
 diff --git canvas/source/opengl/ogl_tools.hxx canvas/source/opengl/ogl_tools.hxx
 new file mode 100644
-index 0000000..db58e5c
+index 0000000..e7575d4
 --- /dev/null
 +++ canvas/source/opengl/ogl_tools.hxx
 @@ -0,0 +1,35 @@
@@ -3341,14 +3465,63 @@
 +    struct TransformationPreserver
 +    {
 +        TransformationPreserver()
-+        { glPushAttrib(GL_TRANSFORM_BIT); }
++        { glPushMatrix(); }
 +
 +        ~TransformationPreserver()
-+        { glPopAttrib(); }
++        { glPopMatrix(); }
 +    };
 +}
 +
 +#endif
+diff --git canvas/source/tools/canvastools.cxx canvas/source/tools/canvastools.cxx
+index f0fc3e3..7b4b04e 100644
+--- canvas/source/tools/canvastools.cxx
++++ canvas/source/tools/canvastools.cxx
+@@ -434,7 +434,7 @@ namespace canvas
+                             *pOut++ = vcl::unotools::toDoubleColor(*pIn++);
+                             *pOut++ = vcl::unotools::toDoubleColor(*pIn++);
+                             *pOut++ = vcl::unotools::toDoubleColor(*pIn++);
+-                            *pOut++ = vcl::unotools::toDoubleColor(255-*pIn++);
++                            *pOut++ = vcl::unotools::toDoubleColor(*pIn++);
+                         }
+                         return aRes;
+                     }
+@@ -499,7 +499,7 @@ namespace canvas
+                     for( sal_Size i=0; i<nLen; i+=4 )
+                     {
+                         *pOut++ = rendering::ARGBColor(
+-                            vcl::unotools::toDoubleColor(255-pIn[3]),
++                            vcl::unotools::toDoubleColor(pIn[3]),
+                             vcl::unotools::toDoubleColor(pIn[0]),
+                             vcl::unotools::toDoubleColor(pIn[1]),
+                             vcl::unotools::toDoubleColor(pIn[2]));
+@@ -520,7 +520,7 @@ namespace canvas
+                     rendering::ARGBColor* pOut( aRes.getArray() );
+                     for( sal_Size i=0; i<nLen; i+=4 )
+                     {
+-                        const sal_Int8 nAlpha( 255-pIn[3] );
++                        const sal_Int8 nAlpha( pIn[3] );
+                         *pOut++ = rendering::ARGBColor(
+                             vcl::unotools::toDoubleColor(nAlpha),
+                             vcl::unotools::toDoubleColor(nAlpha*pIn[0]),
+@@ -561,7 +561,7 @@ namespace canvas
+                         *pColors++ = vcl::unotools::toByteColor(pIn->Red);
+                         *pColors++ = vcl::unotools::toByteColor(pIn->Green);
+                         *pColors++ = vcl::unotools::toByteColor(pIn->Blue);
+-                        *pColors++ = 255-vcl::unotools::toByteColor(pIn->Alpha);
++                        *pColors++ = vcl::unotools::toByteColor(pIn->Alpha);
+                         ++pIn;
+                     }
+                     return aRes;
+@@ -579,7 +579,7 @@ namespace canvas
+                         *pColors++ = vcl::unotools::toByteColor(pIn->Red/pIn->Alpha);
+                         *pColors++ = vcl::unotools::toByteColor(pIn->Green/pIn->Alpha);
+                         *pColors++ = vcl::unotools::toByteColor(pIn->Blue/pIn->Alpha);
+-                        *pColors++ = 255-vcl::unotools::toByteColor(pIn->Alpha);
++                        *pColors++ = vcl::unotools::toByteColor(pIn->Alpha);
+                         ++pIn;
+                     }
+                     return aRes;
 diff --git canvas/source/vcl/canvashelper.hxx canvas/source/vcl/canvashelper.hxx
 index 30d9677..923d02d 100644
 --- canvas/source/vcl/canvashelper.hxx

Added: trunk/patches/test/vcl-bmp-correctness.diff
==============================================================================
--- (empty file)
+++ trunk/patches/test/vcl-bmp-correctness.diff	Sat Oct 18 00:57:38 2008
@@ -0,0 +1,566 @@
+Fixes to broken VclCanvasBitmap class & unit test
+
+From: Thorsten Behrens <thb openoffice org>
+
+
+---
+
+ vcl/source/helper/canvasbitmap.cxx |    8 -
+ vcl/source/helper/canvastools.cxx  |   63 ++++++++--
+ vcl/test/canvasbitmaptest.cxx      |  228 +++++++++++++++++++++---------------
+ vcl/test/makefile.mk               |    9 -
+ vcl/unx/source/gdi/salbmp.cxx      |   12 +-
+ 5 files changed, 189 insertions(+), 131 deletions(-)
+
+
+diff --git vcl/source/helper/canvasbitmap.cxx vcl/source/helper/canvasbitmap.cxx
+index 12eaa5e..3999a73 100644
+--- vcl/source/helper/canvasbitmap.cxx
++++ vcl/source/helper/canvasbitmap.cxx
+@@ -150,9 +150,6 @@ VclCanvasBitmap::VclCanvasBitmap( const BitmapEx& rBitmap ) :
+         m_aLayout.ScanLineStride = m_pBmpAcc->GetScanlineSize();
+         m_aLayout.PlaneStride    = 0;
+ 
+-        if( !(m_pBmpAcc->GetScanlineFormat() & BMP_FORMAT_TOP_DOWN) )
+-            m_aLayout.ScanLineStride *= -1;
+-
+         switch( m_pBmpAcc->GetScanlineFormat() )
+         {
+             case BMP_FORMAT_1BIT_MSB_PAL:
+@@ -436,8 +433,6 @@ VclCanvasBitmap::VclCanvasBitmap( const BitmapEx& rBitmap ) :
+             const Size aSize = m_aBitmap.GetSizePixel();
+             m_aLayout.ScanLineBytes  = 
+             m_aLayout.ScanLineStride = (aSize.Width()*m_nBitsPerOutputPixel + 7)/8;
+-            if( !(m_pBmpAcc->GetScanlineFormat() & BMP_FORMAT_TOP_DOWN) )
+-                m_aLayout.ScanLineStride *= -1;
+         }
+     }
+ }
+@@ -514,9 +509,6 @@ uno::Sequence< sal_Int8 > SAL_CALL VclCanvasBitmap::getData( rendering::IntegerB
+     bitmapLayout.ScanLines     = aRequestedBytes.getHeight();
+     bitmapLayout.ScanLineBytes = 
+     bitmapLayout.ScanLineStride= aRequestedBytes.getWidth();
+-        
+-    if( !(m_pBmpAcc->GetScanlineFormat() & BMP_FORMAT_TOP_DOWN) )
+-        bitmapLayout.ScanLineStride *= -1;
+ 
+     if( !m_aBmpEx.IsTransparent() )
+     {
+diff --git vcl/source/helper/canvastools.cxx vcl/source/helper/canvastools.cxx
+index 85df8df..f94d923 100644
+--- vcl/source/helper/canvastools.cxx
++++ vcl/source/helper/canvastools.cxx
+@@ -250,28 +250,61 @@ namespace vcl
+                     {
+                         // read ARGB color
+                         aARGBColors = rLayout.ColorSpace->convertIntegerToARGB(aPixelData);
+-                        for( sal_Int32 x=0; x<nWidth; ++x )
++
++                        if( rWriteAcc->HasPalette() )
++                        {
++                            for( sal_Int32 x=0; x<nWidth; ++x )
++                            {
++                                const rendering::ARGBColor& rColor=aARGBColors[x];
++                                rWriteAcc->SetPixel( aRect.Y1, x,
++                                                     rWriteAcc->GetBestPaletteIndex(
++                                                         BitmapColor( toByteColor(rColor.Red),
++                                                                      toByteColor(rColor.Green),
++                                                                      toByteColor(rColor.Blue))) );
++                                rAlphaAcc->SetPixel( aRect.Y1, x,
++                                                     BitmapColor( 255 - toByteColor(rColor.Alpha) ));
++                            }
++                        }
++                        else
+                         {
+-                            const rendering::ARGBColor& rColor=aARGBColors[x];
+-                            rWriteAcc->SetPixel( aRect.Y1, x,
+-                                                 BitmapColor( toByteColor(rColor.Red),
+-                                                              toByteColor(rColor.Green),
+-                                                              toByteColor(rColor.Blue) ));
+-                            rAlphaAcc->SetPixel( aRect.Y1, x,
+-                                                 BitmapColor( 255 - toByteColor(rColor.Alpha) ));
++                            for( sal_Int32 x=0; x<nWidth; ++x )
++                            {
++                                const rendering::ARGBColor& rColor=aARGBColors[x];
++                                rWriteAcc->SetPixel( aRect.Y1, x,
++                                                     BitmapColor( toByteColor(rColor.Red),
++                                                                  toByteColor(rColor.Green),
++                                                                  toByteColor(rColor.Blue) ));
++                                rAlphaAcc->SetPixel( aRect.Y1, x,
++                                                     BitmapColor( 255 - toByteColor(rColor.Alpha) ));
++                            }
+                         }
+                     }
+                     else
+                     {
+                         // read RGB color
+                         aRGBColors = rLayout.ColorSpace->convertIntegerToRGB(aPixelData);
+-                        for( sal_Int32 x=0; x<nWidth; ++x )
++                        if( rWriteAcc->HasPalette() )
+                         {
+-                            const rendering::RGBColor& rColor=aRGBColors[x];
+-                            rWriteAcc->SetPixel( aRect.Y1, x,
+-                                                 BitmapColor( toByteColor(rColor.Red),
+-                                                              toByteColor(rColor.Green),
+-                                                              toByteColor(rColor.Blue) ));
++                            for( sal_Int32 x=0; x<nWidth; ++x )
++                            {
++                                const rendering::RGBColor& rColor=aRGBColors[x];
++                                rWriteAcc->SetPixel( aRect.Y1, x,
++                                                     rWriteAcc->GetBestPaletteIndex(
++                                                         BitmapColor( toByteColor(rColor.Red),
++                                                                      toByteColor(rColor.Green),
++                                                                      toByteColor(rColor.Blue))) );
++                            }
++                        }
++                        else
++                        {
++                            for( sal_Int32 x=0; x<nWidth; ++x )
++                            {
++                                const rendering::RGBColor& rColor=aRGBColors[x];
++                                rWriteAcc->SetPixel( aRect.Y1, x,
++                                                     BitmapColor( toByteColor(rColor.Red),
++                                                                  toByteColor(rColor.Green),
++                                                                  toByteColor(rColor.Blue) ));
++                            }
+                         }
+                     }
+                 }
+@@ -404,7 +437,7 @@ namespace vcl
+                 { // limit scoped access 
+                     ScopedBitmapWriteAccess pWriteAccess( aBitmap.AcquireWriteAccess(),
+                                                           aBitmap );
+-                    ScopedBitmapWriteAccess pAlphaWriteAccess( aAlpha.AcquireWriteAccess(),
++                    ScopedBitmapWriteAccess pAlphaWriteAccess( nAlphaDepth ? aAlpha.AcquireWriteAccess() : NULL,
+                                                                aAlpha );
+ 
+                     ENSURE_OR_THROW(pWriteAccess.get() != NULL,
+diff --git vcl/test/canvasbitmaptest.cxx vcl/test/canvasbitmaptest.cxx
+index 78793c8..a950496 100644
+--- vcl/test/canvasbitmaptest.cxx
++++ vcl/test/canvasbitmaptest.cxx
+@@ -32,6 +32,7 @@
+ #include "precompiled_vcl.hxx"
+ 
+ // bootstrap stuff
++#include <sal/main.h>
+ #include <rtl/bootstrap.hxx>
+ #include <rtl/ref.hxx>
+ #include <comphelper/processfactory.hxx>
+@@ -54,20 +55,45 @@
+ #include <cppuhelper/compbase3.hxx>
+ 
+ #include <tools/diagnose_ex.h>
++#include <tools/extendapplicationenvironment.hxx>
+ 
+ #include "vcl/svapp.hxx"
+ #include "vcl/canvastools.hxx"
++#include "vcl/canvasbitmap.hxx"
+ #include "vcl/dialog.hxx"
+ #include "vcl/outdev.hxx"
+ #include "vcl/bmpacc.hxx"
+ #include "vcl/virdev.hxx"
+ #include "vcl/bitmapex.hxx"
+-#include "canvasbitmap.hxx"
+ 
+ 
+ using namespace ::com::sun::star;
+ using namespace ::vcl::unotools;
+ 
++// -----------------------------------------------------------------------
++
++void Main();
++
++// -----------------------------------------------------------------------
++
++SAL_IMPLEMENT_MAIN()
++{
++    tools::extendApplicationEnvironment();
++
++    uno::Reference< lang::XMultiServiceFactory > xMS;
++    xMS = cppu::createRegistryServiceFactory( 
++        rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "applicat.rdb" ) ), 
++        sal_True );
++
++    InitVCL( xMS );
++    ::Main();
++    DeInitVCL();
++
++    return 0;
++}
++
++// -----------------------------------------------------------------------
++
+ namespace com { namespace sun { namespace star { namespace rendering
+ {
+ 
+@@ -192,8 +218,8 @@ void checkCanvasBitmap( const rtl::Reference<VclCanvasBitmap>& xBmp,
+     test( aPixelData2.getLength() == aPixelData.getLength(),
+           "getData and getPixel return same amount of data" );
+ 
+-    aPixelData = xBmp->getData(aLayout, geometry::IntegerRectangle2D(0,0,200,1));
+-    test( aLayout.ScanLines == 1,
++    aPixelData = xBmp->getData(aLayout, geometry::IntegerRectangle2D(0,0,200,2));
++    test( aLayout.ScanLines == 2,
+           "# scanlines" );
+     test( aLayout.ScanLineBytes == (200*nExpectedBitsPerPixel+7)/8,
+           "# scanline bytes" );
+@@ -258,28 +284,28 @@ void checkCanvasBitmap( const rtl::Reference<VclCanvasBitmap>& xBmp,
+     if( nOriginalDepth > 8 )
+     {
+         const uno::Sequence<sal_Int8> aComponentTags( xBmp->getComponentTags() );
+-        uno::Sequence<rendering::ARGBColor> aARGBColors(1);
+-        uno::Sequence<rendering::RGBColor>  aRGBColors(1);
++        uno::Sequence<rendering::ARGBColor> aARGBColor(1);
++        uno::Sequence<rendering::RGBColor>  aRGBColor(1);
+         uno::Sequence<sal_Int8> aPixel3, aPixel4;
+ 
+         const Color aCol(COL_GREEN);
+-        aARGBColors[0].Red   = vcl::unotools::toDoubleColor(aCol.GetRed());
+-        aARGBColors[0].Green = vcl::unotools::toDoubleColor(aCol.GetGreen());
+-        aARGBColors[0].Blue  = vcl::unotools::toDoubleColor(aCol.GetBlue());
+-        aARGBColors[0].Alpha = 1.0;
++        aARGBColor[0].Red   = vcl::unotools::toDoubleColor(aCol.GetRed());
++        aARGBColor[0].Green = vcl::unotools::toDoubleColor(aCol.GetGreen());
++        aARGBColor[0].Blue  = vcl::unotools::toDoubleColor(aCol.GetBlue());
++        aARGBColor[0].Alpha = 1.0;
+ 
+-        aRGBColors[0].Red   = vcl::unotools::toDoubleColor(aCol.GetRed());
+-        aRGBColors[0].Green = vcl::unotools::toDoubleColor(aCol.GetGreen());
+-        aRGBColors[0].Blue  = vcl::unotools::toDoubleColor(aCol.GetBlue());
++        aRGBColor[0].Red   = vcl::unotools::toDoubleColor(aCol.GetRed());
++        aRGBColor[0].Green = vcl::unotools::toDoubleColor(aCol.GetGreen());
++        aRGBColor[0].Blue  = vcl::unotools::toDoubleColor(aCol.GetBlue());
+ 
+-        aPixel3 = xBmp->convertIntegerFromARGB( aARGBColors );
++        aPixel3 = xBmp->convertIntegerFromARGB( aARGBColor );
+         aPixel4 = xBmp->getPixel( aLayout, geometry::IntegerPoint2D(5,0) );
+         test( aPixel3 == aPixel4,
+               "Green pixel from bitmap matches with manually converted green pixel" );
+ 
+         if( !aContainedBmpEx.IsTransparent() )
+         {
+-            aPixel3 = xBmp->convertIntegerFromRGB( aRGBColors );
++            aPixel3 = xBmp->convertIntegerFromRGB( aRGBColor );
+             test( aPixel3 == aPixel4,
+                   "Green pixel from bitmap matches with manually RGB-converted green pixel" );
+         }
+@@ -409,28 +435,28 @@ void checkBitmapImport( const rtl::Reference<VclCanvasBitmap>& xBmp,
+     if( nOriginalDepth > 8 )
+     {
+         const uno::Sequence<sal_Int8> aComponentTags( xBmp->getComponentTags() );
+-        uno::Sequence<rendering::ARGBColor> aARGBColors(1);
+-        uno::Sequence<rendering::RGBColor>  aRGBColors(1);
++        uno::Sequence<rendering::ARGBColor> aARGBColor(1);
++        uno::Sequence<rendering::RGBColor>  aRGBColor(1);
+         uno::Sequence<sal_Int8> aPixel3, aPixel4;
+ 
+         const Color aCol(COL_GREEN);
+-        aARGBColors[0].Red   = vcl::unotools::toDoubleColor(aCol.GetRed());
+-        aARGBColors[0].Green = vcl::unotools::toDoubleColor(aCol.GetGreen());
+-        aARGBColors[0].Blue  = vcl::unotools::toDoubleColor(aCol.GetBlue());
+-        aARGBColors[0].Alpha = 1.0;
++        aARGBColor[0].Red   = vcl::unotools::toDoubleColor(aCol.GetRed());
++        aARGBColor[0].Green = vcl::unotools::toDoubleColor(aCol.GetGreen());
++        aARGBColor[0].Blue  = vcl::unotools::toDoubleColor(aCol.GetBlue());
++        aARGBColor[0].Alpha = 1.0;
+ 
+-        aRGBColors[0].Red   = vcl::unotools::toDoubleColor(aCol.GetRed());
+-        aRGBColors[0].Green = vcl::unotools::toDoubleColor(aCol.GetGreen());
+-        aRGBColors[0].Blue  = vcl::unotools::toDoubleColor(aCol.GetBlue());
++        aRGBColor[0].Red   = vcl::unotools::toDoubleColor(aCol.GetRed());
++        aRGBColor[0].Green = vcl::unotools::toDoubleColor(aCol.GetGreen());
++        aRGBColor[0].Blue  = vcl::unotools::toDoubleColor(aCol.GetBlue());
+ 
+-        aPixel3 = xBmp->convertIntegerFromARGB( aARGBColors );
++        aPixel3 = xBmp->convertIntegerFromARGB( aARGBColor );
+         aPixel4 = xBmp->getPixel( aLayout, geometry::IntegerPoint2D(5,0) );
+         test( aPixel3 == aPixel4,
+               "Green pixel from bitmap matches with manually converted green pixel" );
+ 
+         if( !aContainedBmpEx.IsTransparent() )
+         {
+-            aPixel3 = xBmp->convertIntegerFromRGB( aRGBColors );
++            aPixel3 = xBmp->convertIntegerFromRGB( aRGBColor );
+             test( aPixel3 == aPixel4,
+                   "Green pixel from bitmap matches with manually RGB-converted green pixel" );
+         }
+@@ -631,6 +657,13 @@ private:
+         return uno::Sequence< rendering::ARGBColor >();
+     }
+ 
++    virtual uno::Sequence< rendering::ARGBColor > SAL_CALL convertToPARGB( const uno::Sequence< double >& ) throw (lang::IllegalArgumentException, 
++                                                                                                                   uno::RuntimeException)
++    {
++        test(false, "Method not implemented");
++        return uno::Sequence< rendering::ARGBColor >();
++    }
++
+     virtual uno::Sequence< double > SAL_CALL convertFromRGB( const uno::Sequence< rendering::RGBColor >& ) throw (lang::IllegalArgumentException, 
+                                                                                                                   uno::RuntimeException)
+     {
+@@ -645,6 +678,13 @@ private:
+         return uno::Sequence< double >();
+     }
+ 
++    virtual uno::Sequence< double > SAL_CALL convertFromPARGB( const uno::Sequence< rendering::ARGBColor >& ) throw (lang::IllegalArgumentException, 
++                                                                                                                    uno::RuntimeException)
++    {
++        test(false, "This method is not expected to be called!");
++        return uno::Sequence< double >();
++    }
++
+     virtual ::sal_Int32 SAL_CALL getBitsPerPixel(  ) throw (uno::RuntimeException)
+     {
+         return mnBitsPerPixel;
+@@ -660,9 +700,17 @@ private:
+         return util::Endianness::LITTLE;
+     }
+ 
+-    virtual uno::Sequence< ::sal_Int8 > SAL_CALL convertIntegerColorSpace( const uno::Sequence< ::sal_Int8 >&, 
+-                                                                           const uno::Reference< rendering::XIntegerBitmapColorSpace >& ) throw (lang::IllegalArgumentException, 
+-                                                                                                                                                 uno::RuntimeException)
++    virtual uno::Sequence< double > SAL_CALL convertFromIntegerColorSpace( const uno::Sequence< ::sal_Int8 >& , 
++                                                                           const uno::Reference< rendering::XColorSpace >& ) throw (lang::IllegalArgumentException, 
++                                                                                                                                    uno::RuntimeException)
++    {
++        test(false, "Method not implemented");
++        return uno::Sequence< double >();
++    }
++
++    virtual uno::Sequence< ::sal_Int8 > SAL_CALL convertToIntegerColorSpace( const uno::Sequence< ::sal_Int8 >& , 
++                                                                             const uno::Reference< rendering::XIntegerBitmapColorSpace >& ) throw (lang::IllegalArgumentException, 
++                                                                                                                                                   uno::RuntimeException)
+     {
+         test(false, "Method not implemented");
+         return uno::Sequence< sal_Int8 >();
+@@ -722,6 +770,44 @@ private:
+         return aRes;
+     }
+ 
++    virtual uno::Sequence< rendering::ARGBColor > SAL_CALL convertIntegerToPARGB( const uno::Sequence< ::sal_Int8 >& deviceColor ) throw (lang::IllegalArgumentException, 
++                                                                                                                                         uno::RuntimeException)
++    {
++        const sal_Size  nLen( deviceColor.getLength() );
++        const sal_Int32 nBytesPerPixel(mnBitsPerPixel == 8 ? 1 : 4);
++        test(nLen%nBytesPerPixel==0, 
++             "number of channels no multiple of pixel element count");
++
++        uno::Sequence< rendering::ARGBColor > aRes( nLen / nBytesPerPixel );
++        rendering::ARGBColor* pOut( aRes.getArray() );
++
++        if( getPalette().is() )
++        {
++            for( sal_Size i=0; i<nLen; ++i )
++            {
++                *pOut++ = rendering::ARGBColor(
++                    1.0,
++                    vcl::unotools::toDoubleColor(deviceColor[i]),
++                    vcl::unotools::toDoubleColor(deviceColor[i]),
++                    vcl::unotools::toDoubleColor(deviceColor[i]));
++            }
++        }
++        else
++        {
++            for( sal_Size i=0; i<nLen; i+=4 )
++            {
++                const double fAlpha=deviceColor[i+3];
++                *pOut++ = rendering::ARGBColor(
++                    vcl::unotools::toDoubleColor(fAlpha),
++                    vcl::unotools::toDoubleColor(fAlpha*deviceColor[i+0]),
++                    vcl::unotools::toDoubleColor(fAlpha*deviceColor[i+1]),
++                    vcl::unotools::toDoubleColor(fAlpha*deviceColor[i+2]));
++            }
++        }
++
++        return aRes;
++    }
++
+     virtual uno::Sequence< ::sal_Int8 > SAL_CALL convertIntegerFromRGB( const uno::Sequence< rendering::RGBColor >& ) throw (lang::IllegalArgumentException, 
+                                                                                                                              uno::RuntimeException)
+     {
+@@ -736,6 +822,13 @@ private:
+         return uno::Sequence< sal_Int8 >();
+     }
+ 
++    virtual uno::Sequence< ::sal_Int8 > SAL_CALL convertIntegerFromPARGB( const uno::Sequence< rendering::ARGBColor >& ) throw (lang::IllegalArgumentException, 
++                                                                                                                                uno::RuntimeException)
++    {
++        test(false, "Method not implemented");
++        return uno::Sequence< sal_Int8 >();
++    }
++
+ public:
+     TestBitmap( const geometry::IntegerSize2D& rSize, bool bPalette ) :
+         maSize(rSize),
+@@ -784,14 +877,14 @@ public:
+ 
+ void TestWindow::Paint( const Rectangle& )
+ {
+-    static sal_Int8 lcl_depths[]={1,4,8,16,24,32};
++    static sal_Int8 lcl_depths[]={1,4,8,16,24};
+ 
+     try
+     {
+         // Testing VclCanvasBitmap wrapper
+         // ===============================
+ 
+-        for( int i=0; i<sizeof(lcl_depths)/sizeof(*lcl_depths); ++i )
++        for( unsigned int i=0; i<sizeof(lcl_depths)/sizeof(*lcl_depths); ++i )
+         {
+             const sal_Int8 nDepth( lcl_depths[i] );
+             Bitmap aBitmap(Size(200,200),nDepth);
+@@ -801,8 +894,8 @@ void TestWindow::Paint( const Rectangle& )
+                                              aBitmap);
+                 if( pAcc.get() )
+                 {
+-                    BitmapColor aBlack;
+-                    BitmapColor aWhite;
++                    BitmapColor aBlack(0);
++                    BitmapColor aWhite(0);
+                     if( pAcc->HasPalette() )
+                     {
+                         aBlack.SetIndex( sal::static_int_cast<BYTE>(pAcc->GetBestPaletteIndex(BitmapColor(0,0,0))) );
+@@ -943,73 +1036,14 @@ void TestWindow::Paint( const Rectangle& )
+         exit(2);
+ }
+ 
+-USHORT TestApp::Exception( USHORT nError )
+-{
+-	switch( nError & EXC_MAJORTYPE )
+-	{
+-		case EXC_RSCNOTLOADED:
+-			Abort( String::CreateFromAscii( 
+-                       "Error: could not load language resources.\nPlease check your installation.\n" ) );
+-			break;
+-	}
+-	return 0;
+-}
++} // namespace
+ 
+-void TestApp::Main()
++void Main()
+ {
+-	bool bHelp = false;
+-
+-	for( USHORT i = 0; i < GetCommandLineParamCount(); i++ )
+-	{
+-		::rtl::OUString aParam = GetCommandLineParam( i );
+-
+-		if( aParam.equalsAscii( "--help" ) ||
+-			aParam.equalsAscii( "-h" ) )
+-				bHelp = true;
+-	}
+-
+-	if( bHelp )
+-	{
+-        printf( "outdevgrind - Profile OutputDevice\n" );
+-		return;
+-	}
+-
+-	//-------------------------------------------------
+-	// create the global service-manager
+-	//-------------------------------------------------
+-    uno::Reference< lang::XMultiServiceFactory > xFactory;
+-    try
+-    {
+-        uno::Reference< uno::XComponentContext > xCtx = ::cppu::defaultBootstrap_InitialComponentContext();
+-        xFactory = uno::Reference< lang::XMultiServiceFactory >(  xCtx->getServiceManager(), 
+-                                                                  uno::UNO_QUERY );
+-        if( xFactory.is() )
+-            ::comphelper::setProcessServiceFactory( xFactory );
+-    }
+-    catch( uno::Exception& )
+-    {
+-    }
+-
+-    if( !xFactory.is() )
+-    {
+-        fprintf( stderr, 
+-                 "Could not bootstrap UNO, installation must be in disorder. Exiting.\n" );
+-        exit( 1 );
+-    }
+-
+-    // Create UCB.
+-    uno::Sequence< uno::Any > aArgs( 2 );
+-	aArgs[ 0 ] <<= rtl::OUString::createFromAscii( UCB_CONFIGURATION_KEY1_LOCAL );
+-	aArgs[ 1 ] <<= rtl::OUString::createFromAscii( UCB_CONFIGURATION_KEY2_OFFICE );
+-    ::ucbhelper::ContentBroker::initialize( xFactory, aArgs );
+-
+-	TestWindow pWindow;
+-	pWindow.Execute();
++	TestWindow aWindow;
++	aWindow.Execute();
++	aWindow.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "VCL - canvasbitmaptest" ) ) );
+ 
+-    // clean up UCB
+-	::ucbhelper::ContentBroker::deinitialize();
++	Application::Execute();
+ }
+ 
+-} // namespace
+-
+-TestApp aTestApp;
+diff --git vcl/test/makefile.mk vcl/test/makefile.mk
+index f2f2125..73dd9f8 100644
+--- vcl/test/makefile.mk
++++ vcl/test/makefile.mk
+@@ -46,13 +46,12 @@ TARGETTYPE=GUI
+ 
+ # --- Files --------------------------------------------------------
+ 
+-OBJFILES= \
++APP1OBJS= \
+ 	$(OBJ)$/dndtest.obj
+ 
+ 
+ APP1NOSAL=		TRUE
+ APP1TARGET= 	$(TARGET)
+-APP1OBJS=	    $(OBJFILES)	$(OBJ)$/salmain.obj
+ APP1STDLIBS=	$(CPPULIB)			\
+ 				$(CPPUHELPERLIB)	\
+ 				$(TOOLSLIB) 		\
+@@ -68,12 +67,6 @@ APP2TARGET= canvasbitmaptest
+ APP2OBJS=	\
+ 	$(OBJ)$/canvasbitmaptest.obj
+ 
+-.IF "$(GUI)"!="UNX"
+-	APP2OBJS += $(OBJ)$/salmain.obj
+-.ELSE
+-	APP2OBJS += $(SLO)$/salmain.obj
+-.ENDIF
+-
+ APP2NOSAL=		TRUE
+ APP2STDLIBS=$(TOOLSLIB) 		\
+ 			$(COMPHELPERLIB)	\
+diff --git vcl/unx/source/gdi/salbmp.cxx vcl/unx/source/gdi/salbmp.cxx
+index ac8caa8..b64196f 100644
+--- vcl/unx/source/gdi/salbmp.cxx
++++ vcl/unx/source/gdi/salbmp.cxx
+@@ -141,9 +141,15 @@ BitmapBuffer* X11SalBitmap::ImplCreateDIB( const Size& rSize, USHORT nBitCount,
+ 				case( 4 ): pDIB->mnFormat |= BMP_FORMAT_4BIT_MSN_PAL; break;
+ 				case( 8 ): pDIB->mnFormat |= BMP_FORMAT_8BIT_PAL; break;
+ #ifdef OSL_BIGENDIAN
+-                case(16 ) : pDIB->mnFormat|= BMP_FORMAT_16BIT_TC_MSB_MASK; break;
++                case(16 ): 
++                    pDIB->mnFormat|= BMP_FORMAT_16BIT_TC_MSB_MASK; 
++                    pDIB->maColorMask = ColorMask( 0xf800, 0x07e0, 0x001f );
++                    break;
+ #else
+-                case(16 ) : pDIB->mnFormat|= BMP_FORMAT_16BIT_TC_LSB_MASK; break;
++                case(16 ): 
++                    pDIB->mnFormat|= BMP_FORMAT_16BIT_TC_LSB_MASK; 
++                    pDIB->maColorMask = ColorMask( 0xf800, 0x07e0, 0x001f );
++                    break;
+ #endif
+ 				default:
+ 					nBitCount = 24;
+@@ -251,7 +257,7 @@ BitmapBuffer* X11SalBitmap::ImplCreateDIB( Drawable aDrawable,
+ 				case( 16 ):
+ 				{
+ 					nDstFormat |= BMP_FORMAT_24BIT_TC_BGR;
+-						aSrcBuf.maColorMask = ColorMask( pImage->red_mask, pImage->green_mask, pImage->blue_mask );
++                    aSrcBuf.maColorMask = ColorMask( pImage->red_mask, pImage->green_mask, pImage->blue_mask );
+ 
+ 					if( LSBFirst == pImage->byte_order )
+                     {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]