200 lines
6.3 KiB
Diff
200 lines
6.3 KiB
Diff
|
diff -ur kdelibs-4.1.1/khtml/imload/animprovider.cpp kdelibs-4.1.1-kde#157789/khtml/imload/animprovider.cpp
|
||
|
--- kdelibs-4.1.1/khtml/imload/animprovider.cpp 2008-05-21 13:06:09.000000000 +0200
|
||
|
+++ kdelibs-4.1.1-kde#157789/khtml/imload/animprovider.cpp 2008-09-19 01:00:47.000000000 +0200
|
||
|
@@ -38,6 +38,8 @@
|
||
|
|
||
|
void AnimProvider::switchFrame()
|
||
|
{
|
||
|
+ if (animationAdvice == KHTMLSettings::KAnimationDisabled)
|
||
|
+ return;
|
||
|
shouldSwitchFrame = true;
|
||
|
image->notifyPerformUpdate();
|
||
|
}
|
||
|
@@ -47,6 +49,11 @@
|
||
|
ImageManager::animTimer()->destroyed(this);
|
||
|
}
|
||
|
|
||
|
+void AnimProvider::setShowAnimations(KHTMLSettings::KAnimationAdvice newAdvice)
|
||
|
+{
|
||
|
+ animationAdvice = newAdvice;
|
||
|
+}
|
||
|
+
|
||
|
}
|
||
|
|
||
|
// kate: indent-width 4; replace-tabs on; tab-width 4; space-indent on;
|
||
|
diff -ur kdelibs-4.1.1/khtml/imload/animprovider.h kdelibs-4.1.1-kde#157789/khtml/imload/animprovider.h
|
||
|
--- kdelibs-4.1.1/khtml/imload/animprovider.h 2008-05-21 13:06:09.000000000 +0200
|
||
|
+++ kdelibs-4.1.1-kde#157789/khtml/imload/animprovider.h 2008-09-19 01:04:49.000000000 +0200
|
||
|
@@ -25,6 +25,8 @@
|
||
|
#ifndef ANIM_PROVIDER_H
|
||
|
#define ANIM_PROVIDER_H
|
||
|
|
||
|
+#include <khtml_settings.h>
|
||
|
+
|
||
|
class QPainter;
|
||
|
|
||
|
namespace khtmlImLoad {
|
||
|
@@ -44,11 +46,13 @@
|
||
|
PixmapPlane* curFrame;
|
||
|
Image* image;
|
||
|
bool shouldSwitchFrame; //Set by AnimTimer
|
||
|
+ KHTMLSettings::KAnimationAdvice animationAdvice;
|
||
|
|
||
|
void nextFrame(); //Helper that goes to next frame or wraps around
|
||
|
public:
|
||
|
AnimProvider(PixmapPlane* plane, Image* img):frame0(plane), curFrame(plane),
|
||
|
- image(img), shouldSwitchFrame(false)
|
||
|
+ image(img), shouldSwitchFrame(false),
|
||
|
+ animationAdvice(KHTMLSettings::KAnimationEnabled)
|
||
|
{}
|
||
|
|
||
|
void switchFrame();
|
||
|
@@ -62,6 +66,11 @@
|
||
|
//Must be implemented to paint the given region. Note that clipping to the
|
||
|
//overall canvas will be performed already
|
||
|
virtual void paint(int dx, int dy, QPainter* p, int sx, int sy, int width, int height) = 0;
|
||
|
+
|
||
|
+ /**
|
||
|
+ Enables or disables animations
|
||
|
+ */
|
||
|
+ void setShowAnimations(KHTMLSettings::KAnimationAdvice);
|
||
|
};
|
||
|
|
||
|
}
|
||
|
diff -ur kdelibs-4.1.1/khtml/imload/decoders/gifloader.cpp kdelibs-4.1.1-kde#157789/khtml/imload/decoders/gifloader.cpp
|
||
|
--- kdelibs-4.1.1/khtml/imload/decoders/gifloader.cpp 2008-05-21 13:06:09.000000000 +0200
|
||
|
+++ kdelibs-4.1.1-kde#157789/khtml/imload/decoders/gifloader.cpp 2008-09-19 01:00:59.000000000 +0200
|
||
|
@@ -212,7 +212,11 @@
|
||
|
|
||
|
++frame;
|
||
|
if (frame >= frameInfo.size())
|
||
|
+ {
|
||
|
+ if (animationAdvice == KHTMLSettings::KAnimationLoopOnce)
|
||
|
+ animationAdvice = KHTMLSettings::KAnimationDisabled;
|
||
|
frame = 0;
|
||
|
+ }
|
||
|
nextFrame();
|
||
|
}
|
||
|
|
||
|
diff -ur kdelibs-4.1.1/khtml/imload/image.cpp kdelibs-4.1.1-kde#157789/khtml/imload/image.cpp
|
||
|
--- kdelibs-4.1.1/khtml/imload/image.cpp 2008-05-21 13:06:09.000000000 +0200
|
||
|
+++ kdelibs-4.1.1-kde#157789/khtml/imload/image.cpp 2008-09-19 01:12:02.000000000 +0200
|
||
|
@@ -48,6 +48,7 @@
|
||
|
inError = false;
|
||
|
|
||
|
width = height = 0;
|
||
|
+ animationAdvice = KHTMLSettings::KAnimationEnabled;
|
||
|
|
||
|
noUpdates();
|
||
|
}
|
||
|
@@ -214,6 +215,12 @@
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
+ for (PixmapPlane* cur = original; cur; cur = cur->nextFrame)
|
||
|
+ {
|
||
|
+ if (cur->animProvider)
|
||
|
+ cur->animProvider->setShowAnimations(animationAdvice);
|
||
|
+ }
|
||
|
+
|
||
|
fullyDecoded = true;
|
||
|
owner->imageDone(this);
|
||
|
}
|
||
|
@@ -452,6 +459,19 @@
|
||
|
return original->parent->format.hasAlpha();
|
||
|
}
|
||
|
|
||
|
+void Image::setShowAnimations(KHTMLSettings::KAnimationAdvice newAdvice)
|
||
|
+{
|
||
|
+ if (animationAdvice != newAdvice)
|
||
|
+ {
|
||
|
+ animationAdvice = newAdvice;
|
||
|
+ for (PixmapPlane* cur = original; cur; cur = cur->nextFrame)
|
||
|
+ {
|
||
|
+ if (cur->animProvider)
|
||
|
+ cur->animProvider->setShowAnimations(newAdvice);
|
||
|
+ }
|
||
|
+ }
|
||
|
+}
|
||
|
+
|
||
|
}
|
||
|
|
||
|
// kate: indent-width 4; replace-tabs on; tab-width 4; space-indent on;
|
||
|
diff -ur kdelibs-4.1.1/khtml/imload/image.h kdelibs-4.1.1-kde#157789/khtml/imload/image.h
|
||
|
--- kdelibs-4.1.1/khtml/imload/image.h 2008-05-21 13:06:09.000000000 +0200
|
||
|
+++ kdelibs-4.1.1-kde#157789/khtml/imload/image.h 2008-09-19 01:09:46.000000000 +0200
|
||
|
@@ -30,6 +30,8 @@
|
||
|
#include <QTimer>
|
||
|
#include <QPair>
|
||
|
#include <QMap>
|
||
|
+
|
||
|
+#include <khtml_settings.h>
|
||
|
|
||
|
#include "imageformat.h"
|
||
|
|
||
|
@@ -92,6 +94,11 @@
|
||
|
(but see CanvasImage)
|
||
|
*/
|
||
|
QImage* qimage() const;
|
||
|
+
|
||
|
+ /**
|
||
|
+ Enables or disables animations
|
||
|
+ */
|
||
|
+ void setShowAnimations(KHTMLSettings::KAnimationAdvice);
|
||
|
private:
|
||
|
//Interface to the loader.
|
||
|
friend class ImageLoader;
|
||
|
@@ -165,6 +172,7 @@
|
||
|
int width, height;
|
||
|
PixmapPlane* original;
|
||
|
QMap<QPair<int, int>, PixmapPlane*> scaled;
|
||
|
+ KHTMLSettings::KAnimationAdvice animationAdvice;
|
||
|
|
||
|
};
|
||
|
|
||
|
diff -ur kdelibs-4.1.1/khtml/misc/loader.cpp kdelibs-4.1.1-kde#157789/khtml/misc/loader.cpp
|
||
|
--- kdelibs-4.1.1/khtml/misc/loader.cpp 2008-08-28 10:08:06.000000000 +0200
|
||
|
+++ kdelibs-4.1.1-kde#157789/khtml/misc/loader.cpp 2008-09-19 01:03:07.000000000 +0200
|
||
|
@@ -422,7 +422,7 @@
|
||
|
m_status = Unknown;
|
||
|
imgSource = 0;
|
||
|
setAccept( acceptHeader );
|
||
|
- m_showAnimations = dl->showAnimations();
|
||
|
+ i->setShowAnimations(dl->showAnimations());
|
||
|
m_loading = true;
|
||
|
|
||
|
if ( KHTMLGlobal::defaultHTMLSettings()->isAdFiltered( url.string() ) ) {
|
||
|
@@ -807,30 +807,8 @@
|
||
|
|
||
|
void CachedImage::setShowAnimations( KHTMLSettings::KAnimationAdvice showAnimations )
|
||
|
{
|
||
|
- (void) showAnimations;
|
||
|
-#if 0
|
||
|
- m_showAnimations = showAnimations;
|
||
|
- if ( (m_showAnimations == KHTMLSettings::KAnimationDisabled) && imgSource ) {
|
||
|
-#ifdef __GNUC__
|
||
|
-#warning QDataSource
|
||
|
-#endif
|
||
|
- // imgSource->cleanBuffer();
|
||
|
- delete p;
|
||
|
- p = new QPixmap(m->framePixmap());
|
||
|
-#ifdef __GNUC__
|
||
|
-#warning QMovie requires different API now
|
||
|
-#endif
|
||
|
- //m->disconnectUpdate( this, SLOT( movieUpdated( const QRect &) ));
|
||
|
- //m->disconnectStatus( this, SLOT( movieStatus( int ) ));
|
||
|
- // m->disconnectResize( this, SLOT( movieResize( const QSize& ) ) );
|
||
|
- QTimer::singleShot(0, this, SLOT( deleteMovie()));
|
||
|
- imgSource = 0;
|
||
|
- }
|
||
|
-#endif
|
||
|
-
|
||
|
-#ifdef __GNUC__
|
||
|
-#warning "Use largeimagelib to disable animation"
|
||
|
-#endif
|
||
|
+ if (i)
|
||
|
+ i->setShowAnimations(showAnimations);
|
||
|
}
|
||
|
|
||
|
// void CachedImage::deleteMovie()
|