Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
gThumb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
91
Issues
91
List
Boards
Labels
Service Desk
Milestones
Merge Requests
5
Merge Requests
5
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
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
GNOME
gThumb
Commits
2a44f1f1
Commit
2a44f1f1
authored
May 15, 2011
by
Paolo Bacchilega
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cairio-io: set the has_alpha flag when loading a jpeg or png image
parent
13eb08db
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
37 additions
and
16 deletions
+37
-16
extensions/cairo_io/cairo-io-jpeg.c
extensions/cairo_io/cairo-io-jpeg.c
+3
-0
extensions/cairo_io/cairo-io-png.c
extensions/cairo_io/cairo-io-png.c
+12
-8
extensions/file_tools/gth-file-tool-rotate.c
extensions/file_tools/gth-file-tool-rotate.c
+1
-1
gthumb/cairo-utils.c
gthumb/cairo-utils.c
+16
-7
gthumb/cairo-utils.h
gthumb/cairo-utils.h
+5
-0
No files found.
extensions/cairo_io/cairo-io-jpeg.c
View file @
2a44f1f1
...
...
@@ -156,6 +156,7 @@ _cairo_image_surface_create_from_jpeg (GthFileData *file_data,
struct
error_handler_data
jsrcerr
;
struct
jpeg_decompress_struct
srcinfo
;
cairo_surface_t
*
surface
;
cairo_surface_metadata_t
*
metadata
;
unsigned
char
*
surface_row
;
JSAMPARRAY
buffer
;
int
buffer_stride
;
...
...
@@ -246,6 +247,8 @@ _cairo_image_surface_create_from_jpeg (GthFileData *file_data,
return
image
;
}
metadata
=
_cairo_image_surface_get_metadata
(
surface
);
metadata
->
has_alpha
=
FALSE
;
cairo_surface_flush
(
surface
);
surface_row
=
cairo_image_surface_get_data
(
surface
)
+
line_start
;
...
...
extensions/cairo_io/cairo-io-png.c
View file @
2a44f1f1
...
...
@@ -126,14 +126,15 @@ _cairo_image_surface_create_from_png (GthFileData *file_data,
GCancellable
*
cancellable
,
GError
**
error
)
{
GthImage
*
image
;
CairoPngData
*
cairo_png_data
;
png_uint_32
width
,
height
;
int
bit_depth
,
color_type
,
interlace_type
;
unsigned
char
*
surface_row
;
int
rowstride
;
png_bytep
*
row_pointers
;
int
row
;
GthImage
*
image
;
CairoPngData
*
cairo_png_data
;
png_uint_32
width
,
height
;
int
bit_depth
,
color_type
,
interlace_type
;
cairo_surface_metadata_t
*
metadata
;
unsigned
char
*
surface_row
;
int
rowstride
;
png_bytep
*
row_pointers
;
int
row
;
image
=
gth_image_new
();
...
...
@@ -185,6 +186,9 @@ _cairo_image_surface_create_from_png (GthFileData *file_data,
return
image
;
}
metadata
=
_cairo_image_surface_get_metadata
(
cairo_png_data
->
surface
);
metadata
->
has_alpha
=
(
color_type
&
PNG_COLOR_MASK_ALPHA
);
/* Set the data transformations */
png_set_strip_16
(
cairo_png_data
->
png_ptr
);
...
...
extensions/file_tools/gth-file-tool-rotate.c
View file @
2a44f1f1
...
...
@@ -495,7 +495,7 @@ gth_file_tool_rotate_get_options (GthFileTool *base)
gtk_toggle_button_set_active
(
GTK_TOGGLE_BUTTON
(
self
->
priv
->
background_transparent
),
TRUE
);
}
else
{
gtk_widget_set_sensitive
(
GET_WIDGET
(
"background_transparent"
)
,
FALSE
);
gtk_widget_set_sensitive
(
self
->
priv
->
background_transparent
,
FALSE
);
gtk_toggle_button_set_active
(
GTK_TOGGLE_BUTTON
(
self
->
priv
->
background_transparent
),
FALSE
);
}
...
...
gthumb/cairo-utils.c
View file @
2a44f1f1
...
...
@@ -28,11 +28,6 @@
const
unsigned
char
cairo_channel
[
4
]
=
{
CAIRO_RED
,
CAIRO_GREEN
,
CAIRO_BLUE
,
CAIRO_ALPHA
};
typedef
struct
{
gboolean
has_alpha
;
}
cairo_surface_metadata_t
;
static
cairo_user_data_key_t
surface_metadata_key
;
static
cairo_user_data_key_t
surface_pixels_key
;
...
...
@@ -91,6 +86,21 @@ _cairo_clear_surface (cairo_surface_t **surface)
}
cairo_surface_metadata_t
*
_cairo_image_surface_get_metadata
(
cairo_surface_t
*
surface
)
{
cairo_surface_metadata_t
*
metadata
;
metadata
=
cairo_surface_get_user_data
(
surface
,
&
surface_metadata_key
);
if
(
metadata
==
NULL
)
{
metadata
=
g_new0
(
cairo_surface_metadata_t
,
1
);
cairo_surface_set_user_data
(
surface
,
&
surface_metadata_key
,
metadata
,
surface_metadata_free
);
}
return
metadata
;
}
gboolean
_cairo_image_surface_get_has_alpha
(
cairo_surface_t
*
surface
)
{
...
...
@@ -247,9 +257,8 @@ _cairo_image_surface_create_from_pixbuf (GdkPixbuf *pixbuf)
s_stride
=
cairo_image_surface_get_stride
(
surface
);
s_pixels
=
cairo_image_surface_get_data
(
surface
);
metadata
=
g_new0
(
cairo_surface_metadata_t
,
1
);
metadata
=
_cairo_image_surface_get_metadata
(
surface
);
metadata
->
has_alpha
=
(
p_n_channels
==
4
);
cairo_surface_set_user_data
(
surface
,
&
surface_metadata_key
,
metadata
,
surface_metadata_free
);
if
(
p_n_channels
==
4
)
{
guchar
*
s_iter
;
...
...
gthumb/cairo-utils.h
View file @
2a44f1f1
...
...
@@ -124,6 +124,9 @@ typedef struct {
guchar
a
;
}
cairo_color_255_t
;
typedef
struct
{
gboolean
has_alpha
;
}
cairo_surface_metadata_t
;
extern
const
unsigned
char
cairo_channel
[
4
];
...
...
@@ -143,6 +146,8 @@ void _gdk_color_to_cairo_color_255 (GdkColor *
/* surface */
void
_cairo_clear_surface
(
cairo_surface_t
**
surface
);
cairo_surface_metadata_t
*
_cairo_image_surface_get_metadata
(
cairo_surface_t
*
surface
);
gboolean
_cairo_image_surface_get_has_alpha
(
cairo_surface_t
*
surface
);
cairo_surface_t
*
_cairo_image_surface_copy
(
cairo_surface_t
*
surface
);
cairo_surface_t
*
_cairo_image_surface_copy_subsurface
(
cairo_surface_t
*
surface
,
...
...
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