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
682ea785
Commit
682ea785
authored
Jul 19, 2013
by
Nikolay Sivov
Committed by
Alexandre Julliard
Jul 19, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
windowscodecs: Implement Initialize() and GetSize() for bitmap clipper.
parent
5d4c614c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
96 additions
and
5 deletions
+96
-5
clipper.c
dlls/windowscodecs/clipper.c
+55
-5
bitmap.c
dlls/windowscodecs/tests/bitmap.c
+41
-0
No files found.
dlls/windowscodecs/clipper.c
View file @
682ea785
...
...
@@ -34,6 +34,9 @@ WINE_DEFAULT_DEBUG_CHANNEL(wincodecs);
typedef
struct
BitmapClipper
{
IWICBitmapClipper
IWICBitmapClipper_iface
;
LONG
ref
;
IWICBitmapSource
*
source
;
WICRect
rect
;
CRITICAL_SECTION
lock
;
/* must be held when initialized */
}
BitmapClipper
;
static
inline
BitmapClipper
*
impl_from_IWICBitmapClipper
(
IWICBitmapClipper
*
iface
)
...
...
@@ -84,6 +87,9 @@ static ULONG WINAPI BitmapClipper_Release(IWICBitmapClipper *iface)
if
(
ref
==
0
)
{
This
->
lock
.
DebugInfo
->
Spare
[
0
]
=
0
;
DeleteCriticalSection
(
&
This
->
lock
);
if
(
This
->
source
)
IWICBitmapSource_Release
(
This
->
source
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
}
...
...
@@ -91,10 +97,22 @@ static ULONG WINAPI BitmapClipper_Release(IWICBitmapClipper *iface)
}
static
HRESULT
WINAPI
BitmapClipper_GetSize
(
IWICBitmapClipper
*
iface
,
UINT
*
puiWidth
,
UINT
*
puiH
eight
)
UINT
*
width
,
UINT
*
h
eight
)
{
FIXME
(
"(%p,%p,%p): stub
\n
"
,
iface
,
puiWidth
,
puiHeight
);
return
E_NOTIMPL
;
BitmapClipper
*
This
=
impl_from_IWICBitmapClipper
(
iface
);
TRACE
(
"(%p,%p,%p)
\n
"
,
iface
,
width
,
height
);
if
(
!
width
||
!
height
)
return
E_INVALIDARG
;
if
(
!
This
->
source
)
return
WINCODEC_ERR_WRONGSTATE
;
*
width
=
This
->
rect
.
Width
;
*
height
=
This
->
rect
.
Height
;
return
S_OK
;
}
static
HRESULT
WINAPI
BitmapClipper_GetPixelFormat
(
IWICBitmapClipper
*
iface
,
...
...
@@ -128,8 +146,37 @@ static HRESULT WINAPI BitmapClipper_CopyPixels(IWICBitmapClipper *iface,
static
HRESULT
WINAPI
BitmapClipper_Initialize
(
IWICBitmapClipper
*
iface
,
IWICBitmapSource
*
source
,
const
WICRect
*
rc
)
{
FIXME
(
"(%p,%p,%p): stub
\n
"
,
iface
,
source
,
rc
);
return
E_NOTIMPL
;
BitmapClipper
*
This
=
impl_from_IWICBitmapClipper
(
iface
);
UINT
width
,
height
;
HRESULT
hr
=
S_OK
;
TRACE
(
"(%p,%p,%p)
\n
"
,
iface
,
source
,
rc
);
EnterCriticalSection
(
&
This
->
lock
);
if
(
This
->
source
)
{
hr
=
WINCODEC_ERR_WRONGSTATE
;
goto
end
;
}
hr
=
IWICBitmapSource_GetSize
(
source
,
&
width
,
&
height
);
if
(
FAILED
(
hr
))
goto
end
;
if
((
rc
->
X
+
rc
->
Width
>
width
)
||
(
rc
->
Y
+
rc
->
Height
>
height
))
{
hr
=
E_INVALIDARG
;
goto
end
;
}
This
->
rect
=
*
rc
;
This
->
source
=
source
;
IWICBitmapSource_AddRef
(
This
->
source
);
end:
LeaveCriticalSection
(
&
This
->
lock
);
return
hr
;
}
static
const
IWICBitmapClipperVtbl
BitmapClipper_Vtbl
=
{
...
...
@@ -153,6 +200,9 @@ HRESULT BitmapClipper_Create(IWICBitmapClipper **clipper)
This
->
IWICBitmapClipper_iface
.
lpVtbl
=
&
BitmapClipper_Vtbl
;
This
->
ref
=
1
;
This
->
source
=
NULL
;
InitializeCriticalSection
(
&
This
->
lock
);
This
->
lock
.
DebugInfo
->
Spare
[
0
]
=
(
DWORD_PTR
)(
__FILE__
": BitmapClipper.lock"
);
*
clipper
=
&
This
->
IWICBitmapClipper_iface
;
...
...
dlls/windowscodecs/tests/bitmap.c
View file @
682ea785
...
...
@@ -769,6 +769,46 @@ todo_wine
DeleteObject
(
hpal
);
}
static
void
test_clipper
(
void
)
{
IWICBitmapClipper
*
clipper
;
UINT
height
,
width
;
IWICBitmap
*
bitmap
;
WICRect
rect
;
HRESULT
hr
;
hr
=
IWICImagingFactory_CreateBitmap
(
factory
,
10
,
10
,
&
GUID_WICPixelFormat24bppBGR
,
WICBitmapCacheOnLoad
,
&
bitmap
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
hr
=
IWICImagingFactory_CreateBitmapClipper
(
factory
,
&
clipper
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
rect
.
X
=
rect
.
Y
=
0
;
rect
.
Width
=
rect
.
Height
=
11
;
hr
=
IWICBitmapClipper_Initialize
(
clipper
,
(
IWICBitmapSource
*
)
bitmap
,
&
rect
);
ok
(
hr
==
E_INVALIDARG
,
"got 0x%08x
\n
"
,
hr
);
rect
.
X
=
rect
.
Y
=
5
;
rect
.
Width
=
rect
.
Height
=
6
;
hr
=
IWICBitmapClipper_Initialize
(
clipper
,
(
IWICBitmapSource
*
)
bitmap
,
&
rect
);
ok
(
hr
==
E_INVALIDARG
,
"got 0x%08x
\n
"
,
hr
);
rect
.
X
=
rect
.
Y
=
5
;
rect
.
Width
=
rect
.
Height
=
5
;
hr
=
IWICBitmapClipper_Initialize
(
clipper
,
(
IWICBitmapSource
*
)
bitmap
,
&
rect
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
width
=
height
=
0
;
hr
=
IWICBitmapClipper_GetSize
(
clipper
,
&
width
,
&
height
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
ok
(
width
==
5
,
"got %d
\n
"
,
width
);
ok
(
height
==
5
,
"got %d
\n
"
,
height
);
IWICBitmapClipper_Release
(
clipper
);
IWICBitmap_Release
(
bitmap
);
}
START_TEST
(
bitmap
)
{
HRESULT
hr
;
...
...
@@ -784,6 +824,7 @@ START_TEST(bitmap)
test_CreateBitmapFromMemory
();
test_CreateBitmapFromHICON
();
test_CreateBitmapFromHBITMAP
();
test_clipper
();
IWICImagingFactory_Release
(
factory
);
...
...
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