Mercurial > dwindows
comparison win/dw.c @ 243:3c1e39905f2f
Use GetObject() instead of GetBitmapDimensionEx() to get the loaded bitmap
size.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Wed, 19 Feb 2003 06:37:24 +0000 |
parents | 36013ddd3f5b |
children | c097ffe6cfeb |
comparison
equal
deleted
inserted
replaced
242:36013ddd3f5b | 243:3c1e39905f2f |
---|---|
6696 HPIXMAP API dw_pixmap_new_from_file(HWND handle, char *filename) | 6696 HPIXMAP API dw_pixmap_new_from_file(HWND handle, char *filename) |
6697 { | 6697 { |
6698 HPIXMAP pixmap; | 6698 HPIXMAP pixmap; |
6699 BITMAP bm; | 6699 BITMAP bm; |
6700 HDC hdc; | 6700 HDC hdc; |
6701 SIZE sz; | |
6702 char *file = malloc(strlen(filename) + 5); | 6701 char *file = malloc(strlen(filename) + 5); |
6703 | 6702 |
6704 if (!file || !(pixmap = calloc(1,sizeof(struct _hpixmap)))) | 6703 if (!file || !(pixmap = calloc(1,sizeof(struct _hpixmap)))) |
6705 { | 6704 { |
6706 if(file) | 6705 if(file) |
6736 return NULL; | 6735 return NULL; |
6737 } | 6736 } |
6738 | 6737 |
6739 pixmap->hdc = CreateCompatibleDC(hdc); | 6738 pixmap->hdc = CreateCompatibleDC(hdc); |
6740 | 6739 |
6741 GetBitmapDimensionEx(pixmap->hbm, &sz); | 6740 GetObject(pixmap->hbm, sizeof(bm), &bm); |
6742 | 6741 |
6743 pixmap->width = sz.cx; pixmap->height = sz.cy; | 6742 pixmap->width = bm.bmWidth; pixmap->height = bm.bmHeight; |
6744 | 6743 |
6745 SelectObject(pixmap->hdc, pixmap->hbm); | 6744 SelectObject(pixmap->hdc, pixmap->hbm); |
6746 | 6745 |
6747 ReleaseDC(handle, hdc); | 6746 ReleaseDC(handle, hdc); |
6748 | 6747 |