[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdebase/workspace/ksplash/ksplashx
From: Luboš Luňák <l.lunak () kde ! org>
Date: 2010-06-22 12:53:00
Message-ID: 20100622125300.B7B87AC8DC () svn ! kde ! org
[Download RAW message or body]
SVN commit 1141291 by lunakl:
Choose the right selection algorithm from plasma that is used for the default.
This stuff should be synced between ksplashx, kdm and plasma anyway :-/.
M +0 -6 defs.h
M +9 -2 splash.cpp
--- trunk/KDE/kdebase/workspace/ksplash/ksplashx/defs.h #1141290:1141291
@@ -163,10 +163,4 @@
void strip_whitespace( char* line );
bool begins_with( const char* line, const char* str );
-inline
-int round( double num )
- {
- return num >= 0 ? int( num + 0.5 ) : int( num - 0.5 );
- }
-
#endif
--- trunk/KDE/kdebase/workspace/ksplash/ksplashx/splash.cpp #1141290:1141291
@@ -45,6 +45,7 @@
#include <assert.h>
#include <dirent.h>
#include <libgen.h>
+#include <math.h>
#include <X11/Xutil.h>
@@ -155,8 +156,14 @@
float delta = w * h - geom.width() * geom.height();
// scale down to about 1.0
delta /= ((geom.width() * geom.height())+(w * h))/2;
- // Difference of areas, slight preference to scale down
- float distance = delta >= 0.0 ? delta : -delta + 2.0;
+ // Consider first the difference in aspect ratio,
+ // then in areas. Prefer scaling down.
+ float deltaRatio = 1.0;
+ if (h > 0 && geom.height() > 0) {
+ deltaRatio = float(w) / float(h) -
+ float(geom.width()) / float(geom.height());
+ }
+ float distance = fabs(deltaRatio) * 3.0 + (delta >= 0.0 ? delta : \
-delta + 5.0); if( distance < best_distance
// only derive from themes with the same ratio if lame \
resolutions are not allowed, damn 1280x1024 && ( lame || w * geom.height() == h * \
geom.width())
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic