summaryrefslogtreecommitdiff
path: root/vcl/inc
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2016-04-04 19:29:27 +0900
committerTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2016-04-08 19:10:12 +0900
commit80d0b2916db81a7f47bb1d368677016bbb870df6 (patch)
tree1904c88e39a30c645958b7dfa52b14095abd5135 /vcl/inc
parent40e9ed91bd8bbfecfc3832d73a81741d0aa97d3a (diff)
opengl: use packed texture atlas for glyph cache in win. backend
Change-Id: I6a627699d49bad47213788877fa3947ad2ef83f4
Diffstat (limited to 'vcl/inc')
-rw-r--r--vcl/inc/opengl/AccumulatedTextures.hxx17
-rw-r--r--vcl/inc/opengl/texture.hxx6
-rw-r--r--vcl/inc/openglgdiimpl.hxx2
-rw-r--r--vcl/inc/win/salgdi.h5
4 files changed, 19 insertions, 11 deletions
diff --git a/vcl/inc/opengl/AccumulatedTextures.hxx b/vcl/inc/opengl/AccumulatedTextures.hxx
index 9ce170c2a0af..e74c06535f69 100644
--- a/vcl/inc/opengl/AccumulatedTextures.hxx
+++ b/vcl/inc/opengl/AccumulatedTextures.hxx
@@ -11,6 +11,8 @@
#ifndef INCLUDED_VCL_INC_OPENGL_ACCUMULATEDTEXTURES_H
#define INCLUDED_VCL_INC_OPENGL_ACCUMULATEDTEXTURES_H
+#include <vcl/opengl/OpenGLHelper.hxx>
+
#include <o3tl/make_unique.hxx>
#include "opengl/texture.hxx"
#include <memory>
@@ -34,10 +36,10 @@ struct AccumulatedTexturesEntry
: maTexture(rTexture)
{}
- void insert(const SalColor& aColor, const SalTwoRect& r2Rect)
+ void insert(const OpenGLTexture& rTexture, const SalColor& aColor, const SalTwoRect& r2Rect)
{
TextureDrawParameters& aDrawParameters = maColorTextureDrawParametersMap[aColor];
- maTexture.FillCoords<GL_TRIANGLES>(aDrawParameters.maTextureCoords, r2Rect, false);
+ rTexture.FillCoords<GL_TRIANGLES>(aDrawParameters.maTextureCoords, r2Rect, false);
GLfloat nX1 = r2Rect.mnDestX;
GLfloat nY1 = r2Rect.mnDestY;
@@ -86,19 +88,18 @@ public:
maEntries.clear();
}
- void insert(const OpenGLTexture& rTexture, const SalColor& aColor, const SalTwoRect& r2Rect)
+ void insert(OpenGLTexture& rTexture, const SalColor& aColor, const SalTwoRect& r2Rect)
{
GLuint nTextureId = rTexture.Id();
- auto iterator = maEntries.find(nTextureId);
-
- if (iterator == maEntries.end())
+ if (maEntries.find(nTextureId) == maEntries.end())
{
- maEntries[nTextureId] = o3tl::make_unique<AccumulatedTexturesEntry>(rTexture);
+ OpenGLTexture aWholeTexture(rTexture.GetWholeTexture());
+ maEntries[nTextureId] = o3tl::make_unique<AccumulatedTexturesEntry>(aWholeTexture);
}
std::unique_ptr<AccumulatedTexturesEntry>& rEntry = maEntries[nTextureId];
- rEntry->insert(aColor, r2Rect);
+ rEntry->insert(rTexture, aColor, r2Rect);
}
AccumulatedTexturesMap& getAccumulatedTexturesMap()
diff --git a/vcl/inc/opengl/texture.hxx b/vcl/inc/opengl/texture.hxx
index f48a1a166b03..a220875ba1ac 100644
--- a/vcl/inc/opengl/texture.hxx
+++ b/vcl/inc/opengl/texture.hxx
@@ -96,7 +96,7 @@ private:
public:
OpenGLTexture();
- OpenGLTexture(ImplOpenGLTexture* pImpl, Rectangle aRectangle, int nSlotNumber = 0);
+ OpenGLTexture(ImplOpenGLTexture* pImpl, Rectangle aRectangle, int nSlotNumber);
OpenGLTexture( int nWidth, int nHeight, bool bAllocate = true );
OpenGLTexture( int nWidth, int nHeight, int nFormat, int nType, void const * pData );
@@ -113,13 +113,15 @@ public:
void GetCoord( GLfloat* pCoord, const SalTwoRect& rPosAry, bool bInverted=false ) const;
void GetWholeCoord( GLfloat* pCoord ) const;
-
+ OpenGLTexture GetWholeTexture();
void Bind();
void Unbind();
void Read( GLenum nFormat, GLenum nType, sal_uInt8* pData );
GLuint AddStencil();
GLuint StencilId() const;
+ bool CopyData(int nWidth, int nHeight, int nFormat, int nType, sal_uInt8* pData);
+
void SaveToFile(const OUString& rFileName);
GLenum GetFilter() const;
diff --git a/vcl/inc/openglgdiimpl.hxx b/vcl/inc/openglgdiimpl.hxx
index 0fb2941ace9c..756190135daa 100644
--- a/vcl/inc/openglgdiimpl.hxx
+++ b/vcl/inc/openglgdiimpl.hxx
@@ -147,7 +147,7 @@ public:
void DrawLinearGradient( const Gradient& rGradient, const Rectangle& rRect );
void DrawAxialGradient( const Gradient& rGradient, const Rectangle& rRect );
void DrawRadialGradient( const Gradient& rGradient, const Rectangle& rRect );
- void DeferredTextDraw(const OpenGLTexture& rTexture, const SalColor nMaskColor, const SalTwoRect& rPosAry);
+ void DeferredTextDraw(OpenGLTexture& rTexture, const SalColor nMaskColor, const SalTwoRect& rPosAry);
void FlushDeferredDrawing(bool bInDraw = false);
public:
diff --git a/vcl/inc/win/salgdi.h b/vcl/inc/win/salgdi.h
index ffd83ab251ad..8866dcfbc289 100644
--- a/vcl/inc/win/salgdi.h
+++ b/vcl/inc/win/salgdi.h
@@ -172,11 +172,16 @@ public:
SalTwoRect getTwoRect() { return maRects; }
+ Size getBitmapSize() { return Size(maRects.mnSrcWidth, maRects.mnSrcHeight); }
+
/// Reset the DC with the defined color.
void fill(sal_uInt32 color);
/// Obtain the texture; the caller must delete it after use.
OpenGLTexture* getTexture();
+
+ /// Copy bitmap data to the texture. Texutre must be initialized and the correct size to hold the bitmap.
+ bool copyToTexture(OpenGLTexture& aTexture);
};
class WinSalGraphics : public SalGraphics