[Libreoffice-commits] core.git: Branch 'feature/fixes19' - 2 commits - vcl/inc vcl/opengl

2016-04-05 Thread Tomaz Vajngerl
 vcl/inc/openglgdiimpl.hxx |5 -
 vcl/opengl/gdiimpl.cxx|   34 --
 vcl/opengl/texture.cxx|   15 ---
 3 files changed, 40 insertions(+), 14 deletions(-)

New commits:
commit f80c2dd03d9d18c06ea0a9763ca59aeb1d2ed0e5
Author: Tomaz Vajngerl <tomaz.vajng...@collabora.com>
Date:   Wed Apr 6 07:14:43 2016 +0200

opengl: use GL_BGRA as default backend format on WNT

Change-Id: Iccc4270b2df87c0c44c133732b6cf05448dfe7d3

diff --git a/vcl/opengl/texture.cxx b/vcl/opengl/texture.cxx
index 1f270bc..0a83661 100644
--- a/vcl/opengl/texture.cxx
+++ b/vcl/opengl/texture.cxx
@@ -30,6 +30,15 @@
 #include "opengl/texture.hxx"
 #include "opengl/zone.hxx"
 
+namespace
+{
+#ifdef WNT
+const GLenum constDefaultBackendFormat = GL_RGBA;
+#else
+const GLenum constDefaultBackendFormat = GL_BGRA;
+#endif
+} // end anonymous namespace
+
 // texture with allocated size
 ImplOpenGLTexture::ImplOpenGLTexture( int nWidth, int nHeight, bool bAllocate 
) :
 mnRefCount( 1 ),
@@ -55,7 +64,7 @@ ImplOpenGLTexture::ImplOpenGLTexture( int nWidth, int 
nHeight, bool bAllocate )
 CHECK_GL_ERROR();
 if( bAllocate )
 {
-glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, nWidth, nHeight, 0, GL_RGBA, 
GL_UNSIGNED_BYTE, nullptr );
+glTexImage2D( GL_TEXTURE_2D, 0, constDefaultBackendFormat, nWidth, 
nHeight, 0, constDefaultBackendFormat, GL_UNSIGNED_BYTE, nullptr );
 CHECK_GL_ERROR();
 }
 glBindTexture( GL_TEXTURE_2D, 0 );
@@ -91,7 +100,7 @@ ImplOpenGLTexture::ImplOpenGLTexture( int nX, int nY, int 
nWidth, int nHeight )
 CHECK_GL_ERROR();
 glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
 CHECK_GL_ERROR();
-glCopyTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, nX, nY, nWidth, nHeight, 0 );
+glCopyTexImage2D( GL_TEXTURE_2D, 0, constDefaultBackendFormat, nX, nY, 
nWidth, nHeight, 0 );
 CHECK_GL_ERROR();
 glBindTexture( GL_TEXTURE_2D, 0 );
 CHECK_GL_ERROR();
@@ -128,7 +137,7 @@ ImplOpenGLTexture::ImplOpenGLTexture( int nWidth, int 
nHeight, int nFormat, int
 CHECK_GL_ERROR();
 glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
 CHECK_GL_ERROR();
-glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, mnWidth, mnHeight, 0, nFormat, 
nType, pData );
+glTexImage2D( GL_TEXTURE_2D, 0, constDefaultBackendFormat, mnWidth, 
mnHeight, 0, nFormat, nType, pData );
 CHECK_GL_ERROR();
 glBindTexture( GL_TEXTURE_2D, 0 );
 CHECK_GL_ERROR();
commit c71c18a8e9ea45b1dafe4c2218c69e0928be9bc5
Author: Tomaz Vajngerl <tomaz.vajng...@collabora.com>
Date:   Wed Apr 6 07:13:37 2016 +0200

opengl: fix wrong clipping when drawing text

Change-Id: Icc953510f7111f630764486e1ca159c965b534e8

diff --git a/vcl/inc/openglgdiimpl.hxx b/vcl/inc/openglgdiimpl.hxx
index dc0cdc2..6dfa73c 100644
--- a/vcl/inc/openglgdiimpl.hxx
+++ b/vcl/inc/openglgdiimpl.hxx
@@ -148,7 +148,7 @@ public:
 void DrawAxialGradient( const Gradient& rGradient, const Rectangle& rRect 
);
 void DrawRadialGradient( const Gradient& rGradient, const Rectangle& rRect 
);
 void DeferredTextDraw(OpenGLTexture& rTexture, const SalColor nMaskColor, 
const SalTwoRect& rPosAry);
-void FlushDeferredDrawing(bool bInDraw = false);
+void FlushDeferredDrawing();
 
 public:
 // get the width of the device
@@ -169,6 +169,9 @@ public:
 // operations to do before painting
 void PreDraw(XOROption eOpt = IGNORE_XOR);
 
+// initialize pre-draw state
+void InitializePreDrawState(XOROption eOpt = IGNORE_XOR);
+
 // operations to do after painting
 void PostDraw();
 
diff --git a/vcl/opengl/gdiimpl.cxx b/vcl/opengl/gdiimpl.cxx
index dae26d6..c403d1f 100644
--- a/vcl/opengl/gdiimpl.cxx
+++ b/vcl/opengl/gdiimpl.cxx
@@ -185,6 +185,13 @@ void OpenGLSalGraphicsImpl::DeInit()
 
 void OpenGLSalGraphicsImpl::PreDraw(XOROption eOpt)
 {
+FlushDeferredDrawing();
+
+InitializePreDrawState(eOpt);
+}
+
+void OpenGLSalGraphicsImpl::InitializePreDrawState(XOROption eOpt)
+{
 OpenGLZone::enter();
 
 mnDrawCount++;
@@ -204,8 +211,6 @@ void OpenGLSalGraphicsImpl::PreDraw(XOROption eOpt)
 glViewport( 0, 0, GetWidth(), GetHeight() );
 CHECK_GL_ERROR();
 
-FlushDeferredDrawing(true);
-
 ImplInitClipRegion();
 CHECK_GL_ERROR();
 
@@ -266,6 +271,7 @@ void OpenGLSalGraphicsImpl::freeResources()
 {
 VCL_GL_INFO( "freeResources" );
 mpContext->makeCurrent();
+FlushDeferredDrawing();
 mpContext->ReleaseFramebuffer( maOffscreenTex );
 }
 ReleaseContext();
@@ -355,12 +361,16 @@ const vcl::Region& OpenGLSalGraphicsImpl::getClipRegion() 
const
 
 bool OpenGLSalGraphicsImpl::setClipRegion( const vcl::Region& rClip )
 {
-VCL_GL_INFO( "::setClipRegion " << rClip );
 if (maClipRegion == rClip)
+{
+VCL_GL_INFO("::setClipRegion (n

[Libreoffice-commits] core.git: Branch 'feature/fixes19' - vcl/win

2016-04-04 Thread Tomaz Vajngerl
 vcl/win/source/gdi/winlayout.cxx |6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

New commits:
commit e43faaf4c4842246026b7ee988f63a7dabb2846a
Author: Tomaz Vajngerl <tomaz.vajng...@collabora.com>
Date:   Mon Apr 4 16:07:17 2016 +0200

fix compilation error

Change-Id: If59355ca54fd04ff16953eabb321f6658b50a05c

diff --git a/vcl/win/source/gdi/winlayout.cxx b/vcl/win/source/gdi/winlayout.cxx
index c23f453..0855884 100644
--- a/vcl/win/source/gdi/winlayout.cxx
+++ b/vcl/win/source/gdi/winlayout.cxx
@@ -2678,10 +2678,12 @@ bool UniscribeLayout::CacheGlyphs(SalGraphics& 
rGraphics) const
 {
 for (int i = 0; i < mnGlyphCount; i++)
 {
-if (mrWinFontEntry.GlyphIsCached(mpOutGlyphs[i]))
+int nCodePoint = mpOutGlyphs[i];
+
+if (mrWinFontEntry.GetGlyphCache().IsGlyphCached(nCodePoint))
 continue;
 
-if (!mrWinFontEntry.AddChunkOfGlyphs(true, mpOutGlyphs[i], *this, 
rGraphics))
+if (!mrWinFontEntry.CacheGlyphToAtlas(true, nCodePoint, *this, 
rGraphics))
 return false;
 }
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'feature/fixes18' - vcl/inc vcl/opengl

2016-03-14 Thread Tomaz Vajngerl
 vcl/inc/opengl/AccumulatedTextures.hxx |   39 ++-
 vcl/inc/opengl/texture.hxx |4 ++
 vcl/opengl/gdiimpl.cxx |   42 --
 vcl/opengl/texture.cxx |   46 +
 4 files changed, 99 insertions(+), 32 deletions(-)

New commits:
commit f2f274b55d0b6a8faf3dde83c14d6aded1e8ba09
Author: Tomaz Vajngerl <tomaz.vajng...@collabora.com>
Date:   Mon Mar 14 23:01:10 2016 +0100

opengl: optimize text texture drawing

Change-Id: I795779fa90fd147df8bfb9310ac2b9ce99c85b35

diff --git a/vcl/inc/opengl/AccumulatedTextures.hxx 
b/vcl/inc/opengl/AccumulatedTextures.hxx
index 3fe327c..9ce170c 100644
--- a/vcl/inc/opengl/AccumulatedTextures.hxx
+++ b/vcl/inc/opengl/AccumulatedTextures.hxx
@@ -15,10 +15,20 @@
 #include "opengl/texture.hxx"
 #include 
 
+struct TextureDrawParameters
+{
+std::vector maVertices;
+std::vector maTextureCoords;
+GLint getNumberOfVertices()
+{
+return maVertices.size() / 2;
+}
+};
+
 struct AccumulatedTexturesEntry
 {
 OpenGLTexture maTexture;
-std::unordered_map<SalColor, std::vector> maColorTwoRectMap;
+std::unordered_map<SalColor, TextureDrawParameters> 
maColorTextureDrawParametersMap;
 
 AccumulatedTexturesEntry(const OpenGLTexture& rTexture)
 : maTexture(rTexture)
@@ -26,7 +36,32 @@ struct AccumulatedTexturesEntry
 
 void insert(const SalColor& aColor, const SalTwoRect& r2Rect)
 {
-maColorTwoRectMap[aColor].push_back(r2Rect);
+TextureDrawParameters& aDrawParameters = 
maColorTextureDrawParametersMap[aColor];
+maTexture.FillCoords(aDrawParameters.maTextureCoords, 
r2Rect, false);
+
+GLfloat nX1 = r2Rect.mnDestX;
+GLfloat nY1 = r2Rect.mnDestY;
+GLfloat nX2 = r2Rect.mnDestX + r2Rect.mnDestWidth;
+GLfloat nY2 = r2Rect.mnDestY + r2Rect.mnDestHeight;
+
+auto& rVertices = aDrawParameters.maVertices;
+rVertices.push_back(nX1);
+rVertices.push_back(nY1);
+
+rVertices.push_back(nX2);
+rVertices.push_back(nY1);
+
+rVertices.push_back(nX1);
+rVertices.push_back(nY2);
+
+rVertices.push_back(nX1);
+rVertices.push_back(nY2);
+
+rVertices.push_back(nX2);
+rVertices.push_back(nY1);
+
+rVertices.push_back(nX2);
+rVertices.push_back(nY2);
 }
 };
 
diff --git a/vcl/inc/opengl/texture.hxx b/vcl/inc/opengl/texture.hxx
index 9388918..c51948d 100644
--- a/vcl/inc/opengl/texture.hxx
+++ b/vcl/inc/opengl/texture.hxx
@@ -111,6 +111,7 @@ public:
 GLuint  Id() const;
 int GetWidth() const;
 int GetHeight() const;
+
 voidGetCoord( GLfloat* pCoord, const SalTwoRect& rPosAry, bool 
bInverted=false ) const;
 voidGetWholeCoord( GLfloat* pCoord ) const;
 
@@ -130,6 +131,9 @@ public:
 OpenGLTexture&  operator=( const OpenGLTexture& rTexture );
 booloperator==( const OpenGLTexture& rTexture ) const;
 booloperator!=( const OpenGLTexture& rTexture ) const;
+
+template
+void FillCoords(std::vector& aCoordVector, const SalTwoRect& 
rPosAry, bool bInverted) const;
 };
 
 #endif // INCLUDED_VCL_INC_OPENGL_TEXTURE_H
diff --git a/vcl/opengl/gdiimpl.cxx b/vcl/opengl/gdiimpl.cxx
index 567ecf2..f7c165b 100644
--- a/vcl/opengl/gdiimpl.cxx
+++ b/vcl/opengl/gdiimpl.cxx
@@ -1607,16 +1607,15 @@ void OpenGLSalGraphicsImpl::FlushDeferredDrawing(bool 
bIsInDraw)
 }
 aUseColor = aColorForTextureMap[rTexture.Id()];
 
-
-
 if (!UseSolid(MAKE_SALCOLOR(aUseColor.GetRed(), aUseColor.GetGreen(), 
aUseColor.GetBlue(
 return;
-for (auto rColorTwoRectPair: rPair.second->maColorTwoRectMap)
+for (auto rColorTwoRectPair: 
rPair.second->maColorTextureDrawParametersMap)
 {
-for (SalTwoRect& rPosAry : rColorTwoRectPair.second)
-{
-DrawRect(rPosAry.mnDestX, rPosAry.mnDestY, 
rPosAry.mnDestWidth, rPosAry.mnDestHeight);
-}
+TextureDrawParameters& rParameters = rColorTwoRectPair.second;
+ApplyProgramMatrices();
+mpProgram->SetTextureCoord(rParameters.maTextureCoords.data());
+mpProgram->SetVertices(rParameters.maVertices.data());
+glDrawArrays(GL_TRIANGLES, 0, rParameters.getNumberOfVertices());
 }
 }
 #endif
@@ -1628,31 +1627,14 @@ void OpenGLSalGraphicsImpl::FlushDeferredDrawing(bool 
bIsInDraw)
 {
 OpenGLTexture& rTexture = rPair.second->maTexture;
 mpProgram->SetTexture("sampler", rTexture);
-for (auto& rColorTwoRectPair: rPair.second->maColorTwoRectMap)
+for (auto& rColorTwoRectPair: 
rPair.second->maColorTextureDrawParametersMap)
 {
 

Re: Unit-Test break Build under Windows

2015-03-23 Thread Tomaz Vajngerl
Hi,

On March 20, 2015 12:34 CET, Juergen Funk Mailinglist juergen.funk...@cib.de 
wrote: 
 
 Hi Tomaz,
 
 
 The Unitest htmlexport break on my windows machine with following error
   test/source/xmltesttools.cxx(99) : error : Assertion
   Test name: testExportImageProperties::Import_Export
   equality assertion failed
   - Expected: 38
   - Actual  : 47
   - In file:///D:/dev/cygwin/tmp/lu1rqes.tmp, attribute 'hspace' of 
 '/html/body/p/a/font/img' incorrect value.
 
   Failures !!!
   Run: 15   Failure total: 1   Failures: 1   Errors: 0
 
 The values are 
   origin  my 
 hspace, 3847
 vspace, 1924
 width222  277
 height   222  277
 
 The factor is 1,25 that is exactly my SYSTEM DPI-Setting (125 DPI).
 
 I look to the image and the scale is not correct too, but I think the scale 
 for the windows has nothing to do with the picture, when save (the font size 
 is not change).
 But I must always switch off the test in this file  
 test/source/xmltesttools.cxx, line 99 and I think that failure is for the 
 other OS the same (MAC, WIN64) .
 
 I would be very grateful if you could fix this

OK, I'll disable these checks. This can not be correct anyway - as long as we 
don't move the export of images to css where we can define the values in 
concrete units.
 
 Thanks
 Juergen

Regards, Tomaž
 
 
 
 


___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: [GSoC] Improved Color Selection - how do I load .soc files

2014-07-25 Thread Tomaz Vajngerl
Hi,

On July 25, 2014 04:11 CEST, Krisztian Pinter pin.termina...@gmail.com wrote: 
 Hi All!
 
 I'm trying to load .soc palettes, they are in XML format, and it's
 hardcoded in LO to load standard.soc to get the default colors.
 
 The loading process starts here:
 http://opengrok.libreoffice.org/xref/core/svx/source/xoutdev/xtable.cxx#234
 SvxXMLXTableImport::load returns it's result to an object created
 by createInstance().
 CreateInstance is here:
 http://opengrok.libreoffice.org/xref/core/svx/source/xoutdev/xtabcolr.cxx#58
 It calls this:
 http://opengrok.libreoffice.org/xref/core/svx/source/unodraw/XPropertyTable.cxx#269
 
 And this kind of keeps going but I'm not really closer to what I want to
 do, namely to have a function that is given a path to a .soc file, and
 returns a vector of colors.
 
 If anyone has any insights, please share them! Thank you!

You need to do something like this:

XColorListRef pList = 
XPropertyList::AsColorList(XPropertyList::CreatePropertyListFromURL(XCOLOR_LIST,
 path/to/soc/file));
pList-Load();

I think you already convert from XColorListRef somewhere to color vector so use 
that. :)

 All the best,
 Krisztian
 
Regards, Tomaž 
 
 

___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: [PUSHED] Re: Do not convert SVGs to JPEGs when editing with external tool

2014-03-07 Thread Tomaz Vajngerl
On March 07, 2014 19:39 CET, Jan Holesovsky ke...@collabora.com wrote:  
 Adding Tomaž who is IIRC author of the editing with external editor -
 Tomaž, can you please check?

Yeah, it looks good. It's not so much about external editor as it is about sane 
defaults for any kind of conversion between graphic formats and exporting.  

On March 07, 2014 19:47 CET, Alex Henrie alexhenri...@gmail.com wrote: 
  Thanks for asking. I've thought about removing some of LibreOffice's
 Java dependencies, particularly Rhino, but I don't know if I'll have
 the time. Do you know if anyone else is working on replacing Rhino
 with, say, SpiderMonkey?
 
 -Alex
 
 I really don't think anyone is working on replacing Rhino. :) I was looking 
into it at some point but I didn't get really far. There are other - more 
rewarding things to fix.
 
 Regards, Tomaž

___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice