ooo-build r15423 - in trunk: . patches/test
- From: thorstenb svn gnome org
- To: svn-commits-list gnome org
- Subject: ooo-build r15423 - in trunk: . patches/test
- Date: Thu, 26 Feb 2009 21:13:37 +0000 (UTC)
Author: thorstenb
Date: Thu Feb 26 21:13:37 2009
New Revision: 15423
URL: http://svn.gnome.org/viewvc/ooo-build?rev=15423&view=rev
Log:
* patches/test/opengl-canvas.diff: finished pbuffer support for
sprite
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 Thu Feb 26 21:13:37 2009
@@ -81,7 +81,7 @@
basegfx/inc/basegfx/tools/tools.hxx | 25
basegfx/source/polygon/b2dpolypolygontools.cxx | 132 +++
basegfx/source/tools/makefile.mk | 1
- basegfx/source/tools/numbertools.cxx | 79 ++
+ basegfx/source/tools/numbertools.cxx | 79 +
canvas/prj/build.lst | 1
canvas/prj/d.lst | 2
canvas/source/cairo/cairo_canvashelper.hxx | 1
@@ -95,17 +95,17 @@
canvas/source/opengl/ogl_buffercontext.hxx | 38 +
canvas/source/opengl/ogl_canvasbitmap.cxx | 63 +
canvas/source/opengl/ogl_canvasbitmap.hxx | 82 ++
- canvas/source/opengl/ogl_canvascustomsprite.cxx | 226 ++++
+ canvas/source/opengl/ogl_canvascustomsprite.cxx | 265 +++++
canvas/source/opengl/ogl_canvascustomsprite.hxx | 103 ++
canvas/source/opengl/ogl_canvasfont.cxx | 88 ++
canvas/source/opengl/ogl_canvasfont.hxx | 72 +
- canvas/source/opengl/ogl_canvashelper.cxx | 1019 ++++++++++++++++++++
+ canvas/source/opengl/ogl_canvashelper.cxx | 1019 +++++++++++++++++++
canvas/source/opengl/ogl_canvashelper.hxx | 242 +++++
canvas/source/opengl/ogl_canvastools.cxx | 147 +++
canvas/source/opengl/ogl_canvastools.hxx | 41 +
canvas/source/opengl/ogl_spritecanvas.cxx | 202 ++++
canvas/source/opengl/ogl_spritecanvas.hxx | 126 ++
- canvas/source/opengl/ogl_spritedevicehelper.cxx | 991 +++++++++++++++++++
+ canvas/source/opengl/ogl_spritedevicehelper.cxx | 1055 ++++++++++++++++++++
canvas/source/opengl/ogl_spritedevicehelper.hxx | 176 +++
canvas/source/opengl/ogl_textlayout.cxx | 222 ++++
canvas/source/opengl/ogl_textlayout.hxx | 83 ++
@@ -133,7 +133,7 @@
sdext/source/presenter/PresenterSlideShowView.cxx | 48 +
sdext/source/presenter/PresenterSlideShowView.hxx | 7
slideshow/source/engine/waitsymbol.cxx | 13
- 56 files changed, 4833 insertions(+), 65 deletions(-)
+ 56 files changed, 4936 insertions(+), 65 deletions(-)
create mode 100644 basegfx/source/tools/numbertools.cxx
create mode 100644 canvas/source/opengl/exports.dxp
create mode 100644 canvas/source/opengl/exports.map
@@ -1070,10 +1070,10 @@
+#endif
diff --git canvas/source/opengl/ogl_canvascustomsprite.cxx canvas/source/opengl/ogl_canvascustomsprite.cxx
new file mode 100644
-index 0000000..29bcc51
+index 0000000..e12ed7e
--- /dev/null
+++ canvas/source/opengl/ogl_canvascustomsprite.cxx
-@@ -0,0 +1,226 @@
+@@ -0,0 +1,265 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
@@ -1106,6 +1106,9 @@
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <basegfx/point/b2dpoint.hxx>
+#include <basegfx/tools/canvastools.hxx>
++#include <basegfx/polygon/b2dpolygonclipper.hxx>
++#include <basegfx/polygon/b2dpolygontriangulator.hxx>
++#include <basegfx/polygon/b2dpolypolygontools.hxx>
+
+#include <GL/gl.h>
+#include <GL/glu.h>
@@ -1239,6 +1242,9 @@
+ {
+ // drats. need to render to temp surface before, and then
+ // composite that to screen
++
++ // TODO(P3): buffer pbuffer, maybe even keep content
++ // (in a texture?)
+ pBufferContext=maCanvasHelper.getDeviceHelper()->createBufferContext(aSpriteSizePixel);
+ pBufferContext->startBufferRendering();
+ }
@@ -1268,13 +1274,46 @@
+ // blend against fixed vertex color; texture alpha is multiplied in
+ glColor4f(1,1,1,mfAlpha);
+
-+ // if( mxClip ) - TODO clipping
-+ glBegin(GL_TRIANGLE_STRIP);
-+ glTexCoord2f(0,0); glVertex2d(0,0);
-+ glTexCoord2f(0,maSize.Height); glVertex2d(0, aSpriteSizePixel.getY());
-+ glTexCoord2f(maSize.Width,0); glVertex2d(aSpriteSizePixel.getX(),0);
-+ glTexCoord2f(maSize.Width,maSize.Height); glVertex2d(aSpriteSizePixel.getX(),aSpriteSizePixel.getY());
-+ glEnd();
++ if( mxClip.is() )
++ {
++ const double fWidth=maSize.Width;
++ const double fHeight=maSize.Height;
++
++ // TODO(P3): buffer triangulation
++ const ::basegfx::B2DPolygon& rTriangulatedPolygon(
++ ::basegfx::triangulator::triangulate(
++ ::basegfx::unotools::b2DPolyPolygonFromXPolyPolygon2D(mxClip)));
++
++ basegfx::B2DPolygon rTriangleList(
++ basegfx::tools::clipTriangleListOnRange(
++ rTriangulatedPolygon,
++ basegfx::B2DRange(
++ 0,0,
++ aSpriteSizePixel.getX(),
++ aSpriteSizePixel.getY())));
++
++ glBegin(GL_TRIANGLES);
++ for( sal_uInt32 i=0; i<rTriangulatedPolygon.count(); i++ )
++ {
++ const ::basegfx::B2DPoint& rPt( rTriangulatedPolygon.getB2DPoint(i) );
++ const double s(rPt.getX()/fWidth);
++ const double t(rPt.getY()/fHeight);
++ glTexCoord2f(s,t); glVertex2d(rPt.getX(), rPt.getY());
++ }
++ glEnd();
++ }
++ else
++ {
++ const double fWidth=maSize.Width/aSpriteSizePixel.getX();
++ const double fHeight=maSize.Height/aSpriteSizePixel.getY();
++
++ glBegin(GL_TRIANGLE_STRIP);
++ glTexCoord2f(0,0); glVertex2d(0,0);
++ glTexCoord2f(0,fHeight); glVertex2d(0, aSpriteSizePixel.getY());
++ glTexCoord2f(fWidth,0); glVertex2d(aSpriteSizePixel.getX(),0);
++ glTexCoord2f(fWidth,fHeight); glVertex2d(aSpriteSizePixel.getX(),aSpriteSizePixel.getY());
++ glEnd();
++ }
+
+ glBindTexture(GL_TEXTURE_2D, 0);
+ glDisable(GL_TEXTURE_2D);
@@ -3396,10 +3435,10 @@
+#endif
diff --git canvas/source/opengl/ogl_spritedevicehelper.cxx canvas/source/opengl/ogl_spritedevicehelper.cxx
new file mode 100644
-index 0000000..7d7e6ec
+index 0000000..92a0514
--- /dev/null
+++ canvas/source/opengl/ogl_spritedevicehelper.cxx
-@@ -0,0 +1,991 @@
+@@ -0,0 +1,1055 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
@@ -3554,7 +3593,7 @@
+ glShadeModel(GL_FLAT);
+}
+
-+static void initTransformation(const ::Size& rSize)
++static void initTransformation(const ::Size& rSize, bool bMirror=false)
+{
+ // use whole window
+ glViewport( 0,0,
@@ -3564,9 +3603,9 @@
+ // model coordinate system is already in device pixel
+ glMatrixMode(GL_MODELVIEW);
+ glLoadIdentity();
-+ glTranslated(-1.0, 1.0, 0.0);
++ glTranslated(-1.0, (bMirror ? -1.0 : 1.0), 0.0);
+ glScaled( 2.0 / rSize.Width(),
-+ -2.0 / rSize.Height(),
++ (bMirror ? 2.0 : -2.0) / rSize.Height(),
+ 1.0 );
+
+ // clear to black
@@ -3582,7 +3621,7 @@
+ int nScreen )
+{
+ // select appropriate visual
-+ static int attrList3[] =
++ static int winAttrList3[] =
+ {
+ GLX_RGBA,//only TrueColor or DirectColor
+ //single buffered
@@ -3592,7 +3631,19 @@
+ GLX_DEPTH_SIZE,0,//no depth buffer
+ None
+ };
-+ static int attrList2[] =
++ static int pBufAttrList3[] =
++ {
++ GLX_DOUBLEBUFFER,False,// never doublebuffer pbuffer
++ GLX_RED_SIZE,4,//use the maximum red bits, with a minimum of 4 bits
++ GLX_GREEN_SIZE,4,//use the maximum green bits, with a minimum of 4 bits
++ GLX_BLUE_SIZE,4,//use the maximum blue bits, with a minimum of 4 bits
++ GLX_ALPHA_SIZE,4,
++ GLX_DEPTH_SIZE,0,//no depth buffer
++ GLX_RENDER_TYPE, GLX_RGBA_BIT,
++ GLX_DRAWABLE_TYPE, GLX_PBUFFER_BIT | GLX_WINDOW_BIT,
++ None
++ };
++ static int winAttrList2[] =
+ {
+ GLX_RGBA,//only TrueColor or DirectColor
+ /// single buffered
@@ -3602,7 +3653,19 @@
+ GLX_DEPTH_SIZE,1,/// use the maximum depth bits, making sure there is a depth buffer
+ None
+ };
-+ static int attrList1[] =
++ static int pBufAttrList2[] =
++ {
++ GLX_DOUBLEBUFFER,False,// never doublebuffer pbuffer
++ GLX_RED_SIZE,4,/// use the maximum red bits, with a minimum of 4 bits
++ GLX_GREEN_SIZE,4,/// use the maximum green bits, with a minimum of 4 bits
++ GLX_BLUE_SIZE,4,/// use the maximum blue bits, with a minimum of 4 bits
++ GLX_ALPHA_SIZE,4,
++ GLX_DEPTH_SIZE,1,/// use the maximum depth bits, making sure there is a depth buffer
++ GLX_RENDER_TYPE, GLX_RGBA_BIT,
++ GLX_DRAWABLE_TYPE, GLX_PBUFFER_BIT | GLX_WINDOW_BIT,
++ None
++ };
++ static int winAttrList1[] =
+ {
+ GLX_RGBA,//only TrueColor or DirectColor
+ GLX_DOUBLEBUFFER,/// only double buffer
@@ -3612,7 +3675,19 @@
+ GLX_DEPTH_SIZE,0,/// no depth buffer
+ None
+ };
-+ static int attrList0[] =
++ static int pBufAttrList1[] =
++ {
++ GLX_DOUBLEBUFFER,False,// never doublebuffer pbuffer
++ GLX_RED_SIZE,4,/// use the maximum red bits, with a minimum of 4 bits
++ GLX_GREEN_SIZE,4,/// use the maximum green bits, with a minimum of 4 bits
++ GLX_BLUE_SIZE,4,/// use the maximum blue bits, with a minimum of 4 bits
++ GLX_ALPHA_SIZE,4,
++ GLX_DEPTH_SIZE,0,/// no depth buffer
++ GLX_RENDER_TYPE, GLX_RGBA_BIT,
++ GLX_DRAWABLE_TYPE, GLX_PBUFFER_BIT | GLX_WINDOW_BIT,
++ None
++ };
++ static int winAttrList0[] =
+ {
+ GLX_RGBA,//only TrueColor or DirectColor
+ GLX_DOUBLEBUFFER,// only double buffer
@@ -3622,31 +3697,57 @@
+ GLX_DEPTH_SIZE,1,// use the maximum depth bits, making sure there is a depth buffer
+ None
+ };
-+ static int* attrTable[] =
++ static int pBufAttrList0[] =
++ {
++ GLX_DOUBLEBUFFER,False,// never doublebuffer pbuffer
++ GLX_RED_SIZE,4,// use the maximum red bits, with a minimum of 4 bits
++ GLX_GREEN_SIZE,4,// use the maximum green bits, with a minimum of 4 bits
++ GLX_BLUE_SIZE,4,// use the maximum blue bits, with a minimum of 4 bits
++ GLX_ALPHA_SIZE,4,
++ GLX_DEPTH_SIZE,1,// use the maximum depth bits, making sure there is a depth buffer
++ GLX_RENDER_TYPE, GLX_RGBA_BIT,
++ GLX_DRAWABLE_TYPE, GLX_PBUFFER_BIT | GLX_WINDOW_BIT,
++ None
++ };
++ static int* winAttrTable[] =
++ {
++ winAttrList0,
++ winAttrList1,
++ winAttrList2,
++ winAttrList3,
++ NULL
++ };
++ static int* pBufAttrTable[] =
+ {
-+ attrList0,
-+ attrList1,
-+ attrList2,
-+ attrList3,
++ pBufAttrList0,
++ pBufAttrList1,
++ pBufAttrList2,
++ pBufAttrList3,
+ NULL
+ };
-+ int** pAttributeTable = attrTable;
++ int** pWinAttributeTable = winAttrTable;
++ int** pBufAttributeTable = pBufAttrTable;
+
+ boost::shared_ptr<SystemChildWindow> pResult;
+ unx::GLXFBConfig* fbConfigs=NULL;
+ int nConfigs, nVal;
-+ while( *pAttributeTable )
++ while( *pWinAttributeTable && *pBufAttributeTable )
+ {
+ // try to find a window visual for the current set of
+ // attributes
+ viWin = unx::glXChooseVisual( pDisplay,
+ nScreen,
-+ *pAttributeTable );
++ *pWinAttributeTable );
+ if( viWin )
+ {
+ // try to find a framebuffer config for the current set of
+ // attributes
-+ fbConfigs = unx::glXGetFBConfigs(pDisplay, nScreen, &nConfigs);
++ fbConfigs = glXChooseFBConfig( pDisplay,
++ nScreen,
++ *pBufAttributeTable,
++ &nConfigs );
++ // don't use glXGetFBConfigs, that does not list alpha-configs
++ // fbConfigs = unx::glXGetFBConfigs(pDisplay, nScreen, &nConfigs);
+ for(int i=0; i<nConfigs; i++)
+ {
+ viPB = glXGetVisualFromFBConfig(pDisplay, fbConfigs[i]);
@@ -3682,7 +3783,8 @@
+ XFree(viWin);
+ }
+
-+ ++pAttributeTable;
++ ++pWinAttributeTable;
++ ++pBufAttributeTable;
+ }
+
+ return pResult;
@@ -3898,10 +4000,10 @@
+ glXMakeCurrent(pDisplay, None, NULL);
+ }
+
-+ if( !mpGLContext )
++ if( !mpGLContext || glGetError() != GL_NO_ERROR )
+ throw lang::NoSupportException(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
-+ "Could not create OpenGL context!") ),NULL);
++ "Could not create OpenGL context, or an error occurred doing so!") ),NULL);
+
+ notifySizeUpdate(rViewArea);
+ mpChildWindow->Show();
@@ -4268,7 +4370,8 @@
+ initTransformation(
+ ::Size(
+ rSize.getX(),
-+ rSize.getY()));
++ rSize.getY()),
++ true);
+
+ return true;
+ }
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]