summaryrefslogtreecommitdiff
path: root/external/libgltf/patches/extend_get_bitmap_for_rgba_ones.patch
diff options
context:
space:
mode:
authorZolnai Tamás <tamas.zolnai@collabora.com>2014-06-25 15:19:41 +0200
committerZolnai Tamás <zolnaitamas2000@gmail.com>2014-06-25 13:22:29 +0000
commit6403f2b59b4c83e0899012e5ca0ddd705784350c (patch)
treeccc8080f9b4ba808f2fec310aedd15703c41170b /external/libgltf/patches/extend_get_bitmap_for_rgba_ones.patch
parent076e4afc61b216e34959bd4e3701f1fa19972d5c (diff)
Update libgltf: new build system and various fixes
Building: - The new tarball has reasonable build system so build libgltf as external package instead of compiling source files directly. - Freetype dependancy is removed Improvements comes with the new libgltf - Can rotate the models too (orbit mode) - Two camera handling mode: walkthrough and orbit (press M to change). - gltf_animation_set_time() works - FPS can be displayed without freetype (press F) Additional notes: - There were some bugs/regressions which are fixed during the integration (see patches). - License files are uddated now. - libgltf building is enabled only on those platforms on which gltf support actually works (windows and linux) Change-Id: Ia6c9c4da53a9b4fedba0d73aa5791489f8ad424b Reviewed-on: https://gerrit.libreoffice.org/9895 Reviewed-by: Zolnai Tamás <zolnaitamas2000@gmail.com> Tested-by: Zolnai Tamás <zolnaitamas2000@gmail.com>
Diffstat (limited to 'external/libgltf/patches/extend_get_bitmap_for_rgba_ones.patch')
-rw-r--r--external/libgltf/patches/extend_get_bitmap_for_rgba_ones.patch76
1 files changed, 76 insertions, 0 deletions
diff --git a/external/libgltf/patches/extend_get_bitmap_for_rgba_ones.patch b/external/libgltf/patches/extend_get_bitmap_for_rgba_ones.patch
new file mode 100644
index 000000000000..8b9f3dbf7b25
--- /dev/null
+++ b/external/libgltf/patches/extend_get_bitmap_for_rgba_ones.patch
@@ -0,0 +1,76 @@
+diff -ur libgltf.org/src/RenderScene.cpp libgltf/src/RenderScene.cpp
+--- libgltf.org/src/RenderScene.cpp 2014-06-23 18:49:46.603119797 +0200
++++ libgltf/src/RenderScene.cpp 2014-06-23 19:00:17.583092627 +0200
+@@ -1735,28 +1735,29 @@
+
+ void RenderScene::setBitZoom(unsigned char* Dstbuffer,
+ unsigned char* Srcbuffer,
+- glTFViewport* pViewport)
++ glTFViewport* pViewport,
++ int bufferDepth )
+ {
+ const int width = pViewport->width;
+ const int height = pViewport->height;
+- const int newLineByte = (width * 3 + 3) / 4 * 4;
+- const int lineByte = (width * SSAA * 3 + 3) / 4 * 4;
++ const int newLineByte = width * bufferDepth;
++ const int lineByte = width * SSAA * bufferDepth;
+ for (int i = 0; i < height; i++)
+ {
+ for (int j = 0; j < width; j++)
+- for (int k = 0; k < 3; k++)
++ for (int k = 0; k < bufferDepth; k++)
+ {
+ long xData = (long)(i * SSAA + 0.5);
+ long yData = (long)(j * SSAA + 0.5);
+ if((yData >= 0) && (yData < width * SSAA) &&
+ (xData >= 0) && (xData < height * SSAA))
+ {
+- *(Dstbuffer + i * newLineByte + j * 3 + k) =
+- *(Srcbuffer + xData * lineByte + yData * 3 + k);
++ *(Dstbuffer + i * newLineByte + j * bufferDepth + k) =
++ *(Srcbuffer + xData * lineByte + yData * bufferDepth + k);
+ }
+ else
+ {
+- *(Dstbuffer + i * newLineByte + j * 3 + k) = 255;
++ *(Dstbuffer + i * newLineByte + j * bufferDepth + k) = 255;
+ }
+ }
+ }
+@@ -1782,12 +1783,20 @@
+ {
+ return;
+ }
+- int imageSize = ((width + ((4 - (width % 4)) % 4)) *
+- height * 3) + 2;
++
++ int bufferDepth;
++ if( format == GL_RGB || format == GL_BGR )
++ bufferDepth = 3;
++ else if( format == GL_RGBA || format == GL_BGRA )
++ bufferDepth = 4;
++ else
++ return;
++
++ int imageSize = width * height * bufferDepth;
+ unsigned char *pbuffer = new unsigned char[imageSize];
+ glReadPixels(0, 0, width, height, format,
+ GL_UNSIGNED_BYTE, pbuffer);
+- setBitZoom(buffer, pbuffer, pViewport);
++ setBitZoom(buffer, pbuffer, pViewport, bufferDepth);
+ if (pbuffer)
+ {
+ delete [] pbuffer;
+diff -ur libgltf.org/src/RenderScene.h libgltf/src/RenderScene.h
+--- libgltf.org/src/RenderScene.h 2014-06-23 18:49:46.587119798 +0200
++++ libgltf/src/RenderScene.h 2014-06-23 18:59:46.991093944 +0200
+@@ -234,7 +234,7 @@
+ void completeRenderBitmap(glTFViewport* pViewport,
+ unsigned char* buffer, GLenum format);
+ void setBitZoom(unsigned char* Dstbuffer,
+- unsigned char* Srcbuffer, glTFViewport* pViewport);
++ unsigned char* Srcbuffer, glTFViewport* pViewport, int bufferDepth );
+
+ // For animation
+ void startAnimation();