Commit 6201f61b authored by Ilkka Ollakka's avatar Ilkka Ollakka

Qt4: don't cache inside pictureflow

doesn't seem to help at all in thatway, also leaked in playlist-tree mode
(so if you revert, remember to fix that)
parent b99bed68
...@@ -33,8 +33,6 @@ ...@@ -33,8 +33,6 @@
#endif #endif
#include <QApplication> #include <QApplication>
#include <QCache>
#include <QHash>
#include <QImage> #include <QImage>
#include <QKeyEvent> #include <QKeyEvent>
#include <QPainter> #include <QPainter>
...@@ -197,8 +195,6 @@ private: ...@@ -197,8 +195,6 @@ private:
QImage buffer; QImage buffer;
QVector<PFreal> rays; QVector<PFreal> rays;
QImage* blankSurface; QImage* blankSurface;
QCache<int, QImage> surfaceCache;
QHash<int, QImage*> imageHash;
void render(); void render();
void renderSlides(); void renderSlides();
...@@ -417,7 +413,6 @@ PictureFlowSoftwareRenderer::PictureFlowSoftwareRenderer(): ...@@ -417,7 +413,6 @@ PictureFlowSoftwareRenderer::PictureFlowSoftwareRenderer():
PictureFlowSoftwareRenderer::~PictureFlowSoftwareRenderer() PictureFlowSoftwareRenderer::~PictureFlowSoftwareRenderer()
{ {
surfaceCache.clear();
buffer = QImage(); buffer = QImage();
delete blankSurface; delete blankSurface;
} }
...@@ -432,12 +427,10 @@ void PictureFlowSoftwareRenderer::paint() ...@@ -432,12 +427,10 @@ void PictureFlowSoftwareRenderer::paint()
if (state->backgroundColor != bgcolor) { if (state->backgroundColor != bgcolor) {
bgcolor = state->backgroundColor; bgcolor = state->backgroundColor;
surfaceCache.clear();
} }
if ((int)(state->reflectionEffect) != effect) { if ((int)(state->reflectionEffect) != effect) {
effect = (int)state->reflectionEffect; effect = (int)state->reflectionEffect;
surfaceCache.clear();
} }
if (dirty) if (dirty)
...@@ -473,7 +466,6 @@ void PictureFlowSoftwareRenderer::init() ...@@ -473,7 +466,6 @@ void PictureFlowSoftwareRenderer::init()
if (!widget) if (!widget)
return; return;
surfaceCache.clear();
blankSurface = 0; blankSurface = 0;
size = widget->size(); size = widget->size();
...@@ -623,16 +615,9 @@ QImage* PictureFlowSoftwareRenderer::surface(int slideIndex) ...@@ -623,16 +615,9 @@ QImage* PictureFlowSoftwareRenderer::surface(int slideIndex)
QImage* img = new QImage(PLModel::getArtPixmap( state->model->index( slideIndex, 0, state->model->currentIndex().parent() ), QImage* img = new QImage(PLModel::getArtPixmap( state->model->index( slideIndex, 0, state->model->currentIndex().parent() ),
QSize( state->slideWidth, state->slideHeight ) ).toImage()); QSize( state->slideWidth, state->slideHeight ) ).toImage());
bool exist = imageHash.contains(slideIndex);
if (exist)
if (img == imageHash.find(slideIndex).value())
if (surfaceCache.contains(key))
return surfaceCache[key];
QImage* sr = prepareSurface(img, state->slideWidth, state->slideHeight, bgcolor, state->reflectionEffect); QImage* sr = prepareSurface(img, state->slideWidth, state->slideHeight, bgcolor, state->reflectionEffect);
surfaceCache.insert(key, sr);
imageHash.insert(slideIndex, img);
delete img;
return sr; return sr;
} }
...@@ -676,7 +661,10 @@ QRect PictureFlowSoftwareRenderer::renderSlide(const SlideInfo &slide, int col1, ...@@ -676,7 +661,10 @@ QRect PictureFlowSoftwareRenderer::renderSlide(const SlideInfo &slide, int col1,
int xi = qMax((PFreal)0, (w * PFREAL_ONE / 2) + fdiv(xs * h, dist + ys) >> PFREAL_SHIFT); int xi = qMax((PFreal)0, (w * PFREAL_ONE / 2) + fdiv(xs * h, dist + ys) >> PFREAL_SHIFT);
if (xi >= w) if (xi >= w)
{
delete src;
return rect; return rect;
}
bool flag = false; bool flag = false;
rect.setLeft(xi); rect.setLeft(xi);
...@@ -746,6 +734,7 @@ QRect PictureFlowSoftwareRenderer::renderSlide(const SlideInfo &slide, int col1, ...@@ -746,6 +734,7 @@ QRect PictureFlowSoftwareRenderer::renderSlide(const SlideInfo &slide, int col1,
rect.setTop(0); rect.setTop(0);
rect.setBottom(h - 1); rect.setBottom(h - 1);
delete src;
return rect; return rect;
} }
......
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