Commit 1fe4c0c0 authored by Cyrille Berger's avatar Cyrille Berger

should fix the speed issue when darkening in the tablet option

CCMAIL:kimageshop@kde.org

svn path=/trunk/koffice/; revision=787329
parent 42bfb4e3
......@@ -31,6 +31,8 @@
#include <QPointer>
#include <QStyleOptionViewItem>
#include <kdebug.h>
class KoDocumentSectionDelegate::Private
{
public:
......@@ -420,6 +422,7 @@ void KoDocumentSectionDelegate::drawIcons( QPainter *p, const QStyleOptionViewIt
for( int i = 0, n = lp.count(); i < n; ++i )
if( lp[i].isMutable )
{
kDebug() << "lp[" << i << "].state = " << lp[i].state;
QIcon icon = lp[i].state.toBool() ? lp[i].onIcon : lp[i].offIcon;
p->drawPixmap( x, 0, icon.pixmap( option.decorationSize ) );
x += option.decorationSize.width() + d->margin;
......
......@@ -42,7 +42,7 @@ class KoColorConversionCache {
* @param src source color space
* @param dst destination color space
*/
KoCachedColorConversionTransformation cachedConverter(const KoColorSpace* src, const KoColorSpace* dst, KoColorConversionTransformation::Intent _renderingIntent);
KoCachedColorConversionTransformation cachedConverter(const KoColorSpace* src, const KoColorSpace* dst, KoColorConversionTransformation::Intent _renderingIntent = KoColorConversionTransformation::IntentPerceptual);
/**
* This function is called by the destructor of the color space to
* warn the cache that any pointers to this color space is going to
......
......@@ -129,6 +129,8 @@ void KoColorConversionSystem::insertColorSpace(const KoColorSpaceFactory* csf)
v->setFactoryFromSrc(cctf);
}
}
#if 0
// Not a good idea !
// Check if there is a path to convert self into self
Vertex* v = vertexBetween(csNode, csNode);
if(not v)
......@@ -137,6 +139,7 @@ void KoColorConversionSystem::insertColorSpace(const KoColorSpaceFactory* csf)
kDebug(DBG_PIGMENT) << "No self to self color conversion, add the copy one";
v->setFactoryFromSrc( new KoCopyColorConversionTransformationFactory(modelId, depthId));
}
#endif
}
const KoColorSpace* KoColorConversionSystem::defaultColorSpaceForNode(const Node* node) const
......
......@@ -434,6 +434,7 @@ KoColorTransformation* KoColorSpace::createColorTransformation( const QString &
return factory->createTransformation( this, parameters);
} else {
// Find the best solution
// TODO use the color conversion cache
KoColorConversionTransformation* csToFallBack = 0;
KoColorConversionTransformation* fallBackToCs = 0;
KoColorSpaceRegistry::instance()->colorConversionSystem()->createColorConverters(this, models, csToFallBack, fallBackToCs);
......
......@@ -22,11 +22,15 @@
#include "KoColorConversionTransformation.h"
#include "KoColorSpace.h"
#include "KoColorTransformation.h"
#include "KoColorConversionCache.h"
#include "KoColorSpaceRegistry.h"
struct KoFallBackColorTransformation::Private {
const KoColorSpace* fallBackColorSpace;
KoColorConversionTransformation* csToFallBack;
KoColorConversionTransformation* fallBackToCs;
KoCachedColorConversionTransformation* csToFallBackCache;
KoCachedColorConversionTransformation* fallBackToCsCache;
const KoColorConversionTransformation* csToFallBack;
const KoColorConversionTransformation* fallBackToCs;
KoColorTransformation* colorTransformation;
mutable quint8* buff;
mutable qint32 buffSize;
......@@ -35,8 +39,10 @@ struct KoFallBackColorTransformation::Private {
KoFallBackColorTransformation::KoFallBackColorTransformation(const KoColorSpace* _cs, const KoColorSpace* _fallBackCS, KoColorTransformation* _transfo) : d(new Private)
{
d->fallBackColorSpace = _fallBackCS;
d->csToFallBack = _cs->createColorConverter( _fallBackCS);
d->fallBackToCs = _fallBackCS->createColorConverter( _cs );
d->csToFallBackCache = new KoCachedColorConversionTransformation( KoColorSpaceRegistry::instance()->colorConversionCache()->cachedConverter( _cs, _fallBackCS));
d->csToFallBack = d->csToFallBackCache->transformation();
d->fallBackToCsCache = new KoCachedColorConversionTransformation( KoColorSpaceRegistry::instance()->colorConversionCache()->cachedConverter( _fallBackCS, _cs) );
d->fallBackToCs = d->fallBackToCsCache->transformation();
d->colorTransformation = _transfo;
d->buff = 0;
d->buffSize = 0;
......@@ -49,6 +55,8 @@ KoFallBackColorTransformation::KoFallBackColorTransformation(KoColorConversionTr
d->fallBackColorSpace = _fallBackToCs->dstColorSpace();
d->csToFallBack = _csToFallBack;
d->fallBackToCs = _fallBackToCs;
d->csToFallBackCache = 0;
d->fallBackToCsCache = 0;
d->colorTransformation = _transfo;
d->buff = 0;
d->buffSize = 0;
......@@ -56,8 +64,18 @@ KoFallBackColorTransformation::KoFallBackColorTransformation(KoColorConversionTr
KoFallBackColorTransformation::~KoFallBackColorTransformation()
{
delete d->csToFallBack;
delete d->fallBackToCs;
if( d->csToFallBackCache)
{
delete d->csToFallBackCache;
} else {
delete d->csToFallBack;
}
if( d->csToFallBackCache)
{
delete d->fallBackToCsCache;
} else {
delete d->fallBackToCs;
}
delete d->colorTransformation;
delete[] d->buff;
delete d;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment