[Scummvm-cvs-logs] scummvm master -> ac5907a8046cd7ab66e43ac7e7e2d39863984917
lordhoto
lordhoto at gmail.com
Wed Feb 12 17:17:39 CET 2014
This automated email contains information about 5 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
ddc70ed9ee OPENGL: Properly use signed types for cursor hotspot.
49dcd36e72 OPENGL: Use signed types for mouse coordinates.
1709486859 OPENGL: Use GLfloat for draw cooridnates in Texture.
6576dd758b OPENGL: Simplify shake offset application.
ac5907a804 OPENGL: Use frac_t for cursor scaling.
Commit: ddc70ed9ee635ee71e08b7b3bce0211198f01be5
https://github.com/scummvm/scummvm/commit/ddc70ed9ee635ee71e08b7b3bce0211198f01be5
Author: Johannes Schickel (lordhoto at scummvm.org)
Date: 2014-02-12T08:15:07-08:00
Commit Message:
OPENGL: Properly use signed types for cursor hotspot.
Changed paths:
backends/graphics/opengl/opengl-graphics.h
diff --git a/backends/graphics/opengl/opengl-graphics.h b/backends/graphics/opengl/opengl-graphics.h
index 6b13db8..46fd687 100644
--- a/backends/graphics/opengl/opengl-graphics.h
+++ b/backends/graphics/opengl/opengl-graphics.h
@@ -396,12 +396,12 @@ private:
/**
* The X offset for the cursor hotspot in unscaled coordinates.
*/
- uint _cursorHotspotX;
+ int _cursorHotspotX;
/**
* The Y offset for the cursor hotspot in unscaled coordinates.
*/
- uint _cursorHotspotY;
+ int _cursorHotspotY;
/**
* Recalculate the cursor scaling. Scaling is always done according to
@@ -412,12 +412,12 @@ private:
/**
* The X offset for the cursor hotspot in scaled coordinates.
*/
- uint _cursorHotspotXScaled;
+ int _cursorHotspotXScaled;
/**
* The Y offset for the cursor hotspot in scaled coordinates.
*/
- uint _cursorHotspotYScaled;
+ int _cursorHotspotYScaled;
/**
* The width of the cursor scaled coordinates.
Commit: 49dcd36e72889b3edb67ce098af7cb854e499cb8
https://github.com/scummvm/scummvm/commit/49dcd36e72889b3edb67ce098af7cb854e499cb8
Author: Johannes Schickel (lordhoto at scummvm.org)
Date: 2014-02-12T08:15:07-08:00
Commit Message:
OPENGL: Use signed types for mouse coordinates.
This adjusts for the fact that our event handling also uses signed coordinates.
Changed paths:
backends/graphics/opengl/opengl-graphics.h
diff --git a/backends/graphics/opengl/opengl-graphics.h b/backends/graphics/opengl/opengl-graphics.h
index 46fd687..d16f92d 100644
--- a/backends/graphics/opengl/opengl-graphics.h
+++ b/backends/graphics/opengl/opengl-graphics.h
@@ -386,12 +386,12 @@ private:
/**
* X coordinate of the cursor in phyiscal coordinates.
*/
- uint _cursorX;
+ int _cursorX;
/**
* Y coordinate of the cursor in physical coordinates.
*/
- uint _cursorY;
+ int _cursorY;
/**
* The X offset for the cursor hotspot in unscaled coordinates.
Commit: 1709486859db9c38f5e4287e3e7fa817f76c1ee7
https://github.com/scummvm/scummvm/commit/1709486859db9c38f5e4287e3e7fa817f76c1ee7
Author: Johannes Schickel (lordhoto at scummvm.org)
Date: 2014-02-12T08:15:07-08:00
Commit Message:
OPENGL: Use GLfloat for draw cooridnates in Texture.
Changed paths:
backends/graphics/opengl/texture.cpp
backends/graphics/opengl/texture.h
diff --git a/backends/graphics/opengl/texture.cpp b/backends/graphics/opengl/texture.cpp
index dff483d..7b0b22d 100644
--- a/backends/graphics/opengl/texture.cpp
+++ b/backends/graphics/opengl/texture.cpp
@@ -166,7 +166,7 @@ void Texture::fill(uint32 color) {
flagDirty();
}
-void Texture::draw(GLuint x, GLuint y, GLuint w, GLuint h) {
+void Texture::draw(GLfloat x, GLfloat y, GLfloat w, GLfloat h) {
// Only do any processing when the Texture is initialized.
if (!_textureData.getPixels()) {
return;
@@ -190,13 +190,13 @@ void Texture::draw(GLuint x, GLuint y, GLuint w, GLuint h) {
GLCALL(glTexCoordPointer(2, GL_FLOAT, 0, texcoords));
// Calculate the screen rect where the texture will be drawn.
- const GLshort vertices[4*2] = {
- (GLshort)x, (GLshort)y,
- (GLshort)(x + w), (GLshort)y,
- (GLshort)x, (GLshort)(y + h),
- (GLshort)(x + w), (GLshort)(y + h)
+ const GLfloat vertices[4*2] = {
+ x, y,
+ x + w, y,
+ x, y + h,
+ x + w, y + h
};
- GLCALL(glVertexPointer(2, GL_SHORT, 0, vertices));
+ GLCALL(glVertexPointer(2, GL_FLOAT, 0, vertices));
// Draw the texture to the screen buffer.
GLCALL(glDrawArrays(GL_TRIANGLE_STRIP, 0, 4));
diff --git a/backends/graphics/opengl/texture.h b/backends/graphics/opengl/texture.h
index e28d980..ad70833 100644
--- a/backends/graphics/opengl/texture.h
+++ b/backends/graphics/opengl/texture.h
@@ -79,7 +79,7 @@ public:
void fill(uint32 color);
- void draw(GLuint x, GLuint y, GLuint w, GLuint h);
+ void draw(GLfloat x, GLfloat y, GLfloat w, GLfloat h);
void flagDirty() { _allDirty = true; }
bool isDirty() const { return _allDirty || !_dirtyArea.isEmpty(); }
Commit: 6576dd758bfaf078abfb430d4b9c99b7047e4308
https://github.com/scummvm/scummvm/commit/6576dd758bfaf078abfb430d4b9c99b7047e4308
Author: Johannes Schickel (lordhoto at scummvm.org)
Date: 2014-02-12T08:15:07-08:00
Commit Message:
OPENGL: Simplify shake offset application.
Changed paths:
backends/graphics/opengl/opengl-graphics.cpp
diff --git a/backends/graphics/opengl/opengl-graphics.cpp b/backends/graphics/opengl/opengl-graphics.cpp
index 925b2c5..a0651f2 100644
--- a/backends/graphics/opengl/opengl-graphics.cpp
+++ b/backends/graphics/opengl/opengl-graphics.cpp
@@ -353,15 +353,7 @@ void OpenGLGraphicsManager::updateScreen() {
const GLfloat shakeOffset = _gameScreenShakeOffset * (GLfloat)_displayHeight / _gameScreen->getHeight();
// First step: Draw the (virtual) game screen.
- glPushMatrix();
-
- // Adjust game screen shake position
- GLCALL(glTranslatef(0, shakeOffset, 0));
-
- // Draw the game screen
- _gameScreen->draw(_displayX, _displayY, _displayWidth, _displayHeight);
-
- glPopMatrix();
+ _gameScreen->draw(_displayX, _displayY + shakeOffset, _displayWidth, _displayHeight);
// Second step: Draw the overlay if visible.
if (_overlayVisible) {
@@ -370,18 +362,12 @@ void OpenGLGraphicsManager::updateScreen() {
// Third step: Draw the cursor if visible.
if (_cursorVisible && _cursor) {
- glPushMatrix();
-
// Adjust game screen shake position, but only when the overlay is not
// visible.
- if (!_overlayVisible) {
- GLCALL(glTranslatef(0, shakeOffset, 0));
- }
+ const GLfloat cursorOffset = _overlayVisible ? 0 : shakeOffset;
- _cursor->draw(_cursorX - _cursorHotspotXScaled, _cursorY - _cursorHotspotYScaled,
+ _cursor->draw(_cursorX - _cursorHotspotXScaled, _cursorY - _cursorHotspotYScaled + cursorOffset,
_cursorWidthScaled, _cursorHeightScaled);
-
- glPopMatrix();
}
#ifdef USE_OSD
Commit: ac5907a8046cd7ab66e43ac7e7e2d39863984917
https://github.com/scummvm/scummvm/commit/ac5907a8046cd7ab66e43ac7e7e2d39863984917
Author: Johannes Schickel (lordhoto at scummvm.org)
Date: 2014-02-12T08:15:07-08:00
Commit Message:
OPENGL: Use frac_t for cursor scaling.
Changed paths:
backends/graphics/opengl/opengl-graphics.cpp
diff --git a/backends/graphics/opengl/opengl-graphics.cpp b/backends/graphics/opengl/opengl-graphics.cpp
index a0651f2..dfba14a 100644
--- a/backends/graphics/opengl/opengl-graphics.cpp
+++ b/backends/graphics/opengl/opengl-graphics.cpp
@@ -1072,14 +1072,14 @@ void OpenGLGraphicsManager::recalculateCursorScaling() {
// In case scaling is actually enabled we will scale the cursor according
// to the game screen.
if (!_cursorDontScale) {
- const uint screenScaleFactorX = _displayWidth * 10000 / _gameScreen->getWidth();
- const uint screenScaleFactorY = _displayHeight * 10000 / _gameScreen->getHeight();
+ const frac_t screenScaleFactorX = intToFrac(_displayWidth) / _gameScreen->getWidth();
+ const frac_t screenScaleFactorY = intToFrac(_displayHeight) / _gameScreen->getHeight();
- _cursorHotspotXScaled = (_cursorHotspotXScaled * screenScaleFactorX) / 10000;
- _cursorWidthScaled = (_cursorWidthScaled * screenScaleFactorX) / 10000;
+ _cursorHotspotXScaled = fracToInt(_cursorHotspotXScaled * screenScaleFactorX);
+ _cursorWidthScaled = fracToInt(_cursorWidthScaled * screenScaleFactorX);
- _cursorHotspotYScaled = (_cursorHotspotYScaled * screenScaleFactorY) / 10000;
- _cursorHeightScaled = (_cursorHeightScaled * screenScaleFactorY) / 10000;
+ _cursorHotspotYScaled = fracToInt(_cursorHotspotYScaled * screenScaleFactorY);
+ _cursorHeightScaled = fracToInt(_cursorHeightScaled * screenScaleFactorY);
}
}
More information about the Scummvm-git-logs
mailing list