Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc-2-2
Commits
e054f6f0
Commit
e054f6f0
authored
Dec 14, 2010
by
Ilkka Ollakka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
qt4: use caching in pictureflow (bring it back)
parent
06b557b9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
12 deletions
+27
-12
modules/gui/qt4/util/pictureflow.cpp
modules/gui/qt4/util/pictureflow.cpp
+27
-12
No files found.
modules/gui/qt4/util/pictureflow.cpp
View file @
e054f6f0
...
@@ -40,8 +40,10 @@
...
@@ -40,8 +40,10 @@
#include <QTimer>
#include <QTimer>
#include <QVector>
#include <QVector>
#include <QWidget>
#include <QWidget>
#include <QHash>
#include "../components/playlist/playlist_model.hpp"
/* getArtPixmap etc */
#include "../components/playlist/playlist_model.hpp"
/* getArtPixmap etc */
#include "../components/playlist/sorting.h"
/* Columns List */
#include "../components/playlist/sorting.h"
/* Columns List */
#include "input_manager.hpp"
// for fixed-point arithmetic, we need minimum 32-bit long
// for fixed-point arithmetic, we need minimum 32-bit long
// long long (64-bit) might be useful for multiplication and division
// long long (64-bit) might be useful for multiplication and division
...
@@ -199,7 +201,8 @@ private:
...
@@ -199,7 +201,8 @@ private:
void
render
();
void
render
();
void
renderSlides
();
void
renderSlides
();
QRect
renderSlide
(
const
SlideInfo
&
slide
,
int
col1
=
-
1
,
int
col2
=
-
1
);
QRect
renderSlide
(
const
SlideInfo
&
slide
,
int
col1
=
-
1
,
int
col2
=
-
1
);
QImage
*
surface
(
int
slideIndex
);
QImage
*
surface
(
QModelIndex
);
QHash
<
QString
,
QImage
*>
cache
;
};
};
// ------------- PictureFlowState ---------------------------------------
// ------------- PictureFlowState ---------------------------------------
...
@@ -414,6 +417,7 @@ PictureFlowSoftwareRenderer::PictureFlowSoftwareRenderer():
...
@@ -414,6 +417,7 @@ PictureFlowSoftwareRenderer::PictureFlowSoftwareRenderer():
PictureFlowSoftwareRenderer
::~
PictureFlowSoftwareRenderer
()
PictureFlowSoftwareRenderer
::~
PictureFlowSoftwareRenderer
()
{
{
buffer
=
QImage
();
buffer
=
QImage
();
cache
.
clear
();
delete
blankSurface
;
delete
blankSurface
;
}
}
...
@@ -605,19 +609,15 @@ static QImage* prepareSurface(const QImage* slideImage, int w, int h, QRgb bgcol
...
@@ -605,19 +609,15 @@ static QImage* prepareSurface(const QImage* slideImage, int w, int h, QRgb bgcol
return
result
;
return
result
;
}
}
QImage
*
PictureFlowSoftwareRenderer
::
surface
(
int
slideI
ndex
)
QImage
*
PictureFlowSoftwareRenderer
::
surface
(
QModelIndex
i
ndex
)
{
{
if
(
!
state
)
if
(
!
state
||
!
index
.
isValid
())
return
0
;
if
(
slideIndex
<
0
)
return
0
;
if
(
slideIndex
>=
state
->
model
->
rowCount
(
state
->
model
->
currentIndex
().
parent
()
)
)
return
0
;
return
0
;
QImage
*
img
=
new
QImage
(
PLModel
::
getArtPixmap
(
state
->
model
->
index
(
slideIndex
,
0
,
state
->
model
->
currentIndex
().
parent
()
)
,
QImage
*
img
=
new
QImage
(
PLModel
::
getArtPixmap
(
index
,
QSize
(
state
->
slideWidth
,
state
->
slideHeight
)
).
toImage
());
QSize
(
state
->
slideWidth
,
state
->
slideHeight
)
).
toImage
());
QImage
*
sr
=
prepareSurface
(
img
,
state
->
slideWidth
,
state
->
slideHeight
,
bgcolor
,
state
->
reflectionEffect
,
state
->
model
->
index
(
slideIndex
,
0
,
state
->
model
->
currentIndex
().
parent
()
)
);
QImage
*
sr
=
prepareSurface
(
img
,
state
->
slideWidth
,
state
->
slideHeight
,
bgcolor
,
state
->
reflectionEffect
,
index
);
delete
img
;
delete
img
;
return
sr
;
return
sr
;
...
@@ -631,7 +631,24 @@ QRect PictureFlowSoftwareRenderer::renderSlide(const SlideInfo &slide, int col1,
...
@@ -631,7 +631,24 @@ QRect PictureFlowSoftwareRenderer::renderSlide(const SlideInfo &slide, int col1,
if
(
!
blend
)
if
(
!
blend
)
return
QRect
();
return
QRect
();
QImage
*
src
=
surface
(
slide
.
slideIndex
);
QModelIndex
index
;
index
=
state
->
model
->
index
(
slide
.
slideIndex
,
0
,
state
->
model
->
currentIndex
().
parent
()
);
if
(
!
index
.
isValid
()
)
return
QRect
();
PLItem
*
item
=
static_cast
<
PLItem
*>
(
index
.
internalPointer
()
);
QString
key
=
QString
(
"%1%2%3%4"
).
arg
(
PLModel
::
getMeta
(
index
,
COLUMN_TITLE
)).
arg
(
PLModel
::
getMeta
(
index
,
COLUMN_ARTIST
)
).
arg
(
index
.
data
(
PLModel
::
IsCurrentRole
).
toBool
()
).
arg
(
InputManager
::
decodeArtURL
(
item
->
inputItem
()
)
);
QImage
*
src
;
if
(
cache
.
contains
(
key
)
)
src
=
cache
.
value
(
key
);
else
{
src
=
surface
(
index
);
cache
.
insert
(
key
,
src
);
}
if
(
!
src
)
if
(
!
src
)
return
QRect
();
return
QRect
();
...
@@ -664,7 +681,6 @@ QRect PictureFlowSoftwareRenderer::renderSlide(const SlideInfo &slide, int col1,
...
@@ -664,7 +681,6 @@ 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
;
}
}
...
@@ -736,7 +752,6 @@ QRect PictureFlowSoftwareRenderer::renderSlide(const SlideInfo &slide, int col1,
...
@@ -736,7 +752,6 @@ 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
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment