summaryrefslogtreecommitdiff
path: root/apps/win_main.c
diff options
context:
space:
mode:
authorRobin Watts <robin.watts@artifex.com>2012-03-02 14:13:05 +0000
committerRobin Watts <robin.watts@artifex.com>2012-03-06 21:34:51 +0000
commitd55162d649a12d62a1d1c738d99ca9dee7de575d (patch)
tree56b2de5557048a0601a8d9514cae76f018f8863f /apps/win_main.c
parenta14bb1748d3827e542fbff47488f67e0dfa3b15d (diff)
downloadmupdf-d55162d649a12d62a1d1c738d99ca9dee7de575d.tar.xz
Split fitz.h/mupdf.h into internal/external headers.
Attempt to separate public API from internal functions.
Diffstat (limited to 'apps/win_main.c')
-rw-r--r--apps/win_main.c27
1 files changed, 16 insertions, 11 deletions
diff --git a/apps/win_main.c b/apps/win_main.c
index c87faa97..1052ccdd 100644
--- a/apps/win_main.c
+++ b/apps/win_main.c
@@ -355,10 +355,15 @@ void winblitsearch()
void winblit()
{
+ fz_bbox bb = fz_bound_pixmap(gapp.image);
+ int image_w = bb.x1-bb.x0;
+ int image_h = bb.y1-bb.y0;
+ int image_n = fz_pixmap_components(context, gapp.image);
+ unsigned char *samples = fz_pixmap_pixels(context, gapp.image);
int x0 = gapp.panx;
int y0 = gapp.pany;
- int x1 = gapp.panx + gapp.image->w;
- int y1 = gapp.pany + gapp.image->h;
+ int x1 = gapp.panx + image_w;
+ int y1 = gapp.pany + image_h;
RECT r;
if (gapp.image)
@@ -371,15 +376,15 @@ void winblit()
pdfapp_inverthit(&gapp);
- dibinf->bmiHeader.biWidth = gapp.image->w;
- dibinf->bmiHeader.biHeight = -gapp.image->h;
- dibinf->bmiHeader.biSizeImage = gapp.image->h * 4;
+ dibinf->bmiHeader.biWidth = image_w;
+ dibinf->bmiHeader.biHeight = -image_h;
+ dibinf->bmiHeader.biSizeImage = image_h * 4;
if (gapp.image->n == 2)
{
- int i = gapp.image->w * gapp.image->h;
+ int i = image_w * image_h;
unsigned char *color = malloc(i*4);
- unsigned char *s = gapp.image->samples;
+ unsigned char *s = samples;
unsigned char *d = color;
for (; i > 0 ; i--)
{
@@ -388,16 +393,16 @@ void winblit()
d += 4;
}
SetDIBitsToDevice(hdc,
- gapp.panx, gapp.pany, gapp.image->w, gapp.image->h,
- 0, 0, 0, gapp.image->h, color,
+ gapp.panx, gapp.pany, image_w, image_h,
+ 0, 0, 0, image_h, color,
dibinf, DIB_RGB_COLORS);
free(color);
}
if (gapp.image->n == 4)
{
SetDIBitsToDevice(hdc,
- gapp.panx, gapp.pany, gapp.image->w, gapp.image->h,
- 0, 0, 0, gapp.image->h, gapp.image->samples,
+ gapp.panx, gapp.pany, image_w, image_h,
+ 0, 0, 0, image_h, samples,
dibinf, DIB_RGB_COLORS);
}