Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
1aea88ca
Commit
1aea88ca
authored
Dec 26, 2009
by
Vincent Povirk
Committed by
Alexandre Julliard
Dec 28, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdiplus: Implement GdipGetImage*Resolution.
parent
f71cb580
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
44 additions
and
22 deletions
+44
-22
gdiplus_private.h
dlls/gdiplus/gdiplus_private.h
+1
-0
graphics.c
dlls/gdiplus/graphics.c
+2
-0
image.c
dlls/gdiplus/image.c
+29
-10
image.c
dlls/gdiplus/tests/image.c
+12
-12
No files found.
dlls/gdiplus/gdiplus_private.h
View file @
1aea88ca
...
...
@@ -219,6 +219,7 @@ struct GpImage{
UINT
palette_count
;
UINT
palette_size
;
ARGB
*
palette_entries
;
REAL
xres
,
yres
;
};
struct
GpMetafile
{
...
...
dlls/gdiplus/graphics.c
View file @
1aea88ca
...
...
@@ -1262,6 +1262,8 @@ GpStatus WINGDIPAPI GdipCreateMetafileFromWmf(HMETAFILE hwmf, BOOL delete,
(
*
metafile
)
->
image
.
palette_count
=
0
;
(
*
metafile
)
->
image
.
palette_size
=
0
;
(
*
metafile
)
->
image
.
palette_entries
=
NULL
;
(
*
metafile
)
->
image
.
xres
=
(
REAL
)
placeable
->
Inch
;
(
*
metafile
)
->
image
.
yres
=
(
REAL
)
placeable
->
Inch
;
(
*
metafile
)
->
bounds
.
X
=
((
REAL
)
placeable
->
BoundingBox
.
Left
)
/
((
REAL
)
placeable
->
Inch
);
(
*
metafile
)
->
bounds
.
Y
=
((
REAL
)
placeable
->
BoundingBox
.
Top
)
/
((
REAL
)
placeable
->
Inch
);
(
*
metafile
)
->
bounds
.
Width
=
((
REAL
)
(
placeable
->
BoundingBox
.
Right
...
...
dlls/gdiplus/image.c
View file @
1aea88ca
...
...
@@ -1172,6 +1172,20 @@ static void generate_halftone_palette(ARGB *entries, UINT count)
}
}
static
GpStatus
get_screen_resolution
(
REAL
*
xres
,
REAL
*
yres
)
{
HDC
screendc
=
GetDC
(
0
);
if
(
!
screendc
)
return
GenericError
;
*
xres
=
(
REAL
)
GetDeviceCaps
(
screendc
,
LOGPIXELSX
);
*
yres
=
(
REAL
)
GetDeviceCaps
(
screendc
,
LOGPIXELSY
);
ReleaseDC
(
0
,
screendc
);
return
Ok
;
}
GpStatus
WINGDIPAPI
GdipCreateBitmapFromScan0
(
INT
width
,
INT
height
,
INT
stride
,
PixelFormat
format
,
BYTE
*
scan0
,
GpBitmap
**
bitmap
)
{
...
...
@@ -1181,6 +1195,8 @@ GpStatus WINGDIPAPI GdipCreateBitmapFromScan0(INT width, INT height, INT stride,
HDC
hdc
;
BYTE
*
bits
;
int
i
;
REAL
xres
,
yres
;
GpStatus
stat
;
TRACE
(
"%d %d %d %d %p %p
\n
"
,
width
,
height
,
stride
,
format
,
scan0
,
bitmap
);
...
...
@@ -1194,6 +1210,9 @@ GpStatus WINGDIPAPI GdipCreateBitmapFromScan0(INT width, INT height, INT stride,
if
(
scan0
&&
!
stride
)
return
InvalidParameter
;
stat
=
get_screen_resolution
(
&
xres
,
&
yres
);
if
(
stat
!=
Ok
)
return
stat
;
row_size
=
(
width
*
PIXELFORMATBPP
(
format
)
+
7
)
/
8
;
dib_stride
=
(
row_size
+
3
)
&
~
3
;
...
...
@@ -1243,6 +1262,8 @@ GpStatus WINGDIPAPI GdipCreateBitmapFromScan0(INT width, INT height, INT stride,
(
*
bitmap
)
->
image
.
palette_count
=
0
;
(
*
bitmap
)
->
image
.
palette_size
=
0
;
(
*
bitmap
)
->
image
.
palette_entries
=
NULL
;
(
*
bitmap
)
->
image
.
xres
=
xres
;
(
*
bitmap
)
->
image
.
yres
=
yres
;
(
*
bitmap
)
->
width
=
width
;
(
*
bitmap
)
->
height
=
height
;
(
*
bitmap
)
->
format
=
format
;
...
...
@@ -1522,15 +1543,14 @@ GpStatus WINGDIPAPI GdipGetImageHeight(GpImage *image, UINT *height)
GpStatus
WINGDIPAPI
GdipGetImageHorizontalResolution
(
GpImage
*
image
,
REAL
*
res
)
{
static
int
calls
;
if
(
!
image
||
!
res
)
return
InvalidParameter
;
if
(
!
(
calls
++
))
FIXME
(
"not implemented
\n
"
);
*
res
=
image
->
xres
;
return
NotImplemented
;
TRACE
(
"(%p) <-- %0.2f
\n
"
,
image
,
*
res
);
return
Ok
;
}
GpStatus
WINGDIPAPI
GdipGetImagePaletteSize
(
GpImage
*
image
,
INT
*
size
)
...
...
@@ -1590,15 +1610,14 @@ GpStatus WINGDIPAPI GdipGetImageType(GpImage *image, ImageType *type)
GpStatus
WINGDIPAPI
GdipGetImageVerticalResolution
(
GpImage
*
image
,
REAL
*
res
)
{
static
int
calls
;
if
(
!
image
||
!
res
)
return
InvalidParameter
;
if
(
!
(
calls
++
))
FIXME
(
"not implemented
\n
"
);
*
res
=
image
->
yres
;
return
NotImplemented
;
TRACE
(
"(%p) <-- %0.2f
\n
"
,
image
,
*
res
);
return
Ok
;
}
GpStatus
WINGDIPAPI
GdipGetImageWidth
(
GpImage
*
image
,
UINT
*
width
)
...
...
dlls/gdiplus/tests/image.c
View file @
1aea88ca
...
...
@@ -843,11 +843,11 @@ static void test_loadwmf(void)
todo_wine
expectf
(
320
.
0
,
bounds
.
Height
);
stat
=
GdipGetImageHorizontalResolution
(
img
,
&
res
);
todo_wine
expect
(
Ok
,
stat
);
expect
(
Ok
,
stat
);
todo_wine
expectf
(
1440
.
0
,
res
);
stat
=
GdipGetImageVerticalResolution
(
img
,
&
res
);
todo_wine
expect
(
Ok
,
stat
);
expect
(
Ok
,
stat
);
todo_wine
expectf
(
1440
.
0
,
res
);
GdipDisposeImage
(
img
);
...
...
@@ -879,12 +879,12 @@ static void test_createfromwmf(void)
todo_wine
expectf
(
320
.
0
,
bounds
.
Height
);
stat
=
GdipGetImageHorizontalResolution
(
img
,
&
res
);
todo_wine
expect
(
Ok
,
stat
);
todo_wine
expectf
(
1440
.
0
,
res
);
expect
(
Ok
,
stat
);
expectf
(
1440
.
0
,
res
);
stat
=
GdipGetImageVerticalResolution
(
img
,
&
res
);
todo_wine
expect
(
Ok
,
stat
);
todo_wine
expectf
(
1440
.
0
,
res
);
expect
(
Ok
,
stat
);
expectf
(
1440
.
0
,
res
);
GdipDisposeImage
(
img
);
}
...
...
@@ -929,23 +929,23 @@ static void test_resolution(void)
ReleaseDC
(
0
,
screendc
);
stat
=
GdipGetImageHorizontalResolution
((
GpImage
*
)
bitmap
,
&
res
);
todo_wine
expect
(
Ok
,
stat
);
todo_wine
expectf
((
REAL
)
screenxres
,
res
);
expect
(
Ok
,
stat
);
expectf
((
REAL
)
screenxres
,
res
);
stat
=
GdipGetImageVerticalResolution
((
GpImage
*
)
bitmap
,
&
res
);
todo_wine
expect
(
Ok
,
stat
);
todo_wine
expectf
((
REAL
)
screenyres
,
res
);
expect
(
Ok
,
stat
);
expectf
((
REAL
)
screenyres
,
res
);
/* test changing the resolution */
stat
=
GdipBitmapSetResolution
(
bitmap
,
screenxres
*
2
.
0
,
screenyres
*
3
.
0
);
todo_wine
expect
(
Ok
,
stat
);
stat
=
GdipGetImageHorizontalResolution
((
GpImage
*
)
bitmap
,
&
res
);
todo_wine
expect
(
Ok
,
stat
);
expect
(
Ok
,
stat
);
todo_wine
expectf
(
screenxres
*
2
.
0
,
res
);
stat
=
GdipGetImageVerticalResolution
((
GpImage
*
)
bitmap
,
&
res
);
todo_wine
expect
(
Ok
,
stat
);
expect
(
Ok
,
stat
);
todo_wine
expectf
(
screenyres
*
3
.
0
,
res
);
stat
=
GdipDisposeImage
((
GpImage
*
)
bitmap
);
...
...
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