[Kde-imaging] extragear/libs/kipi-plugins/slideshow
Caulier Gilles
caulier.gilles at gmail.com
Tue Feb 20 14:32:34 CET 2007
Le mardi 20 février 2007 14:22, Markus Leuthold a écrit :
> Valerio Fuoglio schrieb:
> > SVN commit 635564 by vfuoglio:
> >
> > Added libkdcraw support.
> > Thanks to Gilles for the patch.
> >
> > CCMAIL: kde-imaging at kde.org
> > CCMAIL: caulier.gilles at gmail.com
> >
> >
> >
> >
> >
> > M +6 -3 Makefile.am
> > M +30 -1 imlibiface.cpp
> >
> >
> > --- trunk/extragear/libs/kipi-plugins/slideshow/Makefile.am
> > #635563:635564 @@ -1,16 +1,19 @@
> > -INCLUDES = $(KIPI_PLUGINS_COMMON_INCLUDE) $(IMLIB2_CFLAGS)
> > $(LIBKIPI_CFLAGS) $(all_includes) METASOURCES = AUTO
> >
> > +INCLUDES = $(KIPI_PLUGINS_COMMON_INCLUDE) $(IMLIB2_CFLAGS)
> > $(LIBKIPI_CFLAGS) \ + $(LIBKDCRAW_CFLAGS) $(all_includes)
> > +
> > # Install this plugin in the KDE modules directory
> > kde_module_LTLIBRARIES = kipiplugin_slideshow.la
> >
> > -kipiplugin_slideshow_la_DEPENDENCIES = $(LIBKIPI_LIBS_DEP)
> > +kipiplugin_slideshow_la_DEPENDENCIES = $(LIBKIPI_LIBS_DEP)
> > $(LIBKDCRAW_LIBS_DEP)
> >
> > kipiplugin_slideshow_la_SOURCES = plugin_slideshow.cpp slideshow.cpp \
> > slideshowconfig.cpp imlibiface.cpp slideshowgl.cpp toolbar.cpp
> > slideshowconfigbase.ui
> >
> > #kipiplugin_slideshow_la_LIBADD = -lkdefx $(LIB_IMLIB2) $(GL_LIBS)
> > $(LIBKIPI_LIBS) $(LIB_KDEUI) $(LIB_KDECORE) $(LIB_QT)
> > -kipiplugin_slideshow_la_LIBADD = -lkdefx -lImlib2 $(GL_LIBS)
> > $(LIBKIPI_LIBS) $(LIB_KDEUI) $(LIB_KDECORE) $(LIB_QT)
> > +kipiplugin_slideshow_la_LIBADD = -lkdefx -lImlib2 $(GL_LIBS)
> > $(LIBKIPI_LIBS) $(LIBKDCRAW_LIBS) \ +
> > $(LIB_KDEUI) $(LIB_KDECORE) $(LIB_QT)
> >
> > kipiplugin_slideshow_la_LDFLAGS = $(KIPI_PLUGINS_COMMON_LDFLAGS) -module
> > $(KDE_PLUGIN) $(all_libraries) -lkipiplugins
> >
> > --- trunk/extragear/libs/kipi-plugins/slideshow/imlibiface.cpp
> > #635563:635564 @@ -19,15 +19,27 @@
> > *
> > * ============================================================ */
> >
> > +// Qt includes.
> > +
> > #include <qwidget.h>
> > #include <qstring.h>
> > #include <qfile.h>
> > #include <qfileinfo.h>
> > +#include <qimage.h>
> > #include <qpixmap.h>
> >
> > +// LibKDcraw includes.
> > +
> > +#include <libkdcraw/rawfiles.h>
> > +#include <libkdcraw/kdcraw.h>
> > +
> > +// Imlib2 includes.
> > +
> > #include <X11/Xlib.h>
> > #include <Imlib2.h>
> >
> > +// Local includes.
> > +
> > #include "imlibiface.h"
> >
> > namespace KIPISlideShowPlugin
> > @@ -81,7 +93,24 @@
> >
> > imlib_context_push(imIface_->d->context);
> >
> > - d->image = imlib_load_image(QFile::encodeName(file).data());
> > + QString rawFilesExt(raw_file_extentions);
> > +
> > + // Check if RAW file.
> > + QFileInfo fileInfo(file);
> > + if (rawFilesExt.upper().contains( fileInfo.extension(false).upper()
> > )) + {
> > + QImage rawPreview;
> > + KDcrawIface::KDcraw::loadDcrawPreview(rawPreview, file);
> > + d->image = imlib_create_image(rawPreview.width(),
> > rawPreview.height()); + imlib_context_set_image(d->image);
> > + DATA32* data = imlib_image_get_data_for_reading_only();
> > + memcpy(data, rawPreview.bits(), rawPreview.numBytes());
> > + }
> > + else
> > + {
> > + d->image = imlib_load_image(QFile::encodeName(file).data());
> > + }
> > +
> > if (d->image) {
> > imlib_context_set_image(d->image);
> > d->valid = true;
> > _______________________________________________
> > Kde-imaging mailing list
> > Kde-imaging at kde.org
> > https://mail.kde.org/mailman/listinfo/kde-imaging
>
> That patch is not enough, it doesn't cover the opengl loader. You also
> need to patch slideshowgl.cpp (loadImage). Have a look a Gilles patch
> (for texture.cpp) for the image viewer from yesterday. It's something like
>
> - image=QImage(fn);
> +
> + // Check if RAW file.
> + QString rawFilesExt(raw_file_extentions);
> + QFileInfo fileInfo(fn);
> + if (rawFilesExt.upper().contains(
> fileInfo.extension(false).upper() )) +
> KDcrawIface::KDcraw::loadDcrawPreview(image, fn);
> + else
> + image=QImage(fn);
>
> plus all the header files.
>
> Kusi
>
I have unpatched the GL part because i have suspected (but not verified) than
it use the imlib2 loader for performance issue, like the 2D part of the
plugin...
I'm so suprised than Renchi do not have used this way. Using QImage dirrectly
is an error because we have the imlib2 interface ready to use and witch
provide a huge and speed up cache mechanism on memory.
It very easy to use it Valerio...
Gilles
More information about the Kde-imaging
mailing list