[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [marble/KDE/4.10] src/lib: Add Range guard to work around
From: Torsten Rahn <rahn () kde ! org>
Date: 2013-01-16 23:26:25
Message-ID: 20130116232625.A65C9A6091 () git ! kde ! org
[Download RAW message or body]
Git commit 73e503f75fb41fe28a89a9564207e1270cae8494 by Torsten Rahn.
Committed on 17/01/2013 at 00:24.
Pushed by rahn into branch 'KDE/4.10'.
Add Range guard to work around
https://bugs.kde.org/show_bug.cgi?id=311624
M +29 -1 src/lib/StackedTile.cpp
http://commits.kde.org/marble/73e503f75fb41fe28a89a9564207e1270cae8494
diff --git a/src/lib/StackedTile.cpp b/src/lib/StackedTile.cpp
index a230b62..78fef33 100644
--- a/src/lib/StackedTile.cpp
+++ b/src/lib/StackedTile.cpp
@@ -79,6 +79,20 @@ StackedTilePrivate::~StackedTilePrivate()
uint StackedTilePrivate::pixel( int x, int y ) const
{
+ // Range guard
+ if(x < 0) {
+ x=0;
+ }
+ else if(x > m_resultTile.width()) {
+ x=m_resultTile.width();
+ }
+ if(y < 0) {
+ y=0;
+ }
+ else if(y>m_resultTile.height()) {
+ y=m_resultTile.height();
+ }
+
if ( m_depth == 8 ) {
if ( m_isGrayscale )
return (jumpTable8)[y][x];
@@ -96,7 +110,21 @@ uint StackedTilePrivate::pixel( int x, int y ) const
uint StackedTilePrivate::pixelF( qreal x, qreal y, const QRgb& topLeftValue ) const
{
- // Bilinear interpolation to determine the color of a subpixel
+ // Range guard
+ if(x < 0) {
+ x=0;
+ }
+ else if(x > m_resultTile.width()) {
+ x=m_resultTile.width();
+ }
+ if(y < 0) {
+ y=0;
+ }
+ else if(y>m_resultTile.height()) {
+ y=m_resultTile.height();
+ }
+
+ // Bilinear interpolation to determine the color of a subpixel
int iX = (int)(x);
int iY = (int)(y);
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic