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



Author: thorstenb
Date: Mon Nov 10 13:51:54 2008
New Revision: 14477
URL: http://svn.gnome.org/viewvc/ooo-build?rev=14477&view=rev

Log:
    * patches/test/opengl-canvas.diff: more work on gradient shaders



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	Mon Nov 10 13:51:54 2008
@@ -12,22 +12,22 @@
  canvas/source/null/null_canvashelper.hxx           |    1 
  canvas/source/opengl/exports.dxp                   |    3 
  canvas/source/opengl/exports.map                   |    8 
- canvas/source/opengl/makefile.mk                   |   65 ++
- canvas/source/opengl/ogl_bitmapcanvashelper.cxx    |  108 +++
+ canvas/source/opengl/makefile.mk                   |   65 +
+ canvas/source/opengl/ogl_bitmapcanvashelper.cxx    |  108 ++
  canvas/source/opengl/ogl_bitmapcanvashelper.hxx    |  107 ++
  canvas/source/opengl/ogl_canvasbitmap.cxx          |   63 +
  canvas/source/opengl/ogl_canvasbitmap.hxx          |   82 ++
- canvas/source/opengl/ogl_canvascustomsprite.cxx    |  154 ++++
+ canvas/source/opengl/ogl_canvascustomsprite.cxx    |  154 +++
  canvas/source/opengl/ogl_canvascustomsprite.hxx    |  101 ++
  canvas/source/opengl/ogl_canvasfont.cxx            |   88 ++
- canvas/source/opengl/ogl_canvasfont.hxx            |   72 ++
- canvas/source/opengl/ogl_canvashelper.cxx          |  860 ++++++++++++++++++++
- canvas/source/opengl/ogl_canvashelper.hxx          |  237 ++++++
- canvas/source/opengl/ogl_spritecanvas.cxx          |  202 +++++
- canvas/source/opengl/ogl_spritecanvas.hxx          |  126 +++
- canvas/source/opengl/ogl_spritedevicehelper.cxx    |  658 +++++++++++++++
- canvas/source/opengl/ogl_spritedevicehelper.hxx    |  134 +++
- canvas/source/opengl/ogl_textlayout.cxx            |  222 +++++
+ canvas/source/opengl/ogl_canvasfont.hxx            |   72 +
+ canvas/source/opengl/ogl_canvashelper.cxx          | 1055 ++++++++++++++++++++
+ canvas/source/opengl/ogl_canvashelper.hxx          |  238 +++++
+ canvas/source/opengl/ogl_spritecanvas.cxx          |  202 ++++
+ canvas/source/opengl/ogl_spritecanvas.hxx          |  126 ++
+ canvas/source/opengl/ogl_spritedevicehelper.cxx    |  794 +++++++++++++++
+ canvas/source/opengl/ogl_spritedevicehelper.hxx    |  146 +++
+ 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 
@@ -41,12 +41,16 @@
  scp2/source/canvas/makefile.mk                     |    1 
  scp2/source/canvas/openglcanvas.scp                |   28 +
  scp2/util/makefile.mk                              |    4 
+ sd/source/ui/presenter/PresenterCanvas.cxx         |   11 
+ sd/source/ui/presenter/PresenterCanvas.hxx         |    4 
+ sd/source/ui/presenter/PresenterTextView.cxx       |    1 
+ sd/source/ui/presenter/SlideRenderer.cxx           |    1 
  sd/source/ui/slideshow/slideshowviewimpl.cxx       |   13 
  sd/source/ui/slideshow/slideshowviewimpl.hxx       |    1 
  sdext/source/presenter/PresenterSlideShowView.cxx  |   48 +
  sdext/source/presenter/PresenterSlideShowView.hxx  |    7 
  slideshow/source/engine/waitsymbol.cxx             |   13 
- 41 files changed, 3526 insertions(+), 50 deletions(-)
+ 45 files changed, 3873 insertions(+), 64 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
@@ -1056,10 +1060,10 @@
 +#endif
 diff --git canvas/source/opengl/ogl_canvashelper.cxx canvas/source/opengl/ogl_canvashelper.cxx
 new file mode 100644
-index 0000000..b827c8e
+index 0000000..d7e5e3e
 --- /dev/null
 +++ canvas/source/opengl/ogl_canvashelper.cxx
-@@ -0,0 +1,860 @@
+@@ -0,0 +1,1055 @@
 +/*************************************************************************
 + *
 + *    OpenOffice.org - a multi-platform office productivity suite
@@ -1079,6 +1083,8 @@
 +// MARKER(update_precomp.py): autogen include statement, do not remove
 +#include "precompiled_canvas.hxx"
 +
++#define GL_GLEXT_PROTOTYPES
++
 +#include "ogl_canvashelper.hxx"
 +
 +#include <canvas/debug.hxx>
@@ -1302,9 +1308,6 @@
 +            TransformationPreserver aPreserver;
 +            setupState(rTransform, eSrcBlend, eDstBlend, rColor);
 +
-+            rHelper.getDeviceHelper()->useLinearGradientShader(rColor,
-+                                                               rendering::ARGBColor(1.0,0.0,1.0,0.0));
-+            
 +            ::basegfx::B2DPolyPolygonVector::const_iterator aCurr=rPolyPolygons.begin();
 +            const ::basegfx::B2DPolyPolygonVector::const_iterator aEnd=rPolyPolygons.end();
 +            while( aCurr != aEnd )
@@ -1317,6 +1320,65 @@
 +            return true;
 +        }
 +
++        bool lcl_fillGradientPolyPolygon( const CanvasHelper&                            rHelper,
++                                          const ::basegfx::B2DHomMatrix&                 rTransform,
++                                          GLenum                                         eSrcBlend,
++                                          GLenum                                         eDstBlend,
++                                          const ::canvas::ParametricPolyPolygon::Values& rValues,
++                                          const rendering::Texture&                      rTexture,
++                                          const ::basegfx::B2DPolyPolygonVector&         rPolyPolygons )
++        {
++            TransformationPreserver aPreserver;
++            setupState(rTransform, eSrcBlend, eDstBlend, rendering::ARGBColor());
++
++            const rendering::ARGBColor aStartColor(
++                rHelper.getDevice()->getDeviceColorSpace()->convertToARGB(rValues.maColors[0])[0]);
++            const rendering::ARGBColor aEndColor(
++                rHelper.getDevice()->getDeviceColorSpace()->convertToARGB(rValues.maColors[1])[0]);
++
++            switch( rValues.meType )
++            {
++                case ::canvas::ParametricPolyPolygon::GRADIENT_AXIAL:
++                case ::canvas::ParametricPolyPolygon::GRADIENT_LINEAR:
++                    rHelper.getDeviceHelper()->useLinearGradientShader(aStartColor, 
++                                                                       aEndColor,
++                                                                       rTexture.AffineTransform);
++                    break;
++
++                case ::canvas::ParametricPolyPolygon::GRADIENT_ELLIPTICAL:
++                    rHelper.getDeviceHelper()->useRadialGradientShader(aStartColor, 
++                                                                       aEndColor,
++                                                                       rTexture.AffineTransform);
++                    break;
++
++                case ::canvas::ParametricPolyPolygon::GRADIENT_RECTANGULAR:
++                    rHelper.getDeviceHelper()->useRectangularGradientShader(aStartColor, 
++                                                                            aEndColor,
++                                                                            rTexture.AffineTransform);
++                    break;
++
++                default:
++                    ENSURE_OR_THROW( false,
++                                      "CanvasHelper lcl_fillGradientPolyPolygon(): Unexpected case" );
++            }
++
++
++            ::basegfx::B2DPolyPolygonVector::const_iterator aCurr=rPolyPolygons.begin();
++            const ::basegfx::B2DPolyPolygonVector::const_iterator aEnd=rPolyPolygons.end();
++            while( aCurr != aEnd )
++            {
++                glBegin(GL_TRIANGLES);
++                renderComplexPolyPolygon(*aCurr++);
++                glEnd();
++            }
++
++            glUseProgram(0);
++            glLoadIdentity();
++            glMatrixMode(GL_MODELVIEW);
++
++            return true;
++        }
++
 +        bool lcl_drawOwnBitmap( const CanvasHelper&              /*rHelper*/,
 +                                const ::basegfx::B2DHomMatrix&   rTransform,
 +                                GLenum                           eSrcBlend,
@@ -1379,6 +1441,59 @@
 +
 +            return true;
 +        }
++
++        bool lcl_fillBitmappedPolyPolygon( const CanvasHelper&                    /*rHelper*/,
++                                           const ::basegfx::B2DHomMatrix&         rTransform,
++                                           GLenum                                 eSrcBlend,
++                                           GLenum                                 eDstBlend,
++                                           const rendering::Texture&              rTexture,
++                                           const geometry::IntegerSize2D&         rPixelSize,
++                                           const uno::Sequence<sal_Int8>&         rPixelData,
++                                           const ::basegfx::B2DPolyPolygonVector& rPolyPolygons )
++        {
++            TransformationPreserver aPreserver;
++            setupState(rTransform, eSrcBlend, eDstBlend, rendering::ARGBColor());
++
++            // TODO(P3): reuse the texture next time
++            unsigned int nTexture;
++            glGenTextures(1, &nTexture);
++            glBindTexture(GL_TEXTURE_2D, nTexture);
++
++            // TODO(E3): handle limited texture sizes -
++            // glGetIntegerv(GL_MAX_TEXTURE_SIZE)
++
++            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);
++
++            ::basegfx::B2DPolyPolygonVector::const_iterator aCurr=rPolyPolygons.begin();
++            const ::basegfx::B2DPolyPolygonVector::const_iterator aEnd=rPolyPolygons.end();
++            while( aCurr != aEnd )
++            {
++                glBegin(GL_TRIANGLES);
++                renderComplexPolyPolygon(*aCurr++);
++                glEnd();
++            }
++
++            glDeleteTextures(1, &nTexture);
++
++            return true;
++        }
 +    }
 +
 +    CanvasHelper::CanvasHelper() :
@@ -1392,6 +1507,7 @@
 +    CanvasHelper& CanvasHelper::operator=( const CanvasHelper& rSrc )
 +    {
 +        mpDevice = rSrc.mpDevice;
++        mpDeviceHelper = rSrc.mpDeviceHelper;
 +        mpRecordedActions = rSrc.mpRecordedActions;
 +        return *this;
 +    }
@@ -1585,11 +1701,94 @@
 +    }
 +
 +    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 uno::Reference< rendering::XPolyPolygon2D >& xPolyPolygon,
++                                                                                         const rendering::ViewState&                        viewState,
++                                                                                         const rendering::RenderState&                      renderState,
++                                                                                         const uno::Sequence< rendering::Texture >&         textures )
 +    {
++        ENSURE_OR_THROW( xPolyPolygon.is(), 
++                          "CanvasHelper::fillPolyPolygon: polygon is NULL");
++
++        if( mpDevice )
++        {
++            mpRecordedActions->push_back( Action() );
++            Action& rAct=mpRecordedActions->back();
++
++            setupGraphicsState( rAct, viewState, renderState );
++            rAct.maPolyPolys.push_back(
++                ::basegfx::unotools::b2DPolyPolygonFromXPolyPolygon2D(xPolyPolygon));
++            rAct.maPolyPolys.back().makeUnique(); // own copy, for thread safety
++
++            // TODO(F1): Multi-texturing
++            if( textures[0].Gradient.is() )
++            {
++                // try to cast XParametricPolyPolygon2D reference to
++                // our implementation class.
++                ::canvas::ParametricPolyPolygon* pGradient = 
++                      dynamic_cast< ::canvas::ParametricPolyPolygon* >( textures[0].Gradient.get() );
++
++                if( pGradient )
++                {
++                    // copy state from Gradient polypoly locally
++                    // (given object might change!)
++                    const ::canvas::ParametricPolyPolygon::Values& rValues(
++                        pGradient->getValues() );
++
++                    rAct.maFunction = ::boost::bind(&lcl_fillGradientPolyPolygon,
++                                                    _1,_2,_3,_4,
++                                                    rValues,
++                                                    textures[0],
++                                                    _6);
++                }
++                else
++                {
++                    // TODO(F1): The generic case is missing here
++                    ENSURE_OR_THROW( false,
++                                      "CanvasHelper::fillTexturedPolyPolygon(): unknown parametric polygon encountered" );
++                }
++            }
++            else if( textures[0].Bitmap.is() )
++            {
++                // own bitmap?
++                CanvasBitmap* pOwnBitmap=dynamic_cast<CanvasBitmap*>(textures[0].Bitmap.get());
++                if( pOwnBitmap )
++                {
++                    // TODO(F2): own texture bitmap
++                }
++                else
++                {
++                    // TODO(P3): Highly inefficient - simply copies pixel data
++
++                    uno::Reference< rendering::XIntegerReadOnlyBitmap > xIntegerBitmap(
++                        textures[0].Bitmap, 
++                        uno::UNO_QUERY);
++                    if( xIntegerBitmap.is() )
++                    {
++                        const geometry::IntegerSize2D aSize=xIntegerBitmap->getSize();
++                        rendering::IntegerBitmapLayout aLayout;
++                        uno::Sequence<sal_Int8> aPixelData=
++                            xIntegerBitmap->getData(
++                                aLayout,
++                                geometry::IntegerRectangle2D(0,0,aSize.Width,aSize.Height));
++
++                        // force-convert color to ARGB8888 int color space  
++                        uno::Sequence<sal_Int8> aARGBBytes(
++                            aLayout.ColorSpace->convertToIntegerColorSpace(
++                                aPixelData,
++                                canvas::tools::getStdColorSpace()));
++
++                        rAct.maFunction = ::boost::bind(&lcl_fillBitmappedPolyPolygon,
++                                                        _1,_2,_3,_4,
++                                                        textures[0],
++                                                        aSize, 
++                                                        aARGBBytes,
++                                                        _6);
++                    }
++                    // TODO(F1): handle non-integer case
++                }
++            }
++        }
++
 +        // TODO(P1): Provide caching here.
 +        return uno::Reference< rendering::XCachedPrimitive >(NULL);
 +    }
@@ -1922,10 +2121,10 @@
 +}
 diff --git canvas/source/opengl/ogl_canvashelper.hxx canvas/source/opengl/ogl_canvashelper.hxx
 new file mode 100644
-index 0000000..88ab9d9
+index 0000000..ea70584
 --- /dev/null
 +++ canvas/source/opengl/ogl_canvashelper.hxx
-@@ -0,0 +1,237 @@
+@@ -0,0 +1,238 @@
 +/*************************************************************************
 + *
 + *    OpenOffice.org - a multi-platform office productivity suite
@@ -1983,7 +2182,7 @@
 +            Reference device this canvas is associated with
 +
 +         */
-+        void init( com::sun::star::rendering::XGraphicDevice& rDevice,
++        void init( ::com::sun::star::rendering::XGraphicDevice& rDevice,
 +                   SpriteDeviceHelper& rDeviceHelper );
 +
 +        // CanvasHelper functionality
@@ -2128,6 +2327,7 @@
 +        bool renderRecordedActions() const;
 +
 +        SpriteDeviceHelper* getDeviceHelper() const { return mpDeviceHelper; }
++        ::com::sun::star::rendering::XGraphicDevice* getDevice() const { return mpDevice; }
 +
 +    private:
 +        // declared, but not defined
@@ -2505,10 +2705,10 @@
 +#endif
 diff --git canvas/source/opengl/ogl_spritedevicehelper.cxx canvas/source/opengl/ogl_spritedevicehelper.cxx
 new file mode 100644
-index 0000000..8e8fb5d
+index 0000000..cfd4fc8
 --- /dev/null
 +++ canvas/source/opengl/ogl_spritedevicehelper.cxx
-@@ -0,0 +1,658 @@
+@@ -0,0 +1,794 @@
 +/*************************************************************************
 + *
 + *    OpenOffice.org - a multi-platform office productivity suite
@@ -2589,14 +2789,56 @@
 + */
 +static const char linearGradientFragmentShader[] = 
 +{
++    "#version 120                                                               "
++    "uniform vec4   v_startColor4d;                                             "
++    "uniform vec4   v_endColor4d;                                               "
++    "uniform mat3x2 m_transform;                                                "
++    "varying vec2   v_textureCoords2d;                                          "
++    "void main(void)                                                            "
++    "{                                                                          "
++	"    gl_FragColor = mix(v_startColor4d,                                     "
++    "                       v_endColor4d,                                       "
++    "                       (m_transform*vec3(v_textureCoords2d,1)).s);         "
++    "}                                                                          "
++};
++
++/** Two-color radial gradient
++ */
++static const char radialGradientFragmentShader[] = 
++{
++    "#version 120                                                               "
++    "uniform vec4 v_startColor4d;                                               "
++    "uniform vec4 v_endColor4d;                                                 "
++    "const vec2 v_center2d = vec2(0,0);                                         "
++    "varying vec2 v_textureCoords2d;                                            "
++    "void main(void)                                                            "
++    "{                                                                          "
++	"    gl_FragColor = mix(v_startColor4d,                                     "
++    "                       v_endColor4d,                                       "
++    "                       distance(                                           "
++    "                          vec2(                                            "
++    "                             m_transform*vec3(v_textureCoords2d,1)),       "
++    "                          v_center2d));                                    "
++    "}                                                                          "
++};
++
++/** Two-color rectangular gradient
++ */
++static const char rectangularGradientFragmentShader[] = 
++{
++    "#version 120                                                               "
 +    "uniform vec4 v_startColor4d;                                               "
 +    "uniform vec4 v_endColor4d;                                                 "
++    "const vec2 v_center2d = vec2(0,0);                                         "
 +    "varying vec2 v_textureCoords2d;                                            "
 +    "void main(void)                                                            "
 +    "{                                                                          "
 +	"    gl_FragColor = mix(v_startColor4d,                                     "
 +    "                       v_endColor4d,                                       "
-+    "                       v_textureCoords2d.s);                               "
++    "                       distance(                                           "
++    "                          vec2(                                            "
++    "                             m_transform*vec3(v_textureCoords2d,1)),       "
++    "                          v_center2d));                                    "
 +    "}                                                                          "
 +};
 +
@@ -2666,7 +2908,11 @@
 +        mpGLContext(NULL),
 +        mnDummyVertexProgram(0),
 +        mnLinearGradientFragmentProgram(0),
-+        mnLinearGradientProgram(0)
++        mnRadialGradientFragmentProgram(0),
++        mnRectangularGradientFragmentProgram(0),
++        mnLinearGradientProgram(0),
++        mnRadialGradientProgram(0),
++        mnRectangularGradientProgram(0)
 +    {}
 +
 +    void SpriteDeviceHelper::init( Window&               rWindow,
@@ -2854,9 +3100,21 @@
 +            compileShader(mnLinearGradientFragmentProgram, 
 +                          GL_FRAGMENT_SHADER, 
 +                          linearGradientFragmentShader);
++            compileShader(mnRadialGradientFragmentProgram, 
++                          GL_FRAGMENT_SHADER, 
++                          radialGradientFragmentShader);
++            compileShader(mnRectangularGradientFragmentProgram, 
++                          GL_FRAGMENT_SHADER, 
++                          rectangularGradientFragmentShader);
 +            linkShaders(mnLinearGradientProgram,
 +                        mnDummyVertexProgram,
 +                        mnLinearGradientFragmentProgram);
++            linkShaders(mnRadialGradientProgram,
++                        mnDummyVertexProgram,
++                        mnRadialGradientFragmentProgram);
++            linkShaders(mnRectangularGradientProgram,
++                        mnDummyVertexProgram,
++                        mnRectangularGradientFragmentProgram);
 +
 +            glXMakeCurrent(pDisplay, None, NULL);
 +        }
@@ -2879,7 +3137,11 @@
 +
 +        if( mpGLContext )
 +        {
++            glDeleteProgram( mnRectangularGradientProgram );
++            glDeleteProgram( mnRadialGradientProgram );
 +            glDeleteProgram( mnLinearGradientProgram );
++            glDeleteShader( mnRectangularGradientFragmentProgram );
++            glDeleteShader( mnRadialGradientFragmentProgram );
 +            glDeleteShader( mnLinearGradientFragmentProgram );
 +            glDeleteShader( mnDummyVertexProgram );
 +
@@ -3145,34 +3407,108 @@
 +        maActiveSprites.erase(xSprite);
 +    }
 +
-+    void SpriteDeviceHelper::useLinearGradientShader( const rendering::ARGBColor& rStartColor,
-+                                                      const rendering::ARGBColor& rEndColor )
++    void SpriteDeviceHelper::useLinearGradientShader( const rendering::ARGBColor&     rStartColor,
++                                                      const rendering::ARGBColor&     rEndColor,
++                                                      const geometry::AffineMatrix2D& rTexTransform )
 +    {
 +        glUseProgram(mnLinearGradientProgram);
 +
 +        const GLint nStartColorLocation = glGetUniformLocation(mnLinearGradientProgram,
 +                                                               "v_startColor4d" );
 +        glUniform4f(nStartColorLocation, 
-+                    rStartColor.Alpha,
 +                    rStartColor.Red,
 +                    rStartColor.Green,
-+                    rStartColor.Blue);
++                    rStartColor.Blue,
++                    rStartColor.Alpha);
 +
 +        const GLint nEndColorLocation = glGetUniformLocation(mnLinearGradientProgram,
 +                                                             "v_endColor4d" );
 +        glUniform4f(nEndColorLocation, 
-+                    rEndColor.Alpha,
 +                    rEndColor.Red,
 +                    rEndColor.Green,
-+                    rEndColor.Blue);
++                    rEndColor.Blue,
++                    rEndColor.Alpha);
++
++        const GLint nTransformLocation = glGetUniformLocation(mnLinearGradientProgram,
++                                                             "m_transform" );
++        float aTexTransform[] = 
++            {
++                rTexTransform.m00, rTexTransform.m01, rTexTransform.m02,
++                rTexTransform.m10, rTexTransform.m11, rTexTransform.m12
++            };
++        glUniformMatrix3x2fv(nTransformLocation,6,false,aTexTransform);
++    }
++
++    void SpriteDeviceHelper::useRadialGradientShader( const rendering::ARGBColor&     rStartColor,
++                                                      const rendering::ARGBColor&     rEndColor,
++                                                      const geometry::AffineMatrix2D& rTexTransform )
++    {
++        glUseProgram(mnRadialGradientProgram);
++
++        const GLint nStartColorLocation = glGetUniformLocation(mnRadialGradientProgram,
++                                                               "v_startColor4d" );
++        glUniform4f(nStartColorLocation, 
++                    rStartColor.Red,
++                    rStartColor.Green,
++                    rStartColor.Blue,
++                    rStartColor.Alpha);
++
++        const GLint nEndColorLocation = glGetUniformLocation(mnRadialGradientProgram,
++                                                             "v_endColor4d" );
++        glUniform4f(nEndColorLocation, 
++                    rEndColor.Red,
++                    rEndColor.Green,
++                    rEndColor.Blue,
++                    rEndColor.Alpha);
++
++        const GLint nTransformLocation = glGetUniformLocation(mnLinearGradientProgram,
++                                                             "m_transform" );
++        float aTexTransform[] = 
++            {
++                rTexTransform.m00, rTexTransform.m01, rTexTransform.m02,
++                rTexTransform.m10, rTexTransform.m11, rTexTransform.m12
++            };
++        glUniformMatrix3x2fv(nTransformLocation,6,false,aTexTransform);
++    }
++
++    void SpriteDeviceHelper::useRectangularGradientShader( const rendering::ARGBColor&     rStartColor,
++                                                           const rendering::ARGBColor&     rEndColor,
++                                                           const geometry::AffineMatrix2D& rTexTransform )
++    {
++        glUseProgram(mnRectangularGradientProgram);
++
++        const GLint nStartColorLocation = glGetUniformLocation(mnRectangularGradientProgram,
++                                                               "v_startColor4d" );
++        glUniform4f(nStartColorLocation, 
++                    rStartColor.Red,
++                    rStartColor.Green,
++                    rStartColor.Blue,
++                    rStartColor.Alpha);
++
++        const GLint nEndColorLocation = glGetUniformLocation(mnRectangularGradientProgram,
++                                                             "v_endColor4d" );
++        glUniform4f(nEndColorLocation, 
++                    rEndColor.Red,
++                    rEndColor.Green,
++                    rEndColor.Blue,
++                    rEndColor.Alpha);
++
++        const GLint nTransformLocation = glGetUniformLocation(mnLinearGradientProgram,
++                                                             "m_transform" );
++        float aTexTransform[] = 
++            {
++                rTexTransform.m00, rTexTransform.m01, rTexTransform.m02,
++                rTexTransform.m10, rTexTransform.m11, rTexTransform.m12
++            };
++        glUniformMatrix3x2fv(nTransformLocation,6,false,aTexTransform);
 +    }
 +}
 diff --git canvas/source/opengl/ogl_spritedevicehelper.hxx canvas/source/opengl/ogl_spritedevicehelper.hxx
 new file mode 100644
-index 0000000..0318c6d
+index 0000000..0a9c19e
 --- /dev/null
 +++ canvas/source/opengl/ogl_spritedevicehelper.hxx
-@@ -0,0 +1,134 @@
+@@ -0,0 +1,146 @@
 +/*************************************************************************
 + *
 + *    OpenOffice.org - a multi-platform office productivity suite
@@ -3202,9 +3538,10 @@
 +class Window;
 +class SystemChildWindow;
 +namespace basegfx{ class B2IVector; }
-+namespace com { namespace sun { namespace star { namespace awt {
-+    struct Rectangle;
-+}}}}
++namespace com { namespace sun { namespace star { 
++    namespace awt { struct Rectangle; }
++    namespace geometry { struct AffineMatrix2D; }
++}}}
 +
 +namespace oglcanvas
 +{
@@ -3269,8 +3606,15 @@
 +        void show( const ::rtl::Reference< CanvasCustomSprite >& );
 +        void hide( const ::rtl::Reference< CanvasCustomSprite >& );
 +
-+        void useLinearGradientShader( const ::com::sun::star::rendering::ARGBColor& rStartColor,
-+                                      const ::com::sun::star::rendering::ARGBColor& rEndColor );
++        void useLinearGradientShader( const ::com::sun::star::rendering::ARGBColor&     rStartColor,
++                                      const ::com::sun::star::rendering::ARGBColor&     rEndColor,
++                                      const ::com::sun::star::geometry::AffineMatrix2D& rTexTransform );
++        void useRadialGradientShader( const ::com::sun::star::rendering::ARGBColor&     rStartColor,
++                                      const ::com::sun::star::rendering::ARGBColor&     rEndColor,
++                                      const ::com::sun::star::geometry::AffineMatrix2D& rTexTransform );
++        void useRectangularGradientShader( const ::com::sun::star::rendering::ARGBColor&     rStartColor,
++                                           const ::com::sun::star::rendering::ARGBColor&     rEndColor,
++                                           const ::com::sun::star::geometry::AffineMatrix2D& rTexTransform );
 +
 +    private:
 +        void resize( const ::basegfx::B2IVector& rNewSize );
@@ -3302,7 +3646,11 @@
 +        unsigned int                                       mnDummyVertexProgram;
 +
 +        unsigned int                                       mnLinearGradientFragmentProgram;
++        unsigned int                                       mnRadialGradientFragmentProgram;
++        unsigned int                                       mnRectangularGradientFragmentProgram;
 +        unsigned int                                       mnLinearGradientProgram;
++        unsigned int                                       mnRadialGradientProgram;
++        unsigned int                                       mnRectangularGradientProgram;
 +    };
 +}
 +
@@ -3947,6 +4295,74 @@
  
  .IF "$(ENABLE_CAIRO)" == "TRUE"
  SCP1FILES += cairocanvas.par
+diff --git sd/source/ui/presenter/PresenterCanvas.cxx sd/source/ui/presenter/PresenterCanvas.cxx
+index 7b0302b..d8575df 100644
+--- sd/source/ui/presenter/PresenterCanvas.cxx
++++ sd/source/ui/presenter/PresenterCanvas.cxx
+@@ -809,17 +809,6 @@ sal_Bool SAL_CALL PresenterCanvas::hasAlpha (void)
+ 
+ 
+ 
+-Reference<rendering::XBitmapCanvas> SAL_CALL PresenterCanvas::queryBitmapCanvas (void)
+-    throw (RuntimeException)
+-{
+-    ThrowIfDisposed();
+-
+-    return this;
+-}
+-
+-
+-
+-
+ Reference<rendering::XBitmap> SAL_CALL PresenterCanvas::getScaledBitmap(
+     const css::geometry::RealSize2D& rNewSize,
+     sal_Bool bFast)
+diff --git sd/source/ui/presenter/PresenterCanvas.hxx sd/source/ui/presenter/PresenterCanvas.hxx
+index 8ed05c7..53f002a 100644
+--- sd/source/ui/presenter/PresenterCanvas.hxx
++++ sd/source/ui/presenter/PresenterCanvas.hxx
+@@ -41,6 +41,7 @@
+ #include <com/sun/star/lang/XInitialization.hpp>
+ #include <com/sun/star/lang/IllegalArgumentException.hpp>
+ #include <com/sun/star/rendering/XSpriteCanvas.hpp>
++#include <com/sun/star/rendering/XBitmapCanvas.hpp>
+ #include <com/sun/star/rendering/VolatileContentDestroyedException.hpp>
+ #include <cppuhelper/basemutex.hxx>
+ #include <cppuhelper/compbase4.hxx>
+@@ -387,9 +388,6 @@ public:
+     virtual sal_Bool SAL_CALL hasAlpha (void)
+         throw (css::uno::RuntimeException);
+     
+-    virtual css::uno::Reference<css::rendering::XBitmapCanvas> SAL_CALL queryBitmapCanvas (void)
+-        throw (css::uno::RuntimeException);
+-    
+     virtual css::uno::Reference<css::rendering::XBitmap> SAL_CALL getScaledBitmap(
+         const css::geometry::RealSize2D& rNewSize,
+         sal_Bool bFast)
+diff --git sd/source/ui/presenter/PresenterTextView.cxx sd/source/ui/presenter/PresenterTextView.cxx
+index f9cd42a..9fa3cfc 100644
+--- sd/source/ui/presenter/PresenterTextView.cxx
++++ sd/source/ui/presenter/PresenterTextView.cxx
+@@ -51,6 +51,7 @@
+ #include <com/sun/star/awt/FontDescriptor.hpp>
+ #include <com/sun/star/awt/Size.hpp>
+ #include <com/sun/star/rendering/XSpriteCanvas.hpp>
++#include <com/sun/star/rendering/XBitmapCanvas.hpp>
+ #include <com/sun/star/util/Color.hpp>
+ 
+ using namespace ::com::sun::star;
+diff --git sd/source/ui/presenter/SlideRenderer.cxx sd/source/ui/presenter/SlideRenderer.cxx
+index 9145ef2..ff1a17b 100644
+--- sd/source/ui/presenter/SlideRenderer.cxx
++++ sd/source/ui/presenter/SlideRenderer.cxx
+@@ -34,6 +34,7 @@
+ #include "SlideRenderer.hxx"
+ #include "sdpage.hxx"
+ #include <toolkit/helper/vclunohelper.hxx>
++#include <com/sun/star/rendering/XBitmapCanvas.hpp>
+ #include <vos/mutex.hxx>
+ #include <vcl/svapp.hxx>
+ #include <cppcanvas/vclfactory.hxx>
 diff --git sd/source/ui/slideshow/slideshowviewimpl.cxx sd/source/ui/slideshow/slideshowviewimpl.cxx
 index e20921c..f3532bb 100644
 --- sd/source/ui/slideshow/slideshowviewimpl.cxx



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