summaryrefslogtreecommitdiff
path: root/gdk-pixbuf/io-bmp.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdk-pixbuf/io-bmp.c')
-rw-r--r--gdk-pixbuf/io-bmp.c84
1 files changed, 44 insertions, 40 deletions
diff --git a/gdk-pixbuf/io-bmp.c b/gdk-pixbuf/io-bmp.c
index 996822635..13ad6f2bc 100644
--- a/gdk-pixbuf/io-bmp.c
+++ b/gdk-pixbuf/io-bmp.c
@@ -28,7 +28,11 @@
#include <unistd.h>
#endif
#include <string.h>
-#include "gdk-pixbuf-private.h"
+#include <glib-object.h>
+#include <glib/gi18n-lib.h>
+
+#include "gdk-pixbuf-core.h"
+#include "gdk-pixbuf-io.h"
#define DUMPBIH 0
@@ -502,9 +506,11 @@ static gboolean DecodeHeader(unsigned char *BFH, unsigned char *BIH,
/* make all pixels initially transparent */
if (State->Compressed == BI_RLE4 || State->Compressed == BI_RLE8) {
- memset (State->pixbuf->pixels, 0, State->pixbuf->rowstride * State->Header.height);
- State->compr.p = State->pixbuf->pixels
- + State->pixbuf->rowstride * (State->Header.height- 1);
+ gint rowstride = gdk_pixbuf_get_rowstride (State->pixbuf);
+
+ memset (gdk_pixbuf_get_pixels (State->pixbuf), 0, rowstride * State->Header.height);
+ State->compr.p = gdk_pixbuf_get_pixels (State->pixbuf)
+ + rowstride * (State->Header.height- 1);
}
}
@@ -799,13 +805,14 @@ static void OneLine32(struct bmp_progressive_state *context)
int i;
guchar *pixels;
guchar *src;
+ gint rowstride = gdk_pixbuf_get_rowstride (context->pixbuf);
if (!context->Header.Negative)
- pixels = (context->pixbuf->pixels +
- context->pixbuf->rowstride * (context->Header.height - context->Lines - 1));
+ pixels = (gdk_pixbuf_get_pixels (context->pixbuf) +
+ rowstride * (context->Header.height - context->Lines - 1));
else
- pixels = (context->pixbuf->pixels +
- context->pixbuf->rowstride * context->Lines);
+ pixels = (gdk_pixbuf_get_pixels (context->pixbuf) +
+ rowstride * context->Lines);
src = context->buff;
@@ -860,16 +867,15 @@ static void OneLine24(struct bmp_progressive_state *context)
{
gint X;
guchar *Pixels;
+ gint rowstride = gdk_pixbuf_get_rowstride (context->pixbuf);
X = 0;
if (context->Header.Negative == 0)
- Pixels = (context->pixbuf->pixels +
- context->pixbuf->rowstride *
- (context->Header.height - context->Lines - 1));
+ Pixels = (gdk_pixbuf_get_pixels (context->pixbuf) +
+ rowstride * (context->Header.height - context->Lines - 1));
else
- Pixels = (context->pixbuf->pixels +
- context->pixbuf->rowstride *
- context->Lines);
+ Pixels = (gdk_pixbuf_get_pixels (context->pixbuf) +
+ rowstride * context->Lines);
while (X < context->Header.width) {
Pixels[X * 3 + 0] = context->buff[X * 3 + 2];
Pixels[X * 3 + 1] = context->buff[X * 3 + 1];
@@ -884,13 +890,14 @@ static void OneLine16(struct bmp_progressive_state *context)
int i;
guchar *pixels;
guchar *src;
+ gint rowstride = gdk_pixbuf_get_rowstride (context->pixbuf);
if (!context->Header.Negative)
- pixels = (context->pixbuf->pixels +
- context->pixbuf->rowstride * (context->Header.height - context->Lines - 1));
+ pixels = (gdk_pixbuf_get_pixels (context->pixbuf) +
+ rowstride * (context->Header.height - context->Lines - 1));
else
- pixels = (context->pixbuf->pixels +
- context->pixbuf->rowstride * context->Lines);
+ pixels = (gdk_pixbuf_get_pixels (context->pixbuf) +
+ rowstride * context->Lines);
src = context->buff;
@@ -944,16 +951,15 @@ static void OneLine8(struct bmp_progressive_state *context)
{
gint X;
guchar *Pixels;
+ gint rowstride = gdk_pixbuf_get_rowstride (context->pixbuf);
X = 0;
if (context->Header.Negative == 0)
- Pixels = (context->pixbuf->pixels +
- context->pixbuf->rowstride *
- (context->Header.height - context->Lines - 1));
+ Pixels = (gdk_pixbuf_get_pixels (context->pixbuf) +
+ rowstride * (context->Header.height - context->Lines - 1));
else
- Pixels = (context->pixbuf->pixels +
- context->pixbuf->rowstride *
- context->Lines);
+ Pixels = (gdk_pixbuf_get_pixels (context->pixbuf) +
+ rowstride * context->Lines);
while (X < context->Header.width) {
Pixels[X * 3 + 0] =
context->Colormap[context->buff[X]][2];
@@ -969,16 +975,15 @@ static void OneLine4(struct bmp_progressive_state *context)
{
gint X;
guchar *Pixels;
+ gint rowstride = gdk_pixbuf_get_rowstride (context->pixbuf);
X = 0;
if (context->Header.Negative == 0)
- Pixels = (context->pixbuf->pixels +
- context->pixbuf->rowstride *
- (context->Header.height - context->Lines - 1));
+ Pixels = (gdk_pixbuf_get_pixels (context->pixbuf) +
+ rowstride * (context->Header.height - context->Lines - 1));
else
- Pixels = (context->pixbuf->pixels +
- context->pixbuf->rowstride *
- context->Lines);
+ Pixels = (gdk_pixbuf_get_pixels (context->pixbuf) +
+ rowstride * context->Lines);
while (X < context->Header.width) {
guchar Pix;
@@ -1010,16 +1015,15 @@ static void OneLine1(struct bmp_progressive_state *context)
{
gint X;
guchar *Pixels;
+ gint rowstride = gdk_pixbuf_get_rowstride (context->pixbuf);
X = 0;
if (context->Header.Negative == 0)
- Pixels = (context->pixbuf->pixels +
- context->pixbuf->rowstride *
- (context->Header.height - context->Lines - 1));
+ Pixels = (gdk_pixbuf_get_pixels (context->pixbuf) +
+ rowstride * (context->Header.height - context->Lines - 1));
else
- Pixels = (context->pixbuf->pixels +
- context->pixbuf->rowstride *
- context->Lines);
+ Pixels = (gdk_pixbuf_get_pixels (context->pixbuf) +
+ rowstride * context->Lines);
while (X < context->Header.width) {
gint Bit;
@@ -1138,8 +1142,8 @@ DoCompressed(struct bmp_progressive_state *context, GError **error)
case END_OF_LINE:
context->compr.x = 0;
context->compr.y++;
- context->compr.p = context->pixbuf->pixels
- + (context->pixbuf->rowstride * (context->Header.height - context->compr.y - 1))
+ context->compr.p = gdk_pixbuf_get_pixels (context->pixbuf)
+ + (gdk_pixbuf_get_rowstride (context->pixbuf) * (context->Header.height - context->compr.y - 1))
+ (4 * context->compr.x);
context->compr.phase = NEUTRAL;
break;
@@ -1164,8 +1168,8 @@ DoCompressed(struct bmp_progressive_state *context, GError **error)
break;
case DELTA_Y:
context->compr.y += c;
- context->compr.p = context->pixbuf->pixels
- + (context->pixbuf->rowstride * (context->Header.height - context->compr.y - 1))
+ context->compr.p = gdk_pixbuf_get_pixels (context->pixbuf)
+ + (gdk_pixbuf_get_rowstride (context->pixbuf) * (context->Header.height - context->compr.y - 1))
+ (4 * context->compr.x);
context->compr.phase = NEUTRAL;
break;