Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-fonts
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
Aleksandr Isakov
wine-fonts
Commits
4038cb79
Commit
4038cb79
authored
Sep 10, 2012
by
Vincent Povirk
Committed by
Alexandre Julliard
Sep 11, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
windowscodecs: Only copy the palette to new bitmaps if they might be indexed.
parent
688aa1f5
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
74 additions
and
2 deletions
+74
-2
imgfactory.c
dlls/windowscodecs/imgfactory.c
+22
-1
bitmap.c
dlls/windowscodecs/tests/bitmap.c
+52
-1
No files found.
dlls/windowscodecs/imgfactory.c
View file @
4038cb79
...
...
@@ -474,6 +474,9 @@ static HRESULT WINAPI ComponentFactory_CreateBitmapFromSource(IWICComponentFacto
HRESULT
hr
;
WICRect
rc
;
double
dpix
,
dpiy
;
IWICComponentInfo
*
info
;
IWICPixelFormatInfo2
*
formatinfo
;
WICPixelFormatNumericRepresentation
format_type
;
TRACE
(
"(%p,%p,%u,%p)
\n
"
,
iface
,
piBitmapSource
,
option
,
ppIBitmap
);
...
...
@@ -486,6 +489,23 @@ static HRESULT WINAPI ComponentFactory_CreateBitmapFromSource(IWICComponentFacto
hr
=
IWICBitmapSource_GetPixelFormat
(
piBitmapSource
,
&
pixelformat
);
if
(
SUCCEEDED
(
hr
))
hr
=
CreateComponentInfo
(
&
pixelformat
,
&
info
);
if
(
SUCCEEDED
(
hr
))
{
hr
=
IWICComponentInfo_QueryInterface
(
info
,
&
IID_IWICPixelFormatInfo2
,
(
void
**
)
&
formatinfo
);
if
(
SUCCEEDED
(
hr
))
{
hr
=
IWICPixelFormatInfo2_GetNumericRepresentation
(
formatinfo
,
&
format_type
);
IWICPixelFormatInfo2_Release
(
formatinfo
);
}
IWICComponentInfo_Release
(
info
);
}
if
(
SUCCEEDED
(
hr
))
hr
=
BitmapImpl_Create
(
width
,
height
,
&
pixelformat
,
option
,
&
result
);
if
(
SUCCEEDED
(
hr
))
...
...
@@ -514,7 +534,8 @@ static HRESULT WINAPI ComponentFactory_CreateBitmapFromSource(IWICComponentFacto
if
(
SUCCEEDED
(
hr
))
hr
=
PaletteImpl_Create
(
&
palette
);
if
(
SUCCEEDED
(
hr
))
if
(
SUCCEEDED
(
hr
)
&&
(
format_type
==
WICPixelFormatNumericRepresentationUnspecified
||
format_type
==
WICPixelFormatNumericRepresentationIndexed
))
{
hr
=
IWICBitmapSource_CopyPalette
(
piBitmapSource
,
palette
);
...
...
dlls/windowscodecs/tests/bitmap.c
View file @
4038cb79
...
...
@@ -283,6 +283,8 @@ static void test_createbitmapfromsource(void)
WICPixelFormatGUID
pixelformat
=
{
0
};
UINT
width
=
0
,
height
=
0
;
double
dpix
=
10
.
0
,
dpiy
=
10
.
0
;
UINT
count
;
WICBitmapPaletteType
palette_type
;
hr
=
IWICImagingFactory_CreateBitmap
(
factory
,
3
,
3
,
&
GUID_WICPixelFormat24bppBGR
,
WICBitmapCacheOnLoad
,
&
bitmap
);
...
...
@@ -340,7 +342,7 @@ static void test_createbitmapfromsource(void)
/* palette isn't copied for non-indexed formats? */
hr
=
IWICBitmap_CopyPalette
(
bitmap2
,
palette
);
todo_wine
ok
(
hr
==
WINCODEC_ERR_PALETTEUNAVAILABLE
,
"IWICBitmap_CopyPalette failed hr=%x
\n
"
,
hr
);
ok
(
hr
==
WINCODEC_ERR_PALETTEUNAVAILABLE
,
"IWICBitmap_CopyPalette failed hr=%x
\n
"
,
hr
);
IWICPalette_Release
(
palette
);
...
...
@@ -365,6 +367,55 @@ static void test_createbitmapfromsource(void)
ok
(
height
==
3
,
"got %d, expected 3
\n
"
,
height
);
IWICBitmap_Release
(
bitmap2
);
/* Ensure palette is copied for indexed formats */
hr
=
IWICImagingFactory_CreateBitmap
(
factory
,
3
,
3
,
&
GUID_WICPixelFormat4bppIndexed
,
WICBitmapCacheOnLoad
,
&
bitmap
);
ok
(
hr
==
S_OK
,
"IWICImagingFactory_CreateBitmap failed hr=%x
\n
"
,
hr
);
hr
=
IWICImagingFactory_CreatePalette
(
factory
,
&
palette
);
ok
(
hr
==
S_OK
,
"IWICImagingFactory_CreatePalette failed hr=%x
\n
"
,
hr
);
hr
=
IWICPalette_InitializePredefined
(
palette
,
WICBitmapPaletteTypeFixedGray256
,
FALSE
);
ok
(
hr
==
S_OK
,
"IWICPalette_InitializePredefined failed hr=%x
\n
"
,
hr
);
hr
=
IWICBitmap_SetPalette
(
bitmap
,
palette
);
ok
(
hr
==
S_OK
,
"IWICBitmap_SetPalette failed hr=%x
\n
"
,
hr
);
IWICPalette_Release
(
palette
);
hr
=
IWICImagingFactory_CreateBitmapFromSource
(
factory
,
(
IWICBitmapSource
*
)
bitmap
,
WICBitmapCacheOnLoad
,
&
bitmap2
);
ok
(
hr
==
S_OK
,
"IWICImagingFactory_CreateBitmapFromSource failed hr=%x
\n
"
,
hr
);
IWICBitmap_Release
(
bitmap
);
hr
=
IWICImagingFactory_CreatePalette
(
factory
,
&
palette
);
ok
(
hr
==
S_OK
,
"IWICImagingFactory_CreatePalette failed hr=%x
\n
"
,
hr
);
hr
=
IWICBitmap_CopyPalette
(
bitmap2
,
palette
);
ok
(
hr
==
S_OK
,
"IWICBitmap_CopyPalette failed hr=%x
\n
"
,
hr
);
hr
=
IWICPalette_GetColorCount
(
palette
,
&
count
);
ok
(
hr
==
S_OK
,
"IWICPalette_GetColorCount failed hr=%x
\n
"
,
hr
);
ok
(
count
==
256
,
"unexpected count %d
\n
"
,
count
);
hr
=
IWICPalette_GetType
(
palette
,
&
palette_type
);
ok
(
hr
==
S_OK
,
"IWICPalette_GetType failed hr=%x
\n
"
,
hr
);
ok
(
palette_type
==
WICBitmapPaletteTypeFixedGray256
,
"unexpected palette type %d
\n
"
,
palette_type
);
IWICPalette_Release
(
palette
);
hr
=
IWICBitmap_GetPixelFormat
(
bitmap2
,
&
pixelformat
);
ok
(
hr
==
S_OK
,
"IWICBitmap_GetPixelFormat failed hr=%x
\n
"
,
hr
);
ok
(
IsEqualGUID
(
&
pixelformat
,
&
GUID_WICPixelFormat4bppIndexed
),
"unexpected pixel format
\n
"
);
hr
=
IWICBitmap_GetSize
(
bitmap2
,
&
width
,
&
height
);
ok
(
hr
==
S_OK
,
"IWICBitmap_GetSize failed hr=%x
\n
"
,
hr
);
ok
(
width
==
3
,
"got %d, expected 3
\n
"
,
width
);
ok
(
height
==
3
,
"got %d, expected 3
\n
"
,
height
);
IWICBitmap_Release
(
bitmap2
);
}
START_TEST
(
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