[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: koffice/krita/ui
From: Gábor Lehel <illissius () gmail ! com>
Date: 2006-01-11 19:04:49
Message-ID: 1137006289.766944.16869.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 497026 by illissius:
fix the layer thumbnails drawing garbage for transparent areas. this took longer than \
you would think from the diff size.
M +1 -0 kis_layerlist.cc
M +9 -14 layerlist.cpp
--- trunk/koffice/krita/ui/kis_layerlist.cc #497025:497026
@@ -167,6 +167,7 @@
bool KisLayerItem::updatePreview()
{
m_preview = m_layer->createThumbnail( 200, 200 );
+ m_preview.setAlphaBuffer( true );
previewChanged();
return !m_preview.isNull();
}
--- trunk/koffice/krita/ui/layerlist.cpp #497025:497026
@@ -95,6 +95,7 @@
QPixmap *previewPixmap;
bool previewChanged;
QPixmap scaledPreview;
+ QSize previewSize;
Private( int pid ): isFolder( false ), id( pid ), previewImage( 0 ), \
previewPixmap( 0 ), previewChanged( false ) { }
@@ -1150,27 +1151,21 @@
if( !showPreview() )
return;
- if( d->previewChanged || r.size() != d->scaledPreview.size() )
+ static QPoint offset;
+
+ if( d->previewChanged || r.size() != d->previewSize )
{
- d->scaledPreview = QPixmap( r.size() );
- QBitmap b( r.size() );
- b.fill( Qt::color0 );
- QPainter bp( &b );
- bp.setBrush( Qt::color1 );
- QPainter p( &(d->scaledPreview) );
QImage i = ( d->previewImage ? d->previewImage->smoothScale( r.size(), \
QImage::ScaleMin )
: d->previewPixmap->convertToImage().smoothScale( r.size(), \
QImage::ScaleMin ) );
- p.drawImage( r.width() / 2 - i.width() / 2, r.height() / 2 - i.height() / 2, \
i );
- bp.drawRect( r.width() / 2 - i.width() / 2, r.height() / 2 - i.height() / 2, \
i.width(), i.height() );
- bp.end();
- p.end();
- d->scaledPreview.setMask( b );
- //argh! there has to be a simpler way to do this!
+ d->scaledPreview.convertFromImage( i );
+ offset.setX( r.width()/2 - i.width()/2 );
+ offset.setY( r.height()/2 - i.height()/2 );
d->previewChanged = false;
+ d->previewSize = r.size();
}
- p->drawPixmap( r.topLeft(), d->scaledPreview );
+ p->drawPixmap( r.topLeft() + offset, d->scaledPreview );
}
bool LayerItem::showPreview() const
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic