Fix some C++11 narrowing conversation warnings

Thanks to Jurica Vukadin for providing the patch.

REVIEW: 106994
This commit is contained in:
Martin Gräßlin 2012-11-26 10:27:02 +01:00
parent a6f963ec4a
commit 876b427dfb
4 changed files with 17 additions and 11 deletions

View file

@ -275,11 +275,13 @@ void CoverSwitchEffect::paintScreen(int mask, QRegion region, ScreenPaintData& d
// we can use a huge scale factor (needed to calculate the rearground vertices)
// as we restrict with a PaintClipper painting on the current screen
float reflectionScaleFactor = 100000 * tan(60.0 * M_PI / 360.0f) / area.width();
const float width = area.width();
const float height = area.height();
float vertices[] = {
-area.width() * 0.5f, area.height(), 0.0,
area.width() * 0.5f, area.height(), 0.0,
(float)area.width()*reflectionScaleFactor, area.height(), -5000,
-(float)area.width()*reflectionScaleFactor, area.height(), -5000
-width * 0.5f, height, 0.0,
width * 0.5f, height, 0.0,
width*reflectionScaleFactor, height, -5000,
-width*reflectionScaleFactor, height, -5000
};
// foreground
if (start) {

View file

@ -470,11 +470,13 @@ void CubeEffect::paintScreen(int mask, QRegion region, ScreenPaintData& data)
#endif
popMatrix();
const float width = rect.width();
const float height = rect.height();
float vertices[] = {
-rect.width() * 0.5f, rect.height(), 0.0,
rect.width() * 0.5f, rect.height(), 0.0,
(float)rect.width()*scaleFactor, rect.height(), -5000,
-(float)rect.width()*scaleFactor, rect.height(), -5000
-width * 0.5f, height, 0.0,
width * 0.5f, height, 0.0,
width * scaleFactor, height, -5000,
-width * scaleFactor, height, -5000
};
// foreground
float alpha = 0.7;
@ -806,7 +808,8 @@ void CubeEffect::paintCap(bool frontFirst, float zOffset)
// modulate the cap texture: cap color should be background for translucent pixels
// cube opacity should be used for all pixels
// blend with cap color
float color[4] = { capColor.redF(), capColor.greenF(), capColor.blueF(), cubeOpacity };
float color[4] = { static_cast<float>(capColor.redF()), static_cast<float>(capColor.greenF()),
static_cast<float>(capColor.blueF()), cubeOpacity };
glActiveTexture(GL_TEXTURE0);
capTexture->bind();
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL);

View file

@ -201,7 +201,8 @@ void StartupFeedbackEffect::paintScreen(int mask, QRegion region, ScreenPaintDat
} else {
#ifdef KWIN_HAVE_OPENGL_1
// texture transformation
float color[4] = { blinkingColor.redF(), blinkingColor.greenF(), blinkingColor.blueF(), 1.0f };
float color[4] = { static_cast<float>(blinkingColor.redF()), static_cast<float>(blinkingColor.greenF()),
static_cast<float>(blinkingColor.blueF()), 1.0f };
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL);
glColor4fv(color);
glActiveTexture(GL_TEXTURE1);

View file

@ -417,7 +417,7 @@ void WobblyWindowsEffect::startMovedResized(EffectWindow* w)
qreal x_increment = rect.width() / (wwi.width - 1.0);
qreal y_increment = rect.height() / (wwi.height - 1.0);
Pair picked = {cursorPos().x(), cursorPos().y()};
Pair picked = {static_cast<qreal>(cursorPos().x()), static_cast<qreal>(cursorPos().y())};
int indx = (picked.x - rect.x()) / x_increment + 0.5;
int indy = (picked.y - rect.y()) / y_increment + 0.5;
int pickedPointIndex = indy * wwi.width + indx;