koffice/libs
Cyrille Berger
cyb at lepi.org
Wed Mar 19 00:31:12 CET 2008
SVN commit 787329 by berger:
should fix the speed issue when darkening in the tablet option
CCMAIL:kimageshop at kde.org
M +3 -0 guiutils/KoDocumentSectionDelegate.cpp
M +1 -1 pigment/KoColorConversionCache.h
M +3 -0 pigment/KoColorConversionSystem.cpp
M +1 -0 pigment/KoColorSpace.cpp
M +24 -6 pigment/KoFallBackColorTransformation.cpp
--- trunk/koffice/libs/guiutils/KoDocumentSectionDelegate.cpp #787328:787329
@@ -31,6 +31,8 @@
#include <QPointer>
#include <QStyleOptionViewItem>
+#include <kdebug.h>
+
class KoDocumentSectionDelegate::Private
{
public:
@@ -420,6 +422,7 @@
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;
--- trunk/koffice/libs/pigment/KoColorConversionCache.h #787328:787329
@@ -42,7 +42,7 @@
* @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
--- trunk/koffice/libs/pigment/KoColorConversionSystem.cpp #787328:787329
@@ -129,6 +129,8 @@
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 @@
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
--- trunk/koffice/libs/pigment/KoColorSpace.cpp #787328:787329
@@ -434,6 +434,7 @@
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);
--- trunk/koffice/libs/pigment/KoFallBackColorTransformation.cpp #787328:787329
@@ -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 @@
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 @@
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()
{
- 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;
More information about the kimageshop
mailing list