vcl/inc/openglgdiimpl.hxx | 3 +++ vcl/inc/salgdiimpl.hxx | 3 +++ vcl/opengl/gdiimpl.cxx | 34 ++++++++++++++++++++++++++++------ vcl/unx/generic/gdi/gdiimpl.cxx | 6 ++++++ vcl/unx/generic/gdi/gdiimpl.hxx | 2 ++ vcl/unx/generic/gdi/salgdi.cxx | 3 ++- vcl/workben/vcldemo.cxx | 27 +++++++++++++-------------- 7 files changed, 57 insertions(+), 21 deletions(-)
New commits: commit 79d3cc082de625a6691302c4b0bc0bfe3dcf2a9c Author: Markus Mohrhard <[email protected]> Date: Sat Nov 8 20:12:34 2014 +0100 improvement for ellipse rendering Change-Id: I0ce74b77e0b08ddde5b93cf9e9da2ee7e0a1fdea diff --git a/vcl/opengl/gdiimpl.cxx b/vcl/opengl/gdiimpl.cxx index d9a676f..161de3a 100644 --- a/vcl/opengl/gdiimpl.cxx +++ b/vcl/opengl/gdiimpl.cxx @@ -363,18 +363,20 @@ void OpenGLSalGraphicsImpl::DrawPolygon( sal_uInt32 nPoints, const SalPoint* pPt { const ::basegfx::B2DPolygon& aResult( ::basegfx::triangulator::triangulate( aPolygon ) ); - std::vector<GLushort> aVertices(aResult.count() * 2); + std::vector<GLfloat> aVertices(aResult.count() * 2); sal_uInt32 j( 0 ); + float nHeight = GetHeight(); + float nWidth = GetWidth(); for( sal_uInt32 i = 0; i < aResult.count(); i++ ) { const ::basegfx::B2DPoint& rPt( aResult.getB2DPoint(i) ); - aVertices[j++] = rPt.getX(); - aVertices[j++] = rPt.getY(); + aVertices[j++] = 2 * rPt.getX() / nWidth - 1.0f; + aVertices[j++] = 2 * rPt.getY() / nHeight - 1.0f; } glEnableVertexAttribArray( GL_ATTRIB_POS ); - glVertexAttribPointer( GL_ATTRIB_POS, 2, GL_UNSIGNED_SHORT, GL_FALSE, 0, &aVertices[0] ); + glVertexAttribPointer( GL_ATTRIB_POS, 2, GL_FLOAT, GL_FALSE, 0, &aVertices[0] ); glDrawArrays( GL_TRIANGLES, 0, aResult.count() ); glDisableVertexAttribArray( GL_ATTRIB_POS ); } commit 817d12955d114c502a5c4b355dce34f9f95a837e Author: Markus Mohrhard <[email protected]> Date: Sat Nov 8 19:57:41 2014 +0100 use different line and fill colors makes it easier to see if one is missing Change-Id: I983fdf2edf22c431d601a63dbf90902a3f8657f2 diff --git a/vcl/workben/vcldemo.cxx b/vcl/workben/vcldemo.cxx index 2d457de..d753c0d 100644 --- a/vcl/workben/vcldemo.cxx +++ b/vcl/workben/vcldemo.cxx @@ -126,6 +126,8 @@ public: } void drawEllipse(Rectangle r) { + SetLineColor(Color(COL_RED)); + SetFillColor(Color(COL_GREEN)); DrawEllipse(r); } void drawCheckered(Rectangle r) commit eeb338abd203c06969d2d7d9734624551a79f371 Author: Markus Mohrhard <[email protected]> Date: Sat Nov 8 19:38:15 2014 +0100 fix comment Change-Id: I5d0f4a1ae8ac56e9da8d19b7b433513271e7a705 diff --git a/vcl/workben/vcldemo.cxx b/vcl/workben/vcldemo.cxx index 2ab4b3f..2d457de 100644 --- a/vcl/workben/vcldemo.cxx +++ b/vcl/workben/vcldemo.cxx @@ -121,8 +121,7 @@ public: tools::PolyPolygon aPPoly(aPoly); SetLineColor(Color(COL_RED)); SetFillColor(Color(COL_RED)); - // This hits the 'drawAlphaRect' code-path - // FIXME: not alpha ... + // This hits the optional 'drawPolyPolygon' code-path DrawTransparent(aPPoly, 64); } void drawEllipse(Rectangle r) commit c311d0269f6437ebb6ca88a483ecd8b4ec7537de Author: Markus Mohrhard <[email protected]> Date: Sat Nov 8 19:23:16 2014 +0100 get size correct for virtual devices Change-Id: I8fff04f561d57083c65a87ad5bd0e04cb9b9ed2c diff --git a/vcl/inc/openglgdiimpl.hxx b/vcl/inc/openglgdiimpl.hxx index 688a8d9..ef80d34 100644 --- a/vcl/inc/openglgdiimpl.hxx +++ b/vcl/inc/openglgdiimpl.hxx @@ -26,6 +26,7 @@ #include <vcl/opengl/OpenGLContext.hxx> class SalFrame; +class SalVirtualDevice; class VCL_PLUGIN_PUBLIC OpenGLSalGraphicsImpl : public SalGraphicsImpl { @@ -33,6 +34,7 @@ private: OpenGLContext maContext; SalFrame* mpFrame; + SalVirtualDevice* mpVDev; SalColor mnLineColor; SalColor mnFillColor; @@ -88,6 +90,7 @@ public: virtual void freeResources() SAL_OVERRIDE; virtual void Init( SalFrame* pFrame ) SAL_OVERRIDE; + virtual void Init( SalVirtualDevice* pVDev ) SAL_OVERRIDE; virtual bool setClipRegion( const vcl::Region& ) SAL_OVERRIDE; // diff --git a/vcl/inc/salgdiimpl.hxx b/vcl/inc/salgdiimpl.hxx index ba54f9f..dc8c580 100644 --- a/vcl/inc/salgdiimpl.hxx +++ b/vcl/inc/salgdiimpl.hxx @@ -36,6 +36,7 @@ class SalGraphics; class SalBitmap; class SalFrame; class Gradient; +class SalVirtualDevice; class VCL_PLUGIN_PUBLIC SalGraphicsImpl { @@ -45,6 +46,8 @@ public: virtual void Init( SalFrame* pFrame ) = 0; + virtual void Init( SalVirtualDevice* pVDev ) = 0; + virtual void freeResources() = 0; virtual bool setClipRegion( const vcl::Region& ) = 0; diff --git a/vcl/opengl/gdiimpl.cxx b/vcl/opengl/gdiimpl.cxx index 4865379..d9a676f 100644 --- a/vcl/opengl/gdiimpl.cxx +++ b/vcl/opengl/gdiimpl.cxx @@ -21,6 +21,7 @@ #include <vcl/gradient.hxx> #include <salframe.hxx> +#include "salvd.hxx" #include <basegfx/polygon/b2dpolygontools.hxx> #include <basegfx/polygon/b2dpolygontriangulator.hxx> @@ -53,6 +54,11 @@ void OpenGLSalGraphicsImpl::Init( SalFrame* pFrame ) mpFrame = pFrame; } +void OpenGLSalGraphicsImpl::Init(SalVirtualDevice* pVDev) +{ + mpVDev = pVDev; +} + bool OpenGLSalGraphicsImpl::setClipRegion( const vcl::Region& rClip ) { const basegfx::B2DPolyPolygon aClip( rClip.GetAsB2DPolyPolygon() ); @@ -92,14 +98,28 @@ inline GLfloat OpenGLSalGraphicsImpl::GetWidth() const { if( mpFrame ) return mpFrame->maGeometry.nWidth; - return 0; + else if (mpVDev) + { + long nWidth = 0; + long nHeight = 0; + mpVDev->GetSize(nWidth, nHeight); + return nWidth; + } + return 1; } inline GLfloat OpenGLSalGraphicsImpl::GetHeight() const { if( mpFrame ) return mpFrame->maGeometry.nHeight; - return 0; + else if (mpVDev) + { + long nWidth = 0; + long nHeight = 0; + mpVDev->GetSize(nWidth, nHeight); + return nHeight; + } + return 1; } // set the clip region to empty diff --git a/vcl/unx/generic/gdi/gdiimpl.cxx b/vcl/unx/generic/gdi/gdiimpl.cxx index 6b90220..f2ccf90 100644 --- a/vcl/unx/generic/gdi/gdiimpl.cxx +++ b/vcl/unx/generic/gdi/gdiimpl.cxx @@ -159,6 +159,12 @@ void X11SalGraphicsImpl::Init( SalFrame* /*pFrame*/ ) mnBrushPixel = mrParent.GetPixel( mnBrushColor ); } +void X11SalGraphicsImpl::Init( SalVirtualDevice* /*pVDev*/ ) +{ + mnPenPixel = mrParent.GetPixel( mnPenColor ); + mnBrushPixel = mrParent.GetPixel( mnBrushColor ); +} + XID X11SalGraphicsImpl::GetXRenderPicture() { XRenderPeer& rRenderPeer = XRenderPeer::GetInstance(); diff --git a/vcl/unx/generic/gdi/gdiimpl.hxx b/vcl/unx/generic/gdi/gdiimpl.hxx index b4fb21c..799e05c 100644 --- a/vcl/unx/generic/gdi/gdiimpl.hxx +++ b/vcl/unx/generic/gdi/gdiimpl.hxx @@ -110,6 +110,8 @@ public: virtual void Init( SalFrame* pFrame ) SAL_OVERRIDE; + virtual void Init( SalVirtualDevice* pVDev ) SAL_OVERRIDE; + virtual bool setClipRegion( const vcl::Region& ) SAL_OVERRIDE; // // get the depth of the device diff --git a/vcl/unx/generic/gdi/salgdi.cxx b/vcl/unx/generic/gdi/salgdi.cxx index bce86256..0607cac 100644 --- a/vcl/unx/generic/gdi/salgdi.cxx +++ b/vcl/unx/generic/gdi/salgdi.cxx @@ -150,17 +150,18 @@ void X11SalGraphics::SetDrawable( Drawable aDrawable, SalX11Screen nXScreen ) Window aWin = dynamic_cast<X11WindowProvider*>(m_pFrame)->GetX11Window(); pOpenGLImpl->GetOpenGLContext().init(GetXDisplay(), aWin, m_nXScreen.getXScreen()); + mpImpl->Init( m_pFrame ); } else if (m_pVDev) { pOpenGLImpl->GetOpenGLContext().init(GetXDisplay(), m_pVDev->GetDrawable(), m_pVDev->GetWidth(), m_pVDev->GetHeight(), m_nXScreen.getXScreen()); + mpImpl->Init(m_pVDev); } else SAL_WARN("vcl.opengl", "what happened here?"); } - mpImpl->Init( m_pFrame ); // TODO: moggi: FIXME nTextPixel_ = GetPixel( nTextColor_ ); } } commit f8ca2ab3efa9d89799cfe3dbc76f7d8ae4f8223f Author: Markus Mohrhard <[email protected]> Date: Sat Nov 8 19:22:31 2014 +0100 make these explicit That makes it easier to debug as even if you uncomment some lines the rectangle will still be at the same position Change-Id: I5576b2702962bb15663e0170cadb0d49ef33c0ab diff --git a/vcl/workben/vcldemo.cxx b/vcl/workben/vcldemo.cxx index b3c488c..2ab4b3f 100644 --- a/vcl/workben/vcldemo.cxx +++ b/vcl/workben/vcldemo.cxx @@ -263,19 +263,17 @@ void DemoWin::Paint( const Rectangle& rRect ) std::vector<Rectangle> aRegions(partitionAndClear(4,3)); - int i = 0; - drawRadialLines(aRegions[i++]); - drawText(aRegions[i++]); - drawPoly(aRegions[i++]); - drawEllipse(aRegions[i++]); - drawCheckered(aRegions[i++]); - drawBitmapEx(aRegions[i++]); - drawBitmap(aRegions[i++]); - drawGradient(aRegions[i++]); - drawPolyPolgons(aRegions[i++]); + drawRadialLines(aRegions[0]); + drawText(aRegions[1]); + drawPoly(aRegions[2]); + drawEllipse(aRegions[3]); + drawCheckered(aRegions[4]); + drawBitmapEx(aRegions[5]); + drawBitmap(aRegions[6]); + drawGradient(aRegions[7]); + drawPolyPolgons(aRegions[8]); // last - thumbnail all the above - fetchDrawBitmap(aRegions[i++]); - assert(i<=12); + fetchDrawBitmap(aRegions[9]); } class DemoApp : public Application _______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
