[Libreoffice-commits] core.git: Branch 'private/moggi/fix-text-rendering' - chart2/source
Markus Mohrhard
markus.mohrhard at collabora.co.uk
Tue Jan 14 07:24:32 PST 2014
chart2/source/view/main/OpenGLRender.cxx | 37 ++-----------------------------
chart2/source/view/main/OpenGLRender.hxx | 4 ++-
2 files changed, 6 insertions(+), 35 deletions(-)
New commits:
commit 22ee0aa12c7d6ee04f00bf5a3f42a3b89b00670d
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date: Tue Jan 14 16:15:41 2014 +0100
we only need one of the BMP header functions
Additionally we don't need them when we don't write to a file.
Change-Id: Ib38f68f8f88490f6dfff9fffe7924a707438a040
diff --git a/chart2/source/view/main/OpenGLRender.cxx b/chart2/source/view/main/OpenGLRender.cxx
index acaf03f..451b169 100644
--- a/chart2/source/view/main/OpenGLRender.cxx
+++ b/chart2/source/view/main/OpenGLRender.cxx
@@ -44,8 +44,7 @@ using namespace com::sun::star;
using namespace std;
-#define RENDER_TO_FILE 0
-#define DEBUG_PNG 1
+#define DEBUG_PNG 0
#define BMP_HEADER_LEN 54
#if DEBUG_PNG
@@ -969,6 +968,7 @@ void OpenGLRender::SetHeight(int height)
m_Projection = glm::ortho(0.f, float(m_iWidth), 0.f, float(m_iHeight), -4.f, 3.f);
}
+#if RENDER_TO_FILE
int OpenGLRender::CreateBMPHeader(sal_uInt8 *bmpHeader, int xsize, int ysize)
{
unsigned char header[BMP_HEADER_LEN] = {
@@ -997,8 +997,8 @@ int OpenGLRender::CreateBMPHeader(sal_uInt8 *bmpHeader, int xsize, int ysize)
header[25] = (height >> 24) &0x000000ff;
memcpy(bmpHeader, header, BMP_HEADER_LEN);
return 0;
-
}
+#endif
void OpenGLRender::SetLine2DColor(sal_uInt8 r, sal_uInt8 g, sal_uInt8 b)
{
@@ -1573,37 +1573,6 @@ int OpenGLRender::RenderTextShape()
return 0;
}
-int OpenGLRender::CreateBMPHeaderRGBA(sal_uInt8 *bmpHeader, int xsize, int ysize)
-{
- unsigned char header[BMP_HEADER_LEN] = {
- 0x42, 0x4d, 0, 0, 0, 0, 0, 0, 0, 0,
- 54, 0, 0, 0, 40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 32, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0
- };
-
- long file_size = (long)xsize * (long)ysize * 4 + 54;
- header[2] = (unsigned char)(file_size &0x000000ff);
- header[3] = (file_size >> 8) & 0x000000ff;
- header[4] = (file_size >> 16) & 0x000000ff;
- header[5] = (file_size >> 24) & 0x000000ff;
-
- long width = xsize;
- header[18] = width & 0x000000ff;
- header[19] = (width >> 8) &0x000000ff;
- header[20] = (width >> 16) &0x000000ff;
- header[21] = (width >> 24) &0x000000ff;
-
- long height = -ysize;
- header[22] = height &0x000000ff;
- header[23] = (height >> 8) &0x000000ff;
- header[24] = (height >> 16) &0x000000ff;
- header[25] = (height >> 24) &0x000000ff;
- memcpy(bmpHeader, header, BMP_HEADER_LEN);
- return 0;
-
-}
-
int OpenGLRender::SetArea2DShapePoint(float x, float y, int listLength)
{
if (m_Area2DPointList.empty())
diff --git a/chart2/source/view/main/OpenGLRender.hxx b/chart2/source/view/main/OpenGLRender.hxx
index 6649930..84d083e 100644
--- a/chart2/source/view/main/OpenGLRender.hxx
+++ b/chart2/source/view/main/OpenGLRender.hxx
@@ -54,6 +54,7 @@ namespace unx
#define OPENGL_SCALE_VALUE 20
#define DEBUG_POSITIONING 0
+#define RENDER_TO_FILE 0
typedef struct PosVeci3
{
@@ -145,8 +146,9 @@ public:
void SetWidth(int width);
void SetHeight(int height);
void Release();
+#if RENDER_TO_FILE
int CreateBMPHeader(sal_uInt8 *bmpHeader, int xsize, int ysize);
- int CreateBMPHeaderRGBA(sal_uInt8 *bmpHeader, int xsize, int ysize);
+#endif
int RenderLine2FBO(int wholeFlag);
int SetLine2DShapePoint(float x, float y, int listLength);
void SetLine2DColor(sal_uInt8 r, sal_uInt8 g, sal_uInt8 b);
More information about the Libreoffice-commits
mailing list