Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
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
Commits
fd144552
Commit
fd144552
authored
Oct 20, 2009
by
Rémi Duraffort
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
puzzle: add some comments.
parent
7342c3ff
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
6 deletions
+7
-6
modules/video_filter/puzzle.c
modules/video_filter/puzzle.c
+7
-6
No files found.
modules/video_filter/puzzle.c
View file @
fd144552
...
@@ -205,7 +205,7 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
...
@@ -205,7 +205,7 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
const
int
i_rows
=
p_sys
->
i_rows
;
const
int
i_rows
=
p_sys
->
i_rows
;
const
int
i_cols
=
p_sys
->
i_cols
;
const
int
i_cols
=
p_sys
->
i_cols
;
/* */
/*
Draw each piece of the puzzle at the right place
*/
for
(
int
i_plane
=
0
;
i_plane
<
p_outpic
->
i_planes
;
i_plane
++
)
for
(
int
i_plane
=
0
;
i_plane
<
p_outpic
->
i_planes
;
i_plane
++
)
{
{
const
plane_t
*
p_in
=
&
p_pic
->
p
[
i_plane
];
const
plane_t
*
p_in
=
&
p_pic
->
p
[
i_plane
];
...
@@ -244,6 +244,7 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
...
@@ -244,6 +244,7 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
}
}
}
}
/* Draw the borders of the selected slot */
if
(
p_sys
->
i_selected
!=
-
1
&&
!
p_sys
->
b_blackslot
)
if
(
p_sys
->
i_selected
!=
-
1
&&
!
p_sys
->
b_blackslot
)
{
{
const
plane_t
*
p_in
=
&
p_pic
->
p
[
Y_PLANE
];
const
plane_t
*
p_in
=
&
p_pic
->
p
[
Y_PLANE
];
...
@@ -269,6 +270,7 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
...
@@ -269,6 +270,7 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
0xff
,
i_pitch
/
i_cols
);
0xff
,
i_pitch
/
i_cols
);
}
}
/* Draw the 'Shuffle' button if the puzzle is finished */
if
(
p_sys
->
b_finished
)
if
(
p_sys
->
b_finished
)
{
{
plane_t
*
p_out
=
&
p_outpic
->
p
[
Y_PLANE
];
plane_t
*
p_out
=
&
p_outpic
->
p
[
Y_PLANE
];
...
@@ -291,6 +293,7 @@ static int Mouse( filter_t *p_filter, vlc_mouse_t *p_mouse,
...
@@ -291,6 +293,7 @@ static int Mouse( filter_t *p_filter, vlc_mouse_t *p_mouse,
filter_sys_t
*
p_sys
=
p_filter
->
p_sys
;
filter_sys_t
*
p_sys
=
p_filter
->
p_sys
;
const
video_format_t
*
p_fmt
=
&
p_filter
->
fmt_in
.
video
;
const
video_format_t
*
p_fmt
=
&
p_filter
->
fmt_in
.
video
;
/* Only take events inside the puzzle erea */
if
(
p_new
->
i_x
<
0
||
p_new
->
i_x
>=
(
int
)
p_fmt
->
i_width
||
if
(
p_new
->
i_x
<
0
||
p_new
->
i_x
>=
(
int
)
p_fmt
->
i_width
||
p_new
->
i_y
<
0
||
p_new
->
i_y
>=
(
int
)
p_fmt
->
i_height
)
p_new
->
i_y
<
0
||
p_new
->
i_y
>=
(
int
)
p_fmt
->
i_height
)
return
VLC_EGENERIC
;
return
VLC_EGENERIC
;
...
@@ -298,6 +301,7 @@ static int Mouse( filter_t *p_filter, vlc_mouse_t *p_mouse,
...
@@ -298,6 +301,7 @@ static int Mouse( filter_t *p_filter, vlc_mouse_t *p_mouse,
/* */
/* */
const
bool
b_clicked
=
vlc_mouse_HasPressed
(
p_old
,
p_new
,
MOUSE_BUTTON_LEFT
);
const
bool
b_clicked
=
vlc_mouse_HasPressed
(
p_old
,
p_new
,
MOUSE_BUTTON_LEFT
);
/* If the puzzle is finished, shuffle it if needed */
if
(
p_sys
->
b_finished
)
if
(
p_sys
->
b_finished
)
{
{
if
(
b_clicked
&&
if
(
b_clicked
&&
...
@@ -334,15 +338,12 @@ static int Mouse( filter_t *p_filter, vlc_mouse_t *p_mouse,
...
@@ -334,15 +338,12 @@ static int Mouse( filter_t *p_filter, vlc_mouse_t *p_mouse,
||
p_sys
->
i_selected
==
i_pos
+
p_sys
->
i_cols
||
p_sys
->
i_selected
==
i_pos
+
p_sys
->
i_cols
||
p_sys
->
i_selected
==
i_pos
-
p_sys
->
i_cols
)
||
p_sys
->
i_selected
==
i_pos
-
p_sys
->
i_cols
)
{
{
/* Swap two pieces */
int
a
=
p_sys
->
pi_order
[
p_sys
->
i_selected
];
int
a
=
p_sys
->
pi_order
[
p_sys
->
i_selected
];
p_sys
->
pi_order
[
p_sys
->
i_selected
]
=
p_sys
->
pi_order
[
i_pos
];
p_sys
->
pi_order
[
p_sys
->
i_selected
]
=
p_sys
->
pi_order
[
i_pos
];
p_sys
->
pi_order
[
i_pos
]
=
a
;
p_sys
->
pi_order
[
i_pos
]
=
a
;
if
(
p_sys
->
b_blackslot
)
p_sys
->
i_selected
=
p_sys
->
b_blackslot
?
i_pos
:
-
1
;
p_sys
->
i_selected
=
i_pos
;
else
p_sys
->
i_selected
=
-
1
;
p_sys
->
b_finished
=
IsFinished
(
p_sys
);
p_sys
->
b_finished
=
IsFinished
(
p_sys
);
}
}
return
VLC_EGENERIC
;
return
VLC_EGENERIC
;
...
...
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