From 35fc58d4986d4379e5d7a73498560100b62ec47c Mon Sep 17 00:00:00 2001 From: rrti Date: Sun, 11 Jun 2017 18:21:34 +0200 Subject: [PATCH] fix #5611 --- rts/Rendering/GL/myGL.cpp | 7 +++++-- rts/Rendering/Textures/Bitmap.cpp | 10 ++++++---- rts/Rendering/Textures/Bitmap.h | 2 +- rts/Rendering/Textures/NamedTextures.cpp | 2 +- 4 files changed, 13 insertions(+), 8 deletions(-) diff --git a/rts/Rendering/GL/myGL.cpp b/rts/Rendering/GL/myGL.cpp index a3186a1b55e..c1cf940ff6c 100644 --- a/rts/Rendering/GL/myGL.cpp +++ b/rts/Rendering/GL/myGL.cpp @@ -6,6 +6,10 @@ #include #include +#if (!defined(HEADLESS) && !defined(WIN32) && !defined(__APPLE__)) +// need this for glXQueryCurrentRendererIntegerMESA (glxext) +#include +#endif #include "myGL.h" #include "VertexArray.h" @@ -139,7 +143,6 @@ static bool GetVideoMemInfoMESA(GLint* memInfo) if (!GLXEW_MESA_query_renderer) return false; - // FIXME? may need to include glx.h (or glxext.h directly) typedef PFNGLXQUERYCURRENTRENDERERINTEGERMESAPROC QCRIProc; static constexpr const GLubyte* qcriProcName = (const GLubyte*) "glXQueryCurrentRendererIntegerMESA"; @@ -149,7 +152,7 @@ static bool GetVideoMemInfoMESA(GLint* memInfo) return false; // note: unlike the others, this value is returned in megabytes - qcriProcAddr(GLX_RENDERER_VIDEO_MEMORY_MESA, &memInfo[0]); + qcriProcAddr(GLX_RENDERER_VIDEO_MEMORY_MESA, reinterpret_cast(&memInfo[0])); memInfo[0] *= 1024; memInfo[1] = memInfo[0]; diff --git a/rts/Rendering/Textures/Bitmap.cpp b/rts/Rendering/Textures/Bitmap.cpp index bb2e8e4a22c..dc290af6a2d 100644 --- a/rts/Rendering/Textures/Bitmap.cpp +++ b/rts/Rendering/Textures/Bitmap.cpp @@ -923,7 +923,9 @@ void CBitmap::InvertColors() void CBitmap::InvertAlpha() { - if (compressed) return; // Don't try to invert DDS + if (compressed) + return; // Don't try to invert DDS + for (int y = 0; y < ysize; ++y) { for (int x = 0; x < xsize; ++x) { const int base = ((y * xsize) + x) * 4; @@ -933,11 +935,11 @@ void CBitmap::InvertAlpha() } -void CBitmap::GrayScale() +void CBitmap::MakeGrayScale() { - if (compressed) { + if (compressed) return; - } + for (int y = 0; y < ysize; ++y) { for (int x = 0; x < xsize; ++x) { const int base = ((y * xsize) + x) * 4; diff --git a/rts/Rendering/Textures/Bitmap.h b/rts/Rendering/Textures/Bitmap.h index b1591814ae5..d48f6a3dddf 100644 --- a/rts/Rendering/Textures/Bitmap.h +++ b/rts/Rendering/Textures/Bitmap.h @@ -76,7 +76,7 @@ class CBitmap void ReverseYAxis(); void InvertColors(); void InvertAlpha(); - void GrayScale(); + void MakeGrayScale(); void Tint(const float tint[3]); }; diff --git a/rts/Rendering/Textures/NamedTextures.cpp b/rts/Rendering/Textures/NamedTextures.cpp index 47aabfe2aff..391721db975 100644 --- a/rts/Rendering/Textures/NamedTextures.cpp +++ b/rts/Rendering/Textures/NamedTextures.cpp @@ -216,7 +216,7 @@ namespace CNamedTextures { } else { if (resize) bitmap = bitmap.CreateRescaled(resizeDimensions.x,resizeDimensions.y); if (invert) bitmap.InvertColors(); - if (greyed) bitmap.GrayScale(); + if (greyed) bitmap.MakeGrayScale(); if (tint) bitmap.Tint(tintColor); //! make the texture