[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [marble] src/lib/marble: Properly handle negative elevations
From:       Torsten Rahn <torsten.rahn () lge ! com>
Date:       2015-04-30 19:42:19
Message-ID: E1YnuLj-00055M-3m () scm ! kde ! org
[Download RAW message or body]

Git commit 8bbed075fa66e9167a75bec2b9b0b014261c948e by Torsten Rahn, on behalf of \
Oliver Haag. Committed on 30/04/2015 at 19:41.
Pushed by rahn into branch 'master'.

Properly handle negative elevations

REVIEW: 123422

M  +3    -4    src/lib/marble/ElevationModel.cpp

http://commits.kde.org/marble/8bbed075fa66e9167a75bec2b9b0b014261c948e

diff --git a/src/lib/marble/ElevationModel.cpp b/src/lib/marble/ElevationModel.cpp
index b642078..b5fcb48 100644
--- a/src/lib/marble/ElevationModel.cpp
+++ b/src/lib/marble/ElevationModel.cpp
@@ -132,13 +132,12 @@ qreal ElevationModel::height( qreal lon, qreal lat ) const
 
         Q_ASSERT( 0 <= dx && dx <= 1 );
         Q_ASSERT( 0 <= dy && dy <= 1 );
-        unsigned int pixel;
-        pixel = image->pixel( x % width, y % height );
-        pixel -= 0xFF000000; //fully opaque
+        unsigned int pixel = image->pixel( x % width, y % height ) & 0xffff; // 16 \
valid bits +        short int elevation = (short int) pixel; // and signed type, so \
just cast it  //mDebug() << "(1-dx)" << (1-dx) << "(1-dy)" << (1-dy);
         if ( pixel != invalidElevationData ) { //no data?
             //mDebug() << "got at x" << x % width << "y" << y % height << "a height \
                of" << pixel << "** RGB" << qRed(pixel) << qGreen(pixel) << \
                qBlue(pixel);
-            ret += ( qreal )pixel * ( 1 - dx ) * ( 1 - dy );
+            ret += ( qreal )elevation * ( 1 - dx ) * ( 1 - dy );
             hasHeight = true;
         } else {
             //mDebug() << "no data at" <<  x % width << "y" << y % height;


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic