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
30f98340
Commit
30f98340
authored
Jun 13, 2014
by
Vincent Povirk
Committed by
Alexandre Julliard
Jun 16, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
windowscodecs: Share WriteSource code between implementations.
parent
a270ed90
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
130 additions
and
269 deletions
+130
-269
bmpencode.c
dlls/windowscodecs/bmpencode.c
+8
-49
icnsformat.c
dlls/windowscodecs/icnsformat.c
+7
-51
jpegformat.c
dlls/windowscodecs/jpegformat.c
+6
-56
main.c
dlls/windowscodecs/main.c
+86
-0
pngformat.c
dlls/windowscodecs/pngformat.c
+6
-56
tiffformat.c
dlls/windowscodecs/tiffformat.c
+7
-57
wincodecs_private.h
dlls/windowscodecs/wincodecs_private.h
+10
-0
No files found.
dlls/windowscodecs/bmpencode.c
View file @
30f98340
...
@@ -260,63 +260,22 @@ static HRESULT WINAPI BmpFrameEncode_WriteSource(IWICBitmapFrameEncode *iface,
...
@@ -260,63 +260,22 @@ static HRESULT WINAPI BmpFrameEncode_WriteSource(IWICBitmapFrameEncode *iface,
{
{
BmpFrameEncode
*
This
=
impl_from_IWICBitmapFrameEncode
(
iface
);
BmpFrameEncode
*
This
=
impl_from_IWICBitmapFrameEncode
(
iface
);
HRESULT
hr
;
HRESULT
hr
;
WICRect
rc
;
WICPixelFormatGUID
guid
;
TRACE
(
"(%p,%p,%p)
\n
"
,
iface
,
pIBitmapSource
,
prc
);
TRACE
(
"(%p,%p,%p)
\n
"
,
iface
,
pIBitmapSource
,
prc
);
if
(
!
This
->
initialized
||
!
This
->
width
||
!
This
->
height
)
if
(
!
This
->
initialized
)
return
WINCODEC_ERR_WRONGSTATE
;
return
WINCODEC_ERR_WRONGSTATE
;
if
(
!
This
->
format
)
hr
=
configure_write_source
(
iface
,
pIBitmapSource
,
prc
,
{
This
->
format
?
This
->
format
->
guid
:
NULL
,
This
->
width
,
This
->
height
,
hr
=
IWICBitmapSource_GetPixelFormat
(
pIBitmapSource
,
&
guid
);
This
->
xres
,
This
->
yres
);
if
(
FAILED
(
hr
))
return
hr
;
hr
=
BmpFrameEncode_SetPixelFormat
(
iface
,
&
guid
);
if
(
FAILED
(
hr
))
return
hr
;
}
hr
=
IWICBitmapSource_GetPixelFormat
(
pIBitmapSource
,
&
guid
);
if
(
FAILED
(
hr
))
return
hr
;
if
(
memcmp
(
&
guid
,
This
->
format
->
guid
,
sizeof
(
GUID
))
!=
0
)
{
/* should use WICConvertBitmapSource to convert, but that's unimplemented */
ERR
(
"format %s unsupported
\n
"
,
debugstr_guid
(
&
guid
));
return
E_FAIL
;
}
if
(
This
->
xres
==
0
.
0
||
This
->
yres
==
0
.
0
)
{
double
xres
,
yres
;
hr
=
IWICBitmapSource_GetResolution
(
pIBitmapSource
,
&
xres
,
&
yres
);
if
(
FAILED
(
hr
))
return
hr
;
hr
=
BmpFrameEncode_SetResolution
(
iface
,
xres
,
yres
);
if
(
FAILED
(
hr
))
return
hr
;
}
if
(
!
prc
)
if
(
SUCCEEDED
(
hr
)
)
{
{
UINT
width
,
height
;
hr
=
write_source
(
iface
,
pIBitmapSource
,
prc
,
hr
=
IWICBitmapSource_GetSize
(
pIBitmapSource
,
&
width
,
&
height
);
This
->
format
->
guid
,
This
->
format
->
bpp
,
This
->
width
,
This
->
height
);
if
(
FAILED
(
hr
))
return
hr
;
rc
.
X
=
0
;
rc
.
Y
=
0
;
rc
.
Width
=
width
;
rc
.
Height
=
height
;
prc
=
&
rc
;
}
}
if
(
prc
->
Width
!=
This
->
width
)
return
E_INVALIDARG
;
return
hr
;
hr
=
BmpFrameEncode_AllocateBits
(
This
);
if
(
FAILED
(
hr
))
return
hr
;
hr
=
IWICBitmapSource_CopyPixels
(
pIBitmapSource
,
prc
,
This
->
stride
,
This
->
stride
*
(
This
->
height
-
This
->
lineswritten
),
This
->
bits
+
This
->
stride
*
This
->
lineswritten
);
This
->
lineswritten
+=
prc
->
Height
;
return
S_OK
;
}
}
static
HRESULT
WINAPI
BmpFrameEncode_Commit
(
IWICBitmapFrameEncode
*
iface
)
static
HRESULT
WINAPI
BmpFrameEncode_Commit
(
IWICBitmapFrameEncode
*
iface
)
...
...
dlls/windowscodecs/icnsformat.c
View file @
30f98340
...
@@ -391,66 +391,22 @@ static HRESULT WINAPI IcnsFrameEncode_WriteSource(IWICBitmapFrameEncode *iface,
...
@@ -391,66 +391,22 @@ static HRESULT WINAPI IcnsFrameEncode_WriteSource(IWICBitmapFrameEncode *iface,
{
{
IcnsFrameEncode
*
This
=
impl_from_IWICBitmapFrameEncode
(
iface
);
IcnsFrameEncode
*
This
=
impl_from_IWICBitmapFrameEncode
(
iface
);
HRESULT
hr
;
HRESULT
hr
;
WICRect
rc
;
WICPixelFormatGUID
guid
;
UINT
stride
;
BYTE
*
pixeldata
=
NULL
;
TRACE
(
"(%p,%p,%p)
\n
"
,
iface
,
pIBitmapSource
,
prc
);
TRACE
(
"(%p,%p,%p)
\n
"
,
iface
,
pIBitmapSource
,
prc
);
if
(
!
This
->
initialized
||
!
This
->
size
)
if
(
!
This
->
initialized
)
{
return
WINCODEC_ERR_WRONGSTATE
;
hr
=
WINCODEC_ERR_WRONGSTATE
;
goto
end
;
}
hr
=
IWICBitmapSource_GetPixelFormat
(
pIBitmapSource
,
&
guid
);
if
(
FAILED
(
hr
))
goto
end
;
if
(
!
IsEqualGUID
(
&
guid
,
&
GUID_WICPixelFormat32bppBGRA
))
{
FIXME
(
"format %s unsupported, could use WICConvertBitmapSource to convert
\n
"
,
debugstr_guid
(
&
guid
));
hr
=
E_FAIL
;
goto
end
;
}
if
(
!
prc
)
{
UINT
width
,
height
;
hr
=
IWICBitmapSource_GetSize
(
pIBitmapSource
,
&
width
,
&
height
);
if
(
FAILED
(
hr
))
goto
end
;
rc
.
X
=
0
;
rc
.
Y
=
0
;
rc
.
Width
=
width
;
rc
.
Height
=
height
;
prc
=
&
rc
;
}
if
(
prc
->
Width
!=
This
->
size
)
hr
=
configure_write_source
(
iface
,
pIBitmapSource
,
&
prc
,
{
&
GUID_WICPixelFormat32bppBGRA
,
This
->
size
,
This
->
size
,
hr
=
E_INVALIDARG
;
1
.
0
,
1
.
0
);
goto
end
;
}
stride
=
(
32
*
This
->
size
+
7
)
/
8
;
pixeldata
=
HeapAlloc
(
GetProcessHeap
(),
0
,
stride
*
prc
->
Height
);
if
(
!
pixeldata
)
{
hr
=
E_OUTOFMEMORY
;
goto
end
;
}
hr
=
IWICBitmapSource_CopyPixels
(
pIBitmapSource
,
prc
,
stride
,
stride
*
prc
->
Height
,
pixeldata
);
if
(
SUCCEEDED
(
hr
))
if
(
SUCCEEDED
(
hr
))
{
{
hr
=
IWICBitmapFrameEncode_WritePixels
(
iface
,
prc
->
Height
,
stride
,
hr
=
write_source
(
iface
,
pIBitmapSource
,
prc
,
stride
*
prc
->
Height
,
pixeldata
);
&
GUID_WICPixelFormat32bppBGRA
,
32
,
This
->
size
,
This
->
size
);
}
}
end:
HeapFree
(
GetProcessHeap
(),
0
,
pixeldata
);
return
hr
;
return
hr
;
}
}
...
...
dlls/windowscodecs/jpegformat.c
View file @
30f98340
...
@@ -1107,71 +1107,21 @@ static HRESULT WINAPI JpegEncoder_Frame_WriteSource(IWICBitmapFrameEncode *iface
...
@@ -1107,71 +1107,21 @@ static HRESULT WINAPI JpegEncoder_Frame_WriteSource(IWICBitmapFrameEncode *iface
{
{
JpegEncoder
*
This
=
impl_from_IWICBitmapFrameEncode
(
iface
);
JpegEncoder
*
This
=
impl_from_IWICBitmapFrameEncode
(
iface
);
HRESULT
hr
;
HRESULT
hr
;
WICRect
rc
;
WICPixelFormatGUID
guid
;
UINT
stride
;
BYTE
*
pixeldata
;
TRACE
(
"(%p,%p,%p)
\n
"
,
iface
,
pIBitmapSource
,
prc
);
TRACE
(
"(%p,%p,%p)
\n
"
,
iface
,
pIBitmapSource
,
prc
);
if
(
!
This
->
frame_initialized
||
!
This
->
width
||
!
This
->
height
)
if
(
!
This
->
frame_initialized
)
return
WINCODEC_ERR_WRONGSTATE
;
return
WINCODEC_ERR_WRONGSTATE
;
if
(
!
This
->
format
)
hr
=
configure_write_source
(
iface
,
pIBitmapSource
,
prc
,
{
This
->
format
?
This
->
format
->
guid
:
NULL
,
This
->
width
,
This
->
height
,
hr
=
IWICBitmapSource_GetPixelFormat
(
pIBitmapSource
,
&
guid
);
This
->
xres
,
This
->
yres
);
if
(
FAILED
(
hr
))
return
hr
;
hr
=
IWICBitmapFrameEncode_SetPixelFormat
(
iface
,
&
guid
);
if
(
FAILED
(
hr
))
return
hr
;
}
hr
=
IWICBitmapSource_GetPixelFormat
(
pIBitmapSource
,
&
guid
);
if
(
FAILED
(
hr
))
return
hr
;
if
(
memcmp
(
&
guid
,
This
->
format
->
guid
,
sizeof
(
GUID
))
!=
0
)
{
/* FIXME: should use WICConvertBitmapSource to convert */
ERR
(
"format %s unsupported
\n
"
,
debugstr_guid
(
&
guid
));
return
E_FAIL
;
}
if
(
This
->
xres
==
0
.
0
||
This
->
yres
==
0
.
0
)
{
double
xres
,
yres
;
hr
=
IWICBitmapSource_GetResolution
(
pIBitmapSource
,
&
xres
,
&
yres
);
if
(
FAILED
(
hr
))
return
hr
;
hr
=
IWICBitmapFrameEncode_SetResolution
(
iface
,
xres
,
yres
);
if
(
FAILED
(
hr
))
return
hr
;
}
if
(
!
prc
)
{
UINT
width
,
height
;
hr
=
IWICBitmapSource_GetSize
(
pIBitmapSource
,
&
width
,
&
height
);
if
(
FAILED
(
hr
))
return
hr
;
rc
.
X
=
0
;
rc
.
Y
=
0
;
rc
.
Width
=
width
;
rc
.
Height
=
height
;
prc
=
&
rc
;
}
if
(
prc
->
Width
!=
This
->
width
)
return
E_INVALIDARG
;
stride
=
(
This
->
format
->
bpp
*
This
->
width
+
7
)
/
8
;
pixeldata
=
HeapAlloc
(
GetProcessHeap
(),
0
,
stride
*
prc
->
Height
);
if
(
!
pixeldata
)
return
E_OUTOFMEMORY
;
hr
=
IWICBitmapSource_CopyPixels
(
pIBitmapSource
,
prc
,
stride
,
stride
*
prc
->
Height
,
pixeldata
);
if
(
SUCCEEDED
(
hr
))
if
(
SUCCEEDED
(
hr
))
{
{
hr
=
IWICBitmapFrameEncode_WritePixels
(
iface
,
prc
->
Height
,
stride
,
hr
=
write_source
(
iface
,
pIBitmapSource
,
prc
,
stride
*
prc
->
Height
,
pixeldata
);
This
->
format
->
guid
,
This
->
format
->
bpp
,
This
->
width
,
This
->
height
);
}
}
HeapFree
(
GetProcessHeap
(),
0
,
pixeldata
);
return
hr
;
return
hr
;
}
}
...
...
dlls/windowscodecs/main.c
View file @
30f98340
...
@@ -118,6 +118,92 @@ HRESULT copy_pixels(UINT bpp, const BYTE *srcbuffer,
...
@@ -118,6 +118,92 @@ HRESULT copy_pixels(UINT bpp, const BYTE *srcbuffer,
}
}
}
}
HRESULT
configure_write_source
(
IWICBitmapFrameEncode
*
iface
,
IWICBitmapSource
*
source
,
const
WICRect
*
prc
,
const
WICPixelFormatGUID
*
format
,
INT
width
,
INT
height
,
double
xres
,
double
yres
)
{
HRESULT
hr
=
S_OK
;
WICPixelFormatGUID
src_format
,
dst_format
;
if
(
width
==
0
||
height
==
0
)
return
WINCODEC_ERR_WRONGSTATE
;
hr
=
IWICBitmapSource_GetPixelFormat
(
source
,
&
src_format
);
if
(
FAILED
(
hr
))
return
hr
;
if
(
!
format
)
{
dst_format
=
src_format
;
hr
=
IWICBitmapFrameEncode_SetPixelFormat
(
iface
,
&
dst_format
);
if
(
FAILED
(
hr
))
return
hr
;
format
=
&
dst_format
;
}
if
(
!
IsEqualGUID
(
&
src_format
,
format
))
{
/* FIXME: should use WICConvertBitmapSource to convert */
ERR
(
"format %s unsupported
\n
"
,
debugstr_guid
(
&
src_format
));
return
E_FAIL
;
}
if
(
xres
==
0
.
0
||
yres
==
0
.
0
)
{
hr
=
IWICBitmapSource_GetResolution
(
source
,
&
xres
,
&
yres
);
if
(
FAILED
(
hr
))
return
hr
;
hr
=
IWICBitmapFrameEncode_SetResolution
(
iface
,
xres
,
yres
);
if
(
FAILED
(
hr
))
return
hr
;
}
return
hr
;
}
HRESULT
write_source
(
IWICBitmapFrameEncode
*
iface
,
IWICBitmapSource
*
source
,
const
WICRect
*
prc
,
const
WICPixelFormatGUID
*
format
,
UINT
bpp
,
INT
width
,
INT
height
)
{
HRESULT
hr
=
S_OK
;
WICRect
rc
;
UINT
stride
;
BYTE
*
pixeldata
;
if
(
!
prc
)
{
UINT
src_width
,
src_height
;
hr
=
IWICBitmapSource_GetSize
(
source
,
&
src_width
,
&
src_height
);
if
(
FAILED
(
hr
))
return
hr
;
rc
.
X
=
0
;
rc
.
Y
=
0
;
rc
.
Width
=
src_width
;
rc
.
Height
=
src_height
;
prc
=
&
rc
;
}
if
(
prc
->
Width
!=
width
)
return
E_INVALIDARG
;
stride
=
(
bpp
*
width
+
7
)
/
8
;
pixeldata
=
HeapAlloc
(
GetProcessHeap
(),
0
,
stride
*
prc
->
Height
);
if
(
!
pixeldata
)
return
E_OUTOFMEMORY
;
hr
=
IWICBitmapSource_CopyPixels
(
source
,
prc
,
stride
,
stride
*
prc
->
Height
,
pixeldata
);
if
(
SUCCEEDED
(
hr
))
{
hr
=
IWICBitmapFrameEncode_WritePixels
(
iface
,
prc
->
Height
,
stride
,
stride
*
prc
->
Height
,
pixeldata
);
}
HeapFree
(
GetProcessHeap
(),
0
,
pixeldata
);
return
hr
;
}
void
reverse_bgr8
(
UINT
bytesperpixel
,
LPBYTE
bits
,
UINT
width
,
UINT
height
,
INT
stride
)
void
reverse_bgr8
(
UINT
bytesperpixel
,
LPBYTE
bits
,
UINT
width
,
UINT
height
,
INT
stride
)
{
{
UINT
x
,
y
;
UINT
x
,
y
;
...
...
dlls/windowscodecs/pngformat.c
View file @
30f98340
...
@@ -1304,71 +1304,21 @@ static HRESULT WINAPI PngFrameEncode_WriteSource(IWICBitmapFrameEncode *iface,
...
@@ -1304,71 +1304,21 @@ static HRESULT WINAPI PngFrameEncode_WriteSource(IWICBitmapFrameEncode *iface,
{
{
PngEncoder
*
This
=
impl_from_IWICBitmapFrameEncode
(
iface
);
PngEncoder
*
This
=
impl_from_IWICBitmapFrameEncode
(
iface
);
HRESULT
hr
;
HRESULT
hr
;
WICRect
rc
;
WICPixelFormatGUID
guid
;
UINT
stride
;
BYTE
*
pixeldata
;
TRACE
(
"(%p,%p,%p)
\n
"
,
iface
,
pIBitmapSource
,
prc
);
TRACE
(
"(%p,%p,%p)
\n
"
,
iface
,
pIBitmapSource
,
prc
);
if
(
!
This
->
frame_initialized
||
!
This
->
width
||
!
This
->
height
)
if
(
!
This
->
frame_initialized
)
return
WINCODEC_ERR_WRONGSTATE
;
return
WINCODEC_ERR_WRONGSTATE
;
if
(
!
This
->
format
)
hr
=
configure_write_source
(
iface
,
pIBitmapSource
,
prc
,
{
This
->
format
?
This
->
format
->
guid
:
NULL
,
This
->
width
,
This
->
height
,
hr
=
IWICBitmapSource_GetPixelFormat
(
pIBitmapSource
,
&
guid
);
This
->
xres
,
This
->
yres
);
if
(
FAILED
(
hr
))
return
hr
;
hr
=
IWICBitmapFrameEncode_SetPixelFormat
(
iface
,
&
guid
);
if
(
FAILED
(
hr
))
return
hr
;
}
hr
=
IWICBitmapSource_GetPixelFormat
(
pIBitmapSource
,
&
guid
);
if
(
FAILED
(
hr
))
return
hr
;
if
(
memcmp
(
&
guid
,
This
->
format
->
guid
,
sizeof
(
GUID
))
!=
0
)
{
/* FIXME: should use WICConvertBitmapSource to convert */
ERR
(
"format %s unsupported
\n
"
,
debugstr_guid
(
&
guid
));
return
E_FAIL
;
}
if
(
This
->
xres
==
0
.
0
||
This
->
yres
==
0
.
0
)
{
double
xres
,
yres
;
hr
=
IWICBitmapSource_GetResolution
(
pIBitmapSource
,
&
xres
,
&
yres
);
if
(
FAILED
(
hr
))
return
hr
;
hr
=
IWICBitmapFrameEncode_SetResolution
(
iface
,
xres
,
yres
);
if
(
FAILED
(
hr
))
return
hr
;
}
if
(
!
prc
)
{
UINT
width
,
height
;
hr
=
IWICBitmapSource_GetSize
(
pIBitmapSource
,
&
width
,
&
height
);
if
(
FAILED
(
hr
))
return
hr
;
rc
.
X
=
0
;
rc
.
Y
=
0
;
rc
.
Width
=
width
;
rc
.
Height
=
height
;
prc
=
&
rc
;
}
if
(
prc
->
Width
!=
This
->
width
)
return
E_INVALIDARG
;
stride
=
(
This
->
format
->
bpp
*
This
->
width
+
7
)
/
8
;
pixeldata
=
HeapAlloc
(
GetProcessHeap
(),
0
,
stride
*
prc
->
Height
);
if
(
!
pixeldata
)
return
E_OUTOFMEMORY
;
hr
=
IWICBitmapSource_CopyPixels
(
pIBitmapSource
,
prc
,
stride
,
stride
*
prc
->
Height
,
pixeldata
);
if
(
SUCCEEDED
(
hr
))
if
(
SUCCEEDED
(
hr
))
{
{
hr
=
IWICBitmapFrameEncode_WritePixels
(
iface
,
prc
->
Height
,
stride
,
hr
=
write_source
(
iface
,
pIBitmapSource
,
prc
,
stride
*
prc
->
Height
,
pixeldata
);
This
->
format
->
guid
,
This
->
format
->
bpp
,
This
->
width
,
This
->
height
);
}
}
HeapFree
(
GetProcessHeap
(),
0
,
pixeldata
);
return
hr
;
return
hr
;
}
}
...
...
dlls/windowscodecs/tiffformat.c
View file @
30f98340
...
@@ -1653,73 +1653,23 @@ static HRESULT WINAPI TiffFrameEncode_WriteSource(IWICBitmapFrameEncode *iface,
...
@@ -1653,73 +1653,23 @@ static HRESULT WINAPI TiffFrameEncode_WriteSource(IWICBitmapFrameEncode *iface,
{
{
TiffFrameEncode
*
This
=
impl_from_IWICBitmapFrameEncode
(
iface
);
TiffFrameEncode
*
This
=
impl_from_IWICBitmapFrameEncode
(
iface
);
HRESULT
hr
;
HRESULT
hr
;
WICRect
rc
;
WICPixelFormatGUID
guid
;
UINT
stride
;
BYTE
*
pixeldata
;
TRACE
(
"(%p,%p,%p)
\n
"
,
iface
,
pIBitmapSource
,
prc
);
TRACE
(
"(%p,%p,%p)
\n
"
,
iface
,
pIBitmapSource
,
prc
);
if
(
!
This
->
initialized
||
!
This
->
width
||
!
This
->
height
)
if
(
!
This
->
initialized
)
return
WINCODEC_ERR_WRONGSTATE
;
return
WINCODEC_ERR_WRONGSTATE
;
if
(
!
This
->
format
)
hr
=
configure_write_source
(
iface
,
pIBitmapSource
,
prc
,
{
This
->
format
?
This
->
format
->
guid
:
NULL
,
This
->
width
,
This
->
height
,
hr
=
IWICBitmapSource_GetPixelFormat
(
pIBitmapSource
,
&
guid
);
This
->
xres
,
This
->
yres
);
if
(
FAILED
(
hr
))
return
hr
;
hr
=
IWICBitmapFrameEncode_SetPixelFormat
(
iface
,
&
guid
);
if
(
FAILED
(
hr
))
return
hr
;
}
hr
=
IWICBitmapSource_GetPixelFormat
(
pIBitmapSource
,
&
guid
);
if
(
FAILED
(
hr
))
return
hr
;
if
(
memcmp
(
&
guid
,
This
->
format
->
guid
,
sizeof
(
GUID
))
!=
0
)
{
/* FIXME: should use WICConvertBitmapSource to convert */
ERR
(
"format %s unsupported
\n
"
,
debugstr_guid
(
&
guid
));
return
E_FAIL
;
}
if
(
This
->
xres
==
0
.
0
||
This
->
yres
==
0
.
0
)
{
double
xres
,
yres
;
hr
=
IWICBitmapSource_GetResolution
(
pIBitmapSource
,
&
xres
,
&
yres
);
if
(
FAILED
(
hr
))
return
hr
;
hr
=
IWICBitmapFrameEncode_SetResolution
(
iface
,
xres
,
yres
);
if
(
FAILED
(
hr
))
return
hr
;
}
if
(
!
prc
)
{
UINT
width
,
height
;
hr
=
IWICBitmapSource_GetSize
(
pIBitmapSource
,
&
width
,
&
height
);
if
(
FAILED
(
hr
))
return
hr
;
rc
.
X
=
0
;
rc
.
Y
=
0
;
rc
.
Width
=
width
;
rc
.
Height
=
height
;
prc
=
&
rc
;
}
if
(
prc
->
Width
!=
This
->
width
)
return
E_INVALIDARG
;
stride
=
(
This
->
format
->
bpp
*
This
->
width
+
7
)
/
8
;
pixeldata
=
HeapAlloc
(
GetProcessHeap
(),
0
,
stride
*
prc
->
Height
);
if
(
!
pixeldata
)
return
E_OUTOFMEMORY
;
hr
=
IWICBitmapSource_CopyPixels
(
pIBitmapSource
,
prc
,
stride
,
stride
*
prc
->
Height
,
pixeldata
);
if
(
SUCCEEDED
(
hr
))
if
(
SUCCEEDED
(
hr
))
{
{
hr
=
IWICBitmapFrameEncode_WritePixels
(
iface
,
prc
->
Height
,
stride
,
hr
=
write_source
(
iface
,
pIBitmapSource
,
prc
,
stride
*
prc
->
Height
,
pixeldata
);
This
->
format
->
guid
,
This
->
format
->
bpp
,
This
->
width
,
This
->
height
);
}
}
HeapFree
(
GetProcessHeap
(),
0
,
pixeldata
);
return
hr
;
return
S_OK
;
}
}
static
HRESULT
WINAPI
TiffFrameEncode_Commit
(
IWICBitmapFrameEncode
*
iface
)
static
HRESULT
WINAPI
TiffFrameEncode_Commit
(
IWICBitmapFrameEncode
*
iface
)
...
...
dlls/windowscodecs/wincodecs_private.h
View file @
30f98340
...
@@ -99,6 +99,16 @@ extern HRESULT copy_pixels(UINT bpp, const BYTE *srcbuffer,
...
@@ -99,6 +99,16 @@ extern HRESULT copy_pixels(UINT bpp, const BYTE *srcbuffer,
UINT
srcwidth
,
UINT
srcheight
,
INT
srcstride
,
UINT
srcwidth
,
UINT
srcheight
,
INT
srcstride
,
const
WICRect
*
rc
,
UINT
dststride
,
UINT
dstbuffersize
,
BYTE
*
dstbuffer
)
DECLSPEC_HIDDEN
;
const
WICRect
*
rc
,
UINT
dststride
,
UINT
dstbuffersize
,
BYTE
*
dstbuffer
)
DECLSPEC_HIDDEN
;
extern
HRESULT
configure_write_source
(
IWICBitmapFrameEncode
*
iface
,
IWICBitmapSource
*
source
,
const
WICRect
*
prc
,
const
WICPixelFormatGUID
*
format
,
INT
width
,
INT
height
,
double
xres
,
double
yres
)
DECLSPEC_HIDDEN
;
extern
HRESULT
write_source
(
IWICBitmapFrameEncode
*
iface
,
IWICBitmapSource
*
source
,
const
WICRect
*
prc
,
const
WICPixelFormatGUID
*
format
,
UINT
bpp
,
INT
width
,
INT
height
)
DECLSPEC_HIDDEN
;
extern
void
reverse_bgr8
(
UINT
bytesperpixel
,
LPBYTE
bits
,
UINT
width
,
UINT
height
,
INT
stride
)
DECLSPEC_HIDDEN
;
extern
void
reverse_bgr8
(
UINT
bytesperpixel
,
LPBYTE
bits
,
UINT
width
,
UINT
height
,
INT
stride
)
DECLSPEC_HIDDEN
;
extern
HRESULT
get_pixelformat_bpp
(
const
GUID
*
pixelformat
,
UINT
*
bpp
)
DECLSPEC_HIDDEN
;
extern
HRESULT
get_pixelformat_bpp
(
const
GUID
*
pixelformat
,
UINT
*
bpp
)
DECLSPEC_HIDDEN
;
...
...
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