Skip to content

Commit

Permalink
fix #5611
Browse files Browse the repository at this point in the history
  • Loading branch information
rrti committed Jun 11, 2017
1 parent 759e17c commit 35fc58d
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 8 deletions.
7 changes: 5 additions & 2 deletions rts/Rendering/GL/myGL.cpp
Expand Up @@ -6,6 +6,10 @@
#include <cmath>

#include <SDL.h>
#if (!defined(HEADLESS) && !defined(WIN32) && !defined(__APPLE__))
// need this for glXQueryCurrentRendererIntegerMESA (glxext)
#include <GL/glxew.h>
#endif

#include "myGL.h"
#include "VertexArray.h"
Expand Down Expand Up @@ -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";
Expand All @@ -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<unsigned int*>(&memInfo[0]));

memInfo[0] *= 1024;
memInfo[1] = memInfo[0];
Expand Down
10 changes: 6 additions & 4 deletions rts/Rendering/Textures/Bitmap.cpp
Expand Up @@ -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;
Expand All @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion rts/Rendering/Textures/Bitmap.h
Expand Up @@ -76,7 +76,7 @@ class CBitmap
void ReverseYAxis();
void InvertColors();
void InvertAlpha();
void GrayScale();
void MakeGrayScale();
void Tint(const float tint[3]);
};

Expand Down
2 changes: 1 addition & 1 deletion rts/Rendering/Textures/NamedTextures.cpp
Expand Up @@ -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
Expand Down

0 comments on commit 35fc58d

Please sign in to comment.