=== modified file 'ksplash/ksplashx/pixmap.h' Index: kdebase-workspace-4.5.80/ksplash/ksplashx/pixmap.h =================================================================== --- kdebase-workspace-4.5.80.orig/ksplash/ksplashx/pixmap.h 2010-06-24 16:28:16.000000000 +0000 +++ kdebase-workspace-4.5.80/ksplash/ksplashx/pixmap.h 2010-11-24 11:51:10.100641004 +0000 @@ -48,7 +48,7 @@ #include "x11_defs.h" -class QImage; +#include "qimage.h" enum Optimization { DefaultOptim, NoOptim, MemoryOptim=NoOptim, NormalOptim, BestOptim }; @@ -62,6 +62,7 @@ int d; Optimization optim; XImage* ximage; + QImage orig; }; class PP : public Qt // inherit from Qt to reduce needed code changes in the function Index: kdebase-workspace-4.5.80/ksplash/ksplashx/splash.cpp =================================================================== --- kdebase-workspace-4.5.80.orig/ksplash/ksplashx/splash.cpp 2010-11-05 10:47:22.000000000 +0000 +++ kdebase-workspace-4.5.80/ksplash/ksplashx/splash.cpp 2010-11-24 11:51:10.100641004 +0000 @@ -488,7 +488,7 @@ return img; } -static PixmapData* imageAnimToPixmaps( const QImage& img, int frames ) +static PixmapData* imageAnimToPixmaps( const QImage& img, const QImage& orig, int frames ) { if( img.isNull()) return NULL; @@ -508,6 +508,9 @@ ret[ frame ].w = framew; ret[ frame ].h = frameh; ret[ frame ].d = x11Depth(); + ret[ frame ].orig = orig.copy( + ( frame % ANIM_IMAGES_ROW ) * framew, ( frame / ANIM_IMAGES_ROW ) * frameh, framew, frameh); + } if( pix.hd != None ) XFreePixmap( qt_xdisplay(), pix.hd ); @@ -538,10 +541,40 @@ if( anim != NULL && area.intersects( QRect( anim->x, anim->y, frame->w, frame->h ))) { - XCopyArea( qt_xdisplay(), frame->hd, pixmap, gc, - qMax( 0, area.x() - anim->x ), qMax( 0, area.y() - anim->y ), - area.x() - anim->x + area.width(), area.y() - anim->y + area.height(), - qMax( 0, anim->x - area.x()), qMax( 0, anim->y - area.y())); + QRect rect = area.intersect(QRect( anim->x, anim->y, frame->w, frame->h)); + + const int w = rect.width(); + const int h = rect.height(); + + const int h_off = frame->w - w; + const int v_off = rect.top() - anim->y; + + rect.moveBy(-area.x(), -area.y()); + XImage* img = XGetImage(qt_xdisplay(), pixmap, rect.x(), rect.y(), w, h, AllPlanes, ZPixmap); + + QRgb* bg = (QRgb*)(img->data); + QRgb* fg = (QRgb*)frame->orig.bits(); + fg += v_off * frame->w; + for (int y=0 ; yx < area.x()) + { + fg += h_off; + } + + for (int x=0; xx > area.x()) + { + fg += h_off; + } + } + + XPutImage(qt_xdisplay(), pixmap, gc, img, 0, 0, rect.left(), rect.top(), w, h); + XDestroyImage(img); } } XCopyArea( qt_xdisplay(), pixmap, window, gc, 0, 0, area.width(), area.height(), area.x(), area.y()); @@ -591,7 +624,7 @@ fprintf( stderr, "No window contents\n" ); exit( 3 ); } - time_t test_time = time( NULL ) + 2; + time_t test_time = time( NULL ) + 1; #ifdef DEBUG fprintf( stderr,"AWATING STATE: %d (%s)\n", expected_state, states[ expected_state ] ); #endif @@ -671,7 +704,7 @@ if( test && time( NULL ) >= test_time ) { ++state; - test_time = time( NULL ) + 2; + test_time = time( NULL ) + 1; } if( expected_state <= state ) return false; @@ -770,15 +803,6 @@ return makeAbsolute( screen_ref[ 1 ], y_rel, image_ref[ 1 ], height, geometry.height()) + geometry.y(); } -static inline QRgb blend( QRgb c, QRgb background ) - { - if( qAlpha( c ) == 255 ) - return c; - return qRgb( ( qRed( background ) * ( 255 - qAlpha( c ) ) + qRed( c ) * qAlpha( c ) ) / 255, - ( qGreen( background ) * ( 255 - qAlpha( c ) ) + qGreen( c ) * qAlpha( c ) ) / 255, - ( qBlue( background ) * ( 255 - qAlpha( c ) ) + qBlue( c ) * qAlpha( c ) ) / 255 ); - } - static void blend( QImage& img, int x_pos, int y_pos, int x_img, int y_img, int w_img, int h_img ) { if( !img.hasAlphaBuffer()) @@ -1168,10 +1192,11 @@ if( splash_image.isNull()) createSplashImage(); QImage imgs = loadAnimImage( buf, frames ); + QImage origs = imgs.copy(); if( !imgs.isNull()) { blendAnim( imgs, x, y, frames ); - PixmapData* pixs = imageAnimToPixmaps( imgs, frames ); + PixmapData* pixs = imageAnimToPixmaps( imgs, origs, frames ); delete animations[ number ]; animations[ number ] = new AnimData( x, y, pixs, frames, delay, repeat ); } @@ -1207,6 +1232,7 @@ if( splash_image.isNull()) createSplashImage(); QImage imgs = loadAnimImage( buf, frames ); + QImage origs = imgs.copy(); if( !imgs.isNull()) { int framew, frameh; @@ -1214,7 +1240,7 @@ x = makeAbsoluteX( window_ref, x_rel, image_ref, framew ); y = makeAbsoluteY( window_ref, y_rel, image_ref, frameh ); blendAnim( imgs, x, y, frames ); - PixmapData* pixs = imageAnimToPixmaps( imgs, frames ); + PixmapData* pixs = imageAnimToPixmaps( imgs, origs, frames ); delete animations[ number ]; animations[ number ] = new AnimData( x, y, pixs, frames, delay, repeat ); } Index: kdebase-workspace-4.5.80/ksplash/ksplashx/splash.h =================================================================== --- kdebase-workspace-4.5.80.orig/ksplash/ksplashx/splash.h 2008-01-04 23:55:38.000000000 +0000 +++ kdebase-workspace-4.5.80/ksplash/ksplashx/splash.h 2010-11-24 11:51:10.100641004 +0000 @@ -22,6 +22,16 @@ #define _SPLASH_H #include +#include "qcolor.h" + +static inline QRgb blend(const QRgb& c, const QRgb& background ) +{ + if( qAlpha( c ) == 255 ) + return c; + return qRgb( ( qRed( background ) * ( 255 - qAlpha( c ) ) + qRed( c ) * qAlpha( c ) ) / 255, + ( qGreen( background ) * ( 255 - qAlpha( c ) ) + qGreen( c ) * qAlpha( c ) ) / 255, + ( qBlue( background ) * ( 255 - qAlpha( c ) ) + qBlue( c ) * qAlpha( c ) ) / 255 ); +} void runSplash( const char* theme, bool test, int pipe );