commit 716ae16094052806350a3a763fbd856a56e38be8
Author: Christophe Fergeau <[email protected]>
Date: Wed Aug 25 13:55:16 2010 +0200
remove Itdb_ArtworkFormat::align_row_bytes
This is now superseded by row_bytes_alignment, and it's possible to
remove it to factor some code while keeping backward compatibility.
src/itdb_device.h | 2 --
src/itdb_sysinfo_extended_parser.c | 12 +++++++++++-
src/ithumb-writer.c | 26 ++++++--------------------
3 files changed, 17 insertions(+), 23 deletions(-)
---
diff --git a/src/itdb_device.h b/src/itdb_device.h
index 6a68a5d..aa0282d 100644
--- a/src/itdb_device.h
+++ b/src/itdb_device.h
@@ -131,7 +131,6 @@ struct _Itdb_Device
* (not currently used)
* @interlaced: If TRUE, the thumbnails are interlaced
* (not currently used)
- * @align_row_bytes: If TRUE, each pixel row must be aligned a 2-byte
boundary
* @color_adjustment: Color adjustment for the thumbnails
* (not currently used)
* @gamma: Gamma value for the thumbails
@@ -155,7 +154,6 @@ struct _Itdb_ArtworkFormat {
gint display_width;
gboolean interlaced;
- gboolean align_row_bytes;
gint color_adjustment;
gdouble gamma;
gint associated_format;
diff --git a/src/itdb_sysinfo_extended_parser.c
b/src/itdb_sysinfo_extended_parser.c
index a4721fd..a78b778 100644
--- a/src/itdb_sysinfo_extended_parser.c
+++ b/src/itdb_sysinfo_extended_parser.c
@@ -233,7 +233,9 @@ static const DictFieldMapping
sysinfo_image_format_fields_mapping[] = {
/* { "PixelFormat", G_TYPE_STRING, G_STRUCT_OFFSET (Itdb_ArtworkFormat,
format) },*/
{ "Interlaced", G_TYPE_BOOLEAN, G_STRUCT_OFFSET (Itdb_ArtworkFormat,
interlaced) },
{ "Crop", G_TYPE_BOOLEAN, G_STRUCT_OFFSET (Itdb_ArtworkFormat,
crop) },
- { "AlignRowBytes", G_TYPE_BOOLEAN, G_STRUCT_OFFSET (Itdb_ArtworkFormat,
align_row_bytes) },
+/* AlignRowBytes is an older version of RowBytesAlignment, it's equivalent
+ * to a value of 4 for RowBytesAlignemnt */
+/* { "AlignRowBytes", G_TYPE_BOOLEAN, G_STRUCT_OFFSET
(Itdb_ArtworkFormat, align_row_bytes) },*/
{ "Rotation", G_TYPE_INT, G_STRUCT_OFFSET (Itdb_ArtworkFormat,
rotation) },
/* BackColor needs to be converted to a gint, this is special-cased
* in g_value_to_image_format */
@@ -460,6 +462,14 @@ static Itdb_ArtworkFormat *g_value_to_image_format (GValue
*value)
dict_to_struct (dict, sysinfo_image_format_fields_mapping, img_spec);
+ if (get_boolean (dict, "AlignRowBytes")
+ && (img_spec->row_bytes_alignment == 0)) {
+ /* at least the nano3g has the AlignRowBytes key with no
+ * RowBytesAlignment key.
+ */
+ img_spec->row_bytes_alignment = 4;
+ }
+
return img_spec;
}
diff --git a/src/ithumb-writer.c b/src/ithumb-writer.c
index fc059df..b588ed0 100644
--- a/src/ithumb-writer.c
+++ b/src/ithumb-writer.c
@@ -109,16 +109,11 @@ pack_RGB_565 (GdkPixbuf *pixbuf, const Itdb_ArtworkFormat
*img_info,
g_return_val_if_fail (((width + horizontal_padding) <=
img_info->width), NULL);
g_return_val_if_fail (((height + vertical_padding) <=
img_info->height), NULL);
- if ((img_info->align_row_bytes) && ((img_info->width % 2) != 0)) {
- /* each pixel is 2 bytes, to align rows on 4 bytes boundaries,
- * width must be a multiple of 2 */
- dest_width = img_info->width + 1;
- } else {
- dest_width = img_info->width;
- }
if ((img_info->row_bytes_alignment > 0) && ((img_info->width %
img_info->row_bytes_alignment) != 0)) {
dest_width = img_info->width + (img_info->row_bytes_alignment -
(img_info->width % img_info->row_bytes_alignment));
+ } else {
+ dest_width = img_info->width;
}
/* Make sure thumb size calculation won't overflow */
@@ -221,16 +216,10 @@ pack_RGB_555 (GdkPixbuf *pixbuf, const Itdb_ArtworkFormat
*img_info,
g_return_val_if_fail (((width + horizontal_padding) <=
img_info->width), NULL);
g_return_val_if_fail (((height + vertical_padding) <=
img_info->height), NULL);
- if ((img_info->align_row_bytes) && ((img_info->width % 2) != 0)) {
- /* each pixel is 2 bytes, to align rows on 4 bytes boundaries,
- * width must be a multiple of 2 */
- dest_width = img_info->width + 1;
- } else {
- dest_width = img_info->width;
- }
-
if ((img_info->row_bytes_alignment > 0) && ((img_info->width %
img_info->row_bytes_alignment) != 0)) {
dest_width = img_info->width + (img_info->row_bytes_alignment -
(img_info->width % img_info->row_bytes_alignment));
+ } else {
+ dest_width = img_info->width;
}
/* Make sure thumb size calculation won't overflow */
@@ -440,14 +429,11 @@ pack_rec_RGB_555 (GdkPixbuf *pixbuf, const
Itdb_ArtworkFormat *img_info,
if (pixels)
{
gint row_stride;
- if ((img_info->align_row_bytes) && ((img_info->width % 2) != 0)) {
- row_stride = img_info->width + 1;
- } else {
- row_stride = img_info->width;
- }
if ((img_info->row_bytes_alignment > 0) && ((img_info->width %
img_info->row_bytes_alignment) != 0)) {
row_stride = img_info->width + (img_info->row_bytes_alignment -
(img_info->width % img_info->row_bytes_alignment));
+ } else {
+ row_stride = img_info->width;
}
deranged_pixels = derange_pixels (NULL, pixels,
------------------------------------------------------------------------------
This SF.net Dev2Dev email is sponsored by:
Show off your parallel programming skills.
Enter the Intel(R) Threading Challenge 2010.
http://p.sf.net/sfu/intel-thread-sfd
_______________________________________________
gtkpod-cvs2 mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gtkpod-cvs2