summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2015-11-25 08:31:22 +0100
committerStephan Bergmann <sbergman@redhat.com>2015-11-28 08:44:38 +0100
commitc091a9f06d37246de61ad8ecc39fe9fb9f9ec7a7 (patch)
tree71960d0b5bb7c22e2861afd0da42354da5d18521
parentAdapt to true wchar_t in clang-cl (diff)
downloadcore-c091a9f06d37246de61ad8ecc39fe9fb9f9ec7a7.tar.gz
core-c091a9f06d37246de61ad8ecc39fe9fb9f9ec7a7.zip
Don't wrap glyphy source files in namespace GLyphyDemo
...as the source files themselves include standard headers, which must not be included from within a namespace (which confuses clang-cl). According to Tor, the original intent was to try not to pollute the global namespace, but that seems to cause no problems in practice (esp. as nothing from these files gets exported). Change-Id: I204c1db932996a09d16e84dd5c6033caa5362caa
-rwxr-xr-xvcl/glyphy/demo.cxx2
-rw-r--r--vcl/inc/glyphy/demo.hxx2
-rw-r--r--vcl/win/source/gdi/winlayout.cxx46
3 files changed, 23 insertions, 27 deletions
diff --git a/vcl/glyphy/demo.cxx b/vcl/glyphy/demo.cxx
index e362e36c6ee3..746a6dcfe84c 100755
--- a/vcl/glyphy/demo.cxx
+++ b/vcl/glyphy/demo.cxx
@@ -12,10 +12,8 @@
#include <prewin.h>
#include <postwin.h>
-namespace GLyphyDemo {
#include "demo/demo-atlas.cc"
#include "demo/demo-buffer.cc"
#include "demo/demo-font.cc"
#include "demo/demo-shader.cc"
#include "demo/matrix4x4.c"
-}
diff --git a/vcl/inc/glyphy/demo.hxx b/vcl/inc/glyphy/demo.hxx
index 2323186764cf..ef716b969c56 100644
--- a/vcl/inc/glyphy/demo.hxx
+++ b/vcl/inc/glyphy/demo.hxx
@@ -10,12 +10,10 @@
#ifndef INCLUDED_VCL_INC_GLYPHY_DEMO_HXX
#define INCLUDED_VCL_INC_GLYPHY_DEMO_HXX
-namespace GLyphyDemo {
#include "demo-atlas.h"
#include "demo-buffer.h"
#include "demo-font.h"
#include "demo-shader.h"
#include "matrix4x4.h"
-}
#endif // INCLUDED_VCL_INC_GLYPHY_DEMO_HXX
diff --git a/vcl/win/source/gdi/winlayout.cxx b/vcl/win/source/gdi/winlayout.cxx
index a505b44587a7..d326006bc6e0 100644
--- a/vcl/win/source/gdi/winlayout.cxx
+++ b/vcl/win/source/gdi/winlayout.cxx
@@ -109,8 +109,8 @@ public:
int GetMinKashidaGlyph() const { return mnMinKashidaGlyph; }
static GLuint mnGLyphyProgram;
- GLyphyDemo::demo_atlas_t* mpGLyphyAtlas;
- GLyphyDemo::demo_font_t* mpGLyphyFont;
+ demo_atlas_t* mpGLyphyAtlas;
+ demo_font_t* mpGLyphyFont;
bool GlyphIsCached(int nGlyphIndex) const;
bool AddChunkOfGlyphs(int nGlyphIndex, const WinLayout& rLayout, SalGraphics& rGraphics);
@@ -501,10 +501,10 @@ void ImplWinFontEntry::setupGLyphy(HDC hDC)
}
if (mnGLyphyProgram == 0)
- mnGLyphyProgram = GLyphyDemo::demo_shader_create_program();
+ mnGLyphyProgram = demo_shader_create_program();
- mpGLyphyAtlas = GLyphyDemo::demo_atlas_create(2048, 1024, 64, 8);
- mpGLyphyFont = GLyphyDemo::demo_font_create(hNewDC, mpGLyphyAtlas);
+ mpGLyphyAtlas = demo_atlas_create(2048, 1024, 64, 8);
+ mpGLyphyFont = demo_font_create(hNewDC, mpGLyphyAtlas);
}
WinLayout::WinLayout(HDC hDC, const ImplWinFontData& rWFD, ImplWinFontEntry& rWFE, bool bUseOpenGL)
@@ -1827,9 +1827,9 @@ bool UniscribeLayout::CacheGlyphs(SalGraphics& rGraphics) const
if (mpOutGlyphs[i] == DROPPED_OUTGLYPH)
continue;
- GLyphyDemo::glyph_info_t aGI;
+ glyph_info_t aGI;
VCL_GL_INFO("Calling demo_font_lookup_glyph");
- GLyphyDemo::demo_font_lookup_glyph( mrWinFontEntry.mpGLyphyFont, mpOutGlyphs[i], &aGI );
+ demo_font_lookup_glyph( mrWinFontEntry.mpGLyphyFont, mpOutGlyphs[i], &aGI );
}
}
else
@@ -1863,7 +1863,7 @@ bool UniscribeLayout::DrawCachedGlyphsUsingGLyphy(SalGraphics& rGraphics) const
rGraphics.GetOpenGLContext()->UseNoProgram();
glUseProgram( mrWinFontEntry.mnGLyphyProgram );
CHECK_GL_ERROR();
- GLyphyDemo::demo_atlas_set_uniforms( mrWinFontEntry.mpGLyphyAtlas );
+ demo_atlas_set_uniforms( mrWinFontEntry.mpGLyphyAtlas );
GLint nLoc;
@@ -1942,7 +1942,7 @@ bool UniscribeLayout::DrawCachedGlyphsUsingGLyphy(SalGraphics& rGraphics) const
// font_size = 1; // ???
- std::vector<GLyphyDemo::glyph_vertex_t> vertices;
+ std::vector<glyph_vertex_t> vertices;
for (int i = nMinGlyphPos; i < nEndGlyphPos; i++)
{
// Ignore dropped glyphs.
@@ -1950,18 +1950,18 @@ bool UniscribeLayout::DrawCachedGlyphsUsingGLyphy(SalGraphics& rGraphics) const
continue;
// Total crack
- GLyphyDemo::glyphy_point_t pt;
+ glyphy_point_t pt;
pt.x = nAdvance + aPos.X() + mpGlyphOffsets[i].du;
pt.y = aPos.Y() + mpGlyphOffsets[i].dv;
- GLyphyDemo::glyph_info_t gi;
- GLyphyDemo::demo_font_lookup_glyph( mrWinFontEntry.mpGLyphyFont, mpOutGlyphs[i], &gi );
- GLyphyDemo::demo_shader_add_glyph_vertices( pt, font_size, &gi, &vertices, NULL );
+ glyph_info_t gi;
+ demo_font_lookup_glyph( mrWinFontEntry.mpGLyphyFont, mpOutGlyphs[i], &gi );
+ demo_shader_add_glyph_vertices( pt, font_size, &gi, &vertices, NULL );
nAdvance += pGlyphWidths[i];
}
GLfloat mat[16];
- GLyphyDemo::m4LoadIdentity( mat );
+ m4LoadIdentity( mat );
GLint viewport[4];
glGetIntegerv( GL_VIEWPORT, viewport );
@@ -1982,27 +1982,27 @@ bool UniscribeLayout::DrawCachedGlyphsUsingGLyphy(SalGraphics& rGraphics) const
double near = d / 4;
double far = near + d;
double factor = near / (2 * near + d);
- GLyphyDemo::m4Frustum( mat, -width * factor, width * factor, -height * factor, height * factor, near, far );
- GLyphyDemo::m4Translate( mat, 0, 0, -(near + d * 0.5) );
+ m4Frustum( mat, -width * factor, width * factor, -height * factor, height * factor, near, far );
+ m4Translate( mat, 0, 0, -(near + d * 0.5) );
}
// No rotation here
// Fix 'up'
- GLyphyDemo::m4Scale( mat, 1, -1, 1 );
+ m4Scale( mat, 1, -1, 1 );
// Foo
- // GLyphyDemo::m4Scale( mat, 0.5, 0.5, 1 );
+ // m4Scale( mat, 0.5, 0.5, 1 );
// The "Center buffer" part in demo_view_display()
- GLyphyDemo::m4Translate( mat, width/2, height/2, 0 );
+ m4Translate( mat, width/2, height/2, 0 );
#else
// Crack that just happens to show something (even if not completely in correct location) in
// some cases, but not all. I don't understand why.
double scale = std::max( 2/width, 2/height );
- GLyphyDemo::m4Scale( mat, scale, -scale, 1);
- GLyphyDemo::m4Translate( mat, -width/2, -height/2, 0 );
+ m4Scale( mat, scale, -scale, 1);
+ m4Translate( mat, -width/2, -height/2, 0 );
#endif
GLuint u_matViewProjection_loc = glGetUniformLocation( mrWinFontEntry.mnGLyphyProgram, "u_matViewProjection" );
@@ -2017,11 +2017,11 @@ bool UniscribeLayout::DrawCachedGlyphsUsingGLyphy(SalGraphics& rGraphics) const
glBindBuffer( GL_ARRAY_BUFFER, buf_name );
CHECK_GL_ERROR();
- glBufferData( GL_ARRAY_BUFFER, sizeof(GLyphyDemo::glyph_vertex_t) * vertices.size(), (const char *) &vertices[0], GL_STATIC_DRAW );
+ glBufferData( GL_ARRAY_BUFFER, sizeof(glyph_vertex_t) * vertices.size(), (const char *) &vertices[0], GL_STATIC_DRAW );
CHECK_GL_ERROR();
glEnableVertexAttribArray( a_glyph_vertex_loc );
CHECK_GL_ERROR();
- glVertexAttribPointer( a_glyph_vertex_loc, 4, GL_FLOAT, GL_FALSE, sizeof(GLyphyDemo::glyph_vertex_t), 0 );
+ glVertexAttribPointer( a_glyph_vertex_loc, 4, GL_FLOAT, GL_FALSE, sizeof(glyph_vertex_t), 0 );
CHECK_GL_ERROR();
glDrawArrays( GL_TRIANGLES, 0, vertices.size() );
CHECK_GL_ERROR();