CT: *hideous* fix for that ugly repaint problem with transparent konsoles, but

at least the konsole looks beautiful now
	(you know, Beauty and the Beast :-)
    Plus a 20X speedup factor on gradient backgrounds.

svn path=/trunk/kdebase/konsole/; revision=27187
wilder-portage
Cristian Tibirna 27 years ago
parent ccf2dbaabf
commit 8a8f628d3f
  1. 2
      include/TEWidget.h
  2. 15
      src/TEWidget.C
  3. 12
      src/rootBg.C

@ -74,7 +74,7 @@ protected:
bool eventFilter( QObject *, QEvent * ); bool eventFilter( QObject *, QEvent * );
void drawAttrStr(QPainter &paint, QRect rect, void drawAttrStr(QPainter &paint, QRect rect,
char* str, int len, ca attr, BOOL pm); char* str, int len, ca attr, BOOL pm, BOOL clear);
void paintEvent( QPaintEvent * ); void paintEvent( QPaintEvent * );
void resizeEvent(QResizeEvent*); void resizeEvent(QResizeEvent*);

@ -189,12 +189,12 @@ TEWidget::TEWidget(QWidget *parent, const char *name) : QFrame(parent,name)
*/ */
void TEWidget::drawAttrStr(QPainter &paint, QRect rect, void TEWidget::drawAttrStr(QPainter &paint, QRect rect,
char* str, int len, ca attr, BOOL pm) char* str, int len, ca attr, BOOL pm, BOOL clear)
{ {
if (pm && color_table[attr.b].transparent) if (pm && color_table[attr.b].transparent)
{ {
paint.setBackgroundMode( TransparentMode ); paint.setBackgroundMode( TransparentMode );
erase(rect); if (clear) erase(rect);
} }
else else
{ {
@ -278,7 +278,7 @@ HCNT("setImage");
} }
drawAttrStr(paint, drawAttrStr(paint,
QRect(blX+tLx+font_w*x,bY+tLy+font_h*y,font_w*len,font_h), QRect(blX+tLx+font_w*x,bY+tLy+font_h*y,font_w*len,font_h),
disstr, len, ext[x], pm != NULL); disstr, len, ext[x], pm != NULL, true);
x += len - 1; x += len - 1;
} }
} }
@ -331,11 +331,12 @@ HCNT("paintEvent");
int rlx = QMIN(columns-1, QMAX(0,(rect.right() - tLx - blX ) / font_w)); int rlx = QMIN(columns-1, QMAX(0,(rect.right() - tLx - blX ) / font_w));
int rly = QMIN(lines-1, QMAX(0,(rect.bottom() - tLy - bY ) / font_h)); int rly = QMIN(lines-1, QMAX(0,(rect.bottom() - tLy - bY ) / font_h));
/* /*
printf("paintEvent: %d..%d, %d..%d (%d..%d, %d..%d)\n",lux,rlx,luy,rly, printf("paintEvent: %d..%d, %d..%d (%d..%d, %d..%d)\n",lux,rlx,luy,rly,
rect.left(), rect.right(), rect.top(), rect.bottom()); rect.left(), rect.right(), rect.top(), rect.bottom());
*/ */
if (pm != NULL && color_table[image->b].transparent)
erase(rect);
for (int y = luy; y <= rly; y++) for (int y = luy; y <= rly; y++)
for (int x = lux; x <= rlx; x++) for (int x = lux; x <= rlx; x++)
{ char *disstr = new char[columns]; int len = 1; { char *disstr = new char[columns]; int len = 1;
@ -352,7 +353,7 @@ HCNT("paintEvent");
} }
drawAttrStr(paint, drawAttrStr(paint,
QRect(blX+tLx+font_w*x,bY+tLy+font_h*y,font_w*len,font_h), QRect(blX+tLx+font_w*x,bY+tLy+font_h*y,font_w*len,font_h),
disstr, len, image[loc(x,y)], pm != NULL); disstr, len, image[loc(x,y)], pm != NULL, false);
x += len - 1; x += len - 1;
delete disstr; delete disstr;
} }

@ -248,13 +248,13 @@ void RootPixmap::generateBackground(bool shade, double r, double g, double b)
if ( orMode == Portrait ) { if ( orMode == Portrait ) {
pmDesktop.resize( 20, QApplication::desktop()->height() ); pmDesktop.resize( 20, QApplication::desktop()->height() );
KPixmapEffect::gradient(pmDesktop, color2, color1, KPixmapEffect::gradient(pmDesktop, color1, color2,
KPixmapEffect::VerticalGradient, numColors ); KPixmapEffect::VerticalGradient, numColors );
} else { } else {
pmDesktop.resize( QApplication::desktop()->width(), 20 ); pmDesktop.resize( QApplication::desktop()->width(), 20 );
KPixmapEffect::gradient(pmDesktop, color2, color1, KPixmapEffect::gradient(pmDesktop, color1, color2,
KPixmapEffect::HorizontalGradient, KPixmapEffect::HorizontalGradient,
numColors); numColors);
@ -265,13 +265,13 @@ void RootPixmap::generateBackground(bool shade, double r, double g, double b)
bgPixmap = new QPixmap(w,h); bgPixmap = new QPixmap(w,h);
if ( orMode == Portrait ) { if ( orMode == Portrait ) {
for (uint pw = 0; pw <= w; pw += pmDesktop.width()) for (uint pw = 0; pw <= w/20; pw += pmDesktop.width())
bitBlt( bgPixmap, pw, 0, &pmDesktop, 0, 0, bitBlt( bgPixmap, pw*20, 0, &pmDesktop, 0, 0,
pmDesktop.width(), h); pmDesktop.width(), h);
} else { } else {
for (uint ph = 0; ph <= h; ph += pmDesktop.height()) { for (uint ph = 0; ph <= h/20; ph += pmDesktop.height()) {
debug("land %d",ph); debug("land %d",ph);
bitBlt( bgPixmap, 0, ph, &pmDesktop, 0, 0, bitBlt( bgPixmap, 0, ph*20, &pmDesktop, 0, 0,
w, pmDesktop.height()); w, pmDesktop.height());
} }
} }

Loading…
Cancel
Save