Skip to content

Commit

Permalink
OPENGL: Prevent access to a few more members in the SDL OpenGL code.
Browse files Browse the repository at this point in the history
  • Loading branch information
Johannes Schickel committed Feb 15, 2012
1 parent 05af37c commit 5b3ebdf
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 11 deletions.
4 changes: 1 addition & 3 deletions backends/graphics/opengl/opengl-graphics.cpp
Expand Up @@ -594,10 +594,8 @@ void OpenGLGraphicsManager::warpMouse(int x, int y) {
scaledY += _displayY;
}

setMousePosition(scaledX, scaledY);
setInternalMousePosition(scaledX, scaledY);

_cursorState.x = scaledX;
_cursorState.y = scaledY;
}

void OpenGLGraphicsManager::setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, int cursorTargetScale, const Graphics::PixelFormat *format) {
Expand Down
19 changes: 14 additions & 5 deletions backends/graphics/opengl/opengl-graphics.h
Expand Up @@ -217,6 +217,7 @@ class OpenGLGraphicsManager : public GraphicsManager {

uint getAspectRatio() const;

void setFormatIsBGR(bool isBGR) { _formatBGR = isBGR; }
bool _formatBGR;

//
Expand Down Expand Up @@ -285,6 +286,14 @@ class OpenGLGraphicsManager : public GraphicsManager {
int _cursorTargetScale;
bool _cursorNeedsRedraw;

/**
* Set up the mouse position for graphics output.
*
* @param x X coordinate in native coordinates.
* @param y Y coordinate in native coordinates.
*/
void setMousePosition(int x, int y) { _cursorState.x = x; _cursorState.y = y; }

virtual void refreshCursor();
virtual void refreshCursorScale();

Expand All @@ -311,11 +320,6 @@ class OpenGLGraphicsManager : public GraphicsManager {
virtual bool saveScreenshot(const char *filename);

#ifdef USE_OSD
/**
* The OSD contents.
*/
Common::Array<Common::String> _osdLines;

/**
* Returns the font used for on screen display
*/
Expand All @@ -326,6 +330,11 @@ class OpenGLGraphicsManager : public GraphicsManager {
*/
void updateOSD();

/**
* The OSD contents.
*/
Common::Array<Common::String> _osdLines;

GLTexture *_osdTexture;
Graphics::Surface _osdSurface;
uint8 _osdAlpha;
Expand Down
5 changes: 2 additions & 3 deletions backends/graphics/openglsdl/openglsdl-graphics.cpp
Expand Up @@ -376,7 +376,7 @@ bool OpenGLSdlGraphicsManager::loadGFXMode() {
}

// Check if the screen is BGR format
_formatBGR = _hwscreen->format->Rshift != 0;
setFormatIsBGR(_hwscreen->format->Rshift != 0);

if (isFullscreen) {
_lastFullscreenModeWidth = _videoMode.hardwareWidth;
Expand Down Expand Up @@ -671,8 +671,7 @@ void OpenGLSdlGraphicsManager::transformMouseCoordinates(Common::Point &point) {
}

void OpenGLSdlGraphicsManager::notifyMousePos(Common::Point mouse) {
_cursorState.x = mouse.x;
_cursorState.y = mouse.y;
setMousePosition(mouse.x, mouse.y);
}

#endif

0 comments on commit 5b3ebdf

Please sign in to comment.