Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
thunar
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Pratik Karki
thunar
Commits
98667d8e
Commit
98667d8e
authored
4 years ago
by
Alexander Schwinn
Browse files
Options
Downloads
Patches
Plain Diff
Improve comments in "thumbnail_needs_frame"
Related to Issue #473
parent
acec9650
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
thunar/thunar-icon-factory.c
+6
-3
6 additions, 3 deletions
thunar/thunar-icon-factory.c
with
6 additions
and
3 deletions
thunar/thunar-icon-factory.c
+
6
−
3
View file @
98667d8e
...
@@ -415,6 +415,7 @@ thumbnail_needs_frame (const GdkPixbuf *thumbnail,
...
@@ -415,6 +415,7 @@ thumbnail_needs_frame (const GdkPixbuf *thumbnail,
const
guchar
*
pixels
;
const
guchar
*
pixels
;
gint
rowstride
;
gint
rowstride
;
gint
n
;
gint
n
;
guchar
alpha_threshold
=
255u
;
/* An alpha value of 255 means full opacity, 0 is fully transparent. */
/* don't add frames to small thumbnails */
/* don't add frames to small thumbnails */
if
(
size
<
THUNAR_ICON_SIZE_64
)
if
(
size
<
THUNAR_ICON_SIZE_64
)
...
@@ -427,9 +428,11 @@ thumbnail_needs_frame (const GdkPixbuf *thumbnail,
...
@@ -427,9 +428,11 @@ thumbnail_needs_frame (const GdkPixbuf *thumbnail,
/* get a pointer to the thumbnail data */
/* get a pointer to the thumbnail data */
pixels
=
gdk_pixbuf_get_pixels
(
thumbnail
);
pixels
=
gdk_pixbuf_get_pixels
(
thumbnail
);
/* Data is stored in 4 channels (red, green, blue, alpha). We are only interested in channel 4 (alpha) */
/* check if we have a transparent pixel on the first row */
/* check if we have a transparent pixel on the first row */
for
(
n
=
width
*
4
;
n
>
0
;
n
-=
4
)
for
(
n
=
width
*
4
;
n
>
0
;
n
-=
4
)
if
(
pixels
[
n
-
1
]
<
255u
)
if
(
pixels
[
n
-
1
]
<
alpha_threshold
)
return
FALSE
;
return
FALSE
;
/* determine the rowstride */
/* determine the rowstride */
...
@@ -440,12 +443,12 @@ thumbnail_needs_frame (const GdkPixbuf *thumbnail,
...
@@ -440,12 +443,12 @@ thumbnail_needs_frame (const GdkPixbuf *thumbnail,
/* check if we have a transparent pixel in the first or last column */
/* check if we have a transparent pixel in the first or last column */
for
(
n
=
height
-
2
;
n
>
0
;
--
n
,
pixels
+=
rowstride
)
for
(
n
=
height
-
2
;
n
>
0
;
--
n
,
pixels
+=
rowstride
)
if
(
pixels
[
3
]
<
255u
||
pixels
[
width
*
4
-
1
]
<
255u
)
if
(
pixels
[
3
]
<
alpha_threshold
||
pixels
[
width
*
4
-
1
]
<
alpha_threshold
)
return
FALSE
;
return
FALSE
;
/* check if we have a transparent pixel on the last row */
/* check if we have a transparent pixel on the last row */
for
(
n
=
width
*
4
;
n
>
0
;
n
-=
4
)
for
(
n
=
width
*
4
;
n
>
0
;
n
-=
4
)
if
(
pixels
[
n
-
1
]
<
255u
)
if
(
pixels
[
n
-
1
]
<
alpha_threshold
)
return
FALSE
;
return
FALSE
;
return
TRUE
;
return
TRUE
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment