winehq.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2025
July
June
May
April
March
February
January
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
January
2003
December
November
October
September
August
July
June
May
April
March
February
January
2002
December
November
October
September
August
July
June
May
April
March
February
January
2001
December
November
October
September
August
July
June
May
April
March
February
List overview
wine-commits
July 2009
----- 2025 -----
July 2025
June 2025
May 2025
April 2025
March 2025
February 2025
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
January 2004
----- 2003 -----
December 2003
November 2003
October 2003
September 2003
August 2003
July 2003
June 2003
May 2003
April 2003
March 2003
February 2003
January 2003
----- 2002 -----
December 2002
November 2002
October 2002
September 2002
August 2002
July 2002
June 2002
May 2002
April 2002
March 2002
February 2002
January 2002
----- 2001 -----
December 2001
November 2001
October 2001
September 2001
August 2001
July 2001
June 2001
May 2001
April 2001
March 2001
February 2001
wine-commits@winehq.org
4 participants
1067 discussions
Start a n
N
ew thread
Nikolay Sivov : comctl32/listview: Fix hittest flag calculation for negative Y values on report mode.
by Alexandre Julliard
07 Jul '09
07 Jul '09
Module: wine Branch: master Commit: 2f989163bdebb4cf19389ac3e44db8de0d01379c URL:
http://source.winehq.org/git/wine.git/?a=commit;h=2f989163bdebb4cf19389ac3e…
Author: Nikolay Sivov <bunglehead(a)gmail.com> Date: Tue Jul 7 03:44:30 2009 +0400 comctl32/listview: Fix hittest flag calculation for negative Y values on report mode. --- dlls/comctl32/listview.c | 4 +--- dlls/comctl32/tests/listview.c | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/dlls/comctl32/listview.c b/dlls/comctl32/listview.c index 24da77d..cd1d0d5 100644 --- a/dlls/comctl32/listview.c +++ b/dlls/comctl32/listview.c @@ -6820,9 +6820,7 @@ static INT LISTVIEW_HitTest(const LISTVIEW_INFO *infoPtr, LPLVHITTESTINFO lpht, else opt.y = lpht->pt.y; - if (infoPtr->rcList.top > opt.y) - lpht->flags |= LVHT_ABOVE; - else if (infoPtr->rcList.bottom < opt.y) + if (infoPtr->rcList.bottom < opt.y) lpht->flags |= LVHT_BELOW; } else diff --git a/dlls/comctl32/tests/listview.c b/dlls/comctl32/tests/listview.c index fd0e55c..c0b272b 100644 --- a/dlls/comctl32/tests/listview.c +++ b/dlls/comctl32/tests/listview.c @@ -2675,7 +2675,7 @@ static void test_hittest(void) /* subitem returned with -1 item too */ x = pos.x + 150; y = -10; - test_lvm_subitemhittest(hwnd, x, y, -1, 1, LVHT_NOWHERE, FALSE, FALSE, TRUE, __LINE__); + test_lvm_subitemhittest(hwnd, x, y, -1, 1, LVHT_NOWHERE, FALSE, FALSE, FALSE, __LINE__); /* parent client area is 100x100 by default */ MoveWindow(hwnd, 0, 0, 300, 100, FALSE); x = pos.x + 150; /* outside column */
1
0
0
0
Nikolay Sivov : comctl32/listview: Fix hittesting for "small" positive Y coordinates.
by Alexandre Julliard
07 Jul '09
07 Jul '09
Module: wine Branch: master Commit: 86e4d1cdbe2bd0cff9474415caddb4b9491d0518 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=86e4d1cdbe2bd0cff9474415c…
Author: Nikolay Sivov <bunglehead(a)gmail.com> Date: Tue Jul 7 03:28:53 2009 +0400 comctl32/listview: Fix hittesting for "small" positive Y coordinates. --- dlls/comctl32/listview.c | 28 +++++++++++++++++++++------- dlls/comctl32/tests/listview.c | 18 +++++++++--------- 2 files changed, 30 insertions(+), 16 deletions(-) diff --git a/dlls/comctl32/listview.c b/dlls/comctl32/listview.c index 2a66152..24da77d 100644 --- a/dlls/comctl32/listview.c +++ b/dlls/comctl32/listview.c @@ -6814,6 +6814,16 @@ static INT LISTVIEW_HitTest(const LISTVIEW_INFO *infoPtr, LPLVHITTESTINFO lpht, /* LVM_SUBITEMHITTEST checks left bound of possible client area */ if (infoPtr->rcList.left > lpht->pt.x && Origin.x < lpht->pt.x) lpht->flags |= LVHT_TOLEFT; + + if (lpht->pt.y < infoPtr->rcList.top && lpht->pt.y >= 0) + opt.y = lpht->pt.y + infoPtr->rcList.top; + else + opt.y = lpht->pt.y; + + if (infoPtr->rcList.top > opt.y) + lpht->flags |= LVHT_ABOVE; + else if (infoPtr->rcList.bottom < opt.y) + lpht->flags |= LVHT_BELOW; } else { @@ -6821,12 +6831,12 @@ static INT LISTVIEW_HitTest(const LISTVIEW_INFO *infoPtr, LPLVHITTESTINFO lpht, lpht->flags |= LVHT_TOLEFT; else if (infoPtr->rcList.right < lpht->pt.x) lpht->flags |= LVHT_TORIGHT; + + if (infoPtr->rcList.top > lpht->pt.y) + lpht->flags |= LVHT_ABOVE; + else if (infoPtr->rcList.bottom < lpht->pt.y) + lpht->flags |= LVHT_BELOW; } - - if (infoPtr->rcList.top > lpht->pt.y) - lpht->flags |= LVHT_ABOVE; - else if (infoPtr->rcList.bottom < lpht->pt.y) - lpht->flags |= LVHT_BELOW; /* even if item is invalid try to find subitem */ if (infoPtr->uView == LV_VIEW_DETAILS && subitem) @@ -6883,8 +6893,12 @@ static INT LISTVIEW_HitTest(const LISTVIEW_INFO *infoPtr, LPLVHITTESTINFO lpht, LISTVIEW_GetItemMetrics(infoPtr, &lvItem, &rcBox, NULL, &rcIcon, &rcState, &rcLabel); LISTVIEW_GetItemOrigin(infoPtr, iItem, &Position); opt.x = lpht->pt.x - Position.x - Origin.x; - opt.y = lpht->pt.y - Position.y - Origin.y; - + + if (lpht->pt.y < infoPtr->rcList.top && lpht->pt.y >= 0) + opt.y = lpht->pt.y - Position.y - Origin.y + infoPtr->rcList.top; + else + opt.y = lpht->pt.y - Position.y - Origin.y; + if (infoPtr->uView == LV_VIEW_DETAILS) { rcBounds = rcBox; diff --git a/dlls/comctl32/tests/listview.c b/dlls/comctl32/tests/listview.c index 98c31c4..fd0e55c 100644 --- a/dlls/comctl32/tests/listview.c +++ b/dlls/comctl32/tests/listview.c @@ -2663,7 +2663,7 @@ static void test_hittest(void) test_lvm_subitemhittest(hwnd, x, y, 0, 1, LVHT_ONITEMLABEL, FALSE, FALSE, FALSE, __LINE__); y = (bounds.bottom - bounds.top) / 2; test_lvm_hittest(hwnd, x, y, -1, LVHT_TORIGHT, FALSE, TRUE, __LINE__); - test_lvm_subitemhittest(hwnd, x, y, 0, 1, LVHT_ONITEMLABEL, TRUE, FALSE, TRUE, __LINE__); + test_lvm_subitemhittest(hwnd, x, y, 0, 1, LVHT_ONITEMLABEL, FALSE, FALSE, FALSE, __LINE__); /* outside possible client rectangle (to right) */ x = pos.x + 500; y = pos.y + (bounds.bottom - bounds.top) / 2; @@ -2671,7 +2671,7 @@ static void test_hittest(void) test_lvm_subitemhittest(hwnd, x, y, -1, -1, LVHT_NOWHERE, FALSE, FALSE, FALSE, __LINE__); y = (bounds.bottom - bounds.top) / 2; test_lvm_hittest(hwnd, x, y, -1, LVHT_TORIGHT, FALSE, TRUE, __LINE__); - test_lvm_subitemhittest(hwnd, x, y, -1, -1, LVHT_NOWHERE, FALSE, FALSE, TRUE, __LINE__); + test_lvm_subitemhittest(hwnd, x, y, -1, -1, LVHT_NOWHERE, FALSE, FALSE, FALSE, __LINE__); /* subitem returned with -1 item too */ x = pos.x + 150; y = -10; @@ -2684,7 +2684,7 @@ static void test_hittest(void) test_lvm_subitemhittest(hwnd, x, y, 0, 1, LVHT_ONITEMLABEL, FALSE, FALSE, FALSE, __LINE__); y = (bounds.bottom - bounds.top) / 2; test_lvm_hittest(hwnd, x, y, -1, LVHT_NOWHERE, FALSE, TRUE, __LINE__); - test_lvm_subitemhittest(hwnd, x, y, 0, 1, LVHT_ONITEMLABEL, TRUE, FALSE, TRUE, __LINE__); + test_lvm_subitemhittest(hwnd, x, y, 0, 1, LVHT_ONITEMLABEL, FALSE, FALSE, FALSE, __LINE__); /* the same with LVS_EX_FULLROWSELECT */ SendMessage(hwnd, LVM_SETEXTENDEDLISTVIEWSTYLE, 0, LVS_EX_FULLROWSELECT); x = pos.x + 150; /* outside column */ @@ -2692,7 +2692,7 @@ static void test_hittest(void) test_lvm_hittest(hwnd, x, y, 0, LVHT_ONITEM, FALSE, FALSE, __LINE__); test_lvm_subitemhittest(hwnd, x, y, 0, 1, LVHT_ONITEMLABEL, FALSE, FALSE, FALSE, __LINE__); y = (bounds.bottom - bounds.top) / 2; - test_lvm_subitemhittest(hwnd, x, y, 0, 1, LVHT_ONITEMLABEL, TRUE, FALSE, TRUE, __LINE__); + test_lvm_subitemhittest(hwnd, x, y, 0, 1, LVHT_ONITEMLABEL, FALSE, FALSE, FALSE, __LINE__); MoveWindow(hwnd, 0, 0, 100, 100, FALSE); x = pos.x + 150; /* outside column */ y = pos.y + (bounds.bottom - bounds.top) / 2; @@ -2700,7 +2700,7 @@ static void test_hittest(void) test_lvm_subitemhittest(hwnd, x, y, 0, 1, LVHT_ONITEMLABEL, FALSE, FALSE, FALSE, __LINE__); y = (bounds.bottom - bounds.top) / 2; test_lvm_hittest(hwnd, x, y, -1, LVHT_TORIGHT, FALSE, TRUE, __LINE__); - test_lvm_subitemhittest(hwnd, x, y, 0, 1, LVHT_ONITEMLABEL, TRUE, FALSE, TRUE, __LINE__); + test_lvm_subitemhittest(hwnd, x, y, 0, 1, LVHT_ONITEMLABEL, FALSE, FALSE, FALSE, __LINE__); /* outside possible client rectangle (to right) */ x = pos.x + 500; y = pos.y + (bounds.bottom - bounds.top) / 2; @@ -2708,7 +2708,7 @@ static void test_hittest(void) test_lvm_subitemhittest(hwnd, x, y, -1, -1, LVHT_NOWHERE, FALSE, FALSE, FALSE, __LINE__); y = (bounds.bottom - bounds.top) / 2; test_lvm_hittest(hwnd, x, y, -1, LVHT_TORIGHT, FALSE, TRUE, __LINE__); - test_lvm_subitemhittest(hwnd, x, y, -1, -1, LVHT_NOWHERE, FALSE, FALSE, TRUE, __LINE__); + test_lvm_subitemhittest(hwnd, x, y, -1, -1, LVHT_NOWHERE, FALSE, FALSE, FALSE, __LINE__); /* try with icons, state icons index is 1 based so at least 2 bitmaps needed */ himl = ImageList_Create(16, 16, 0, 4, 4); ok(himl != NULL, "failed to create imagelist\n"); @@ -2736,7 +2736,7 @@ static void test_hittest(void) test_lvm_hittest(hwnd, x, y, 0, LVHT_ONITEMSTATEICON, FALSE, FALSE, __LINE__); test_lvm_subitemhittest(hwnd, x, y, 0, 0, LVHT_ONITEMSTATEICON, FALSE, FALSE, FALSE, __LINE__); y = (bounds.bottom - bounds.top) / 2; - test_lvm_subitemhittest(hwnd, x, y, 0, 0, LVHT_ONITEMSTATEICON, TRUE, FALSE, FALSE, __LINE__); + test_lvm_subitemhittest(hwnd, x, y, 0, 0, LVHT_ONITEMSTATEICON, FALSE, FALSE, FALSE, __LINE__); /* state icons indices are 1 based, check with valid index */ item.mask = LVIF_STATE; @@ -2752,7 +2752,7 @@ static void test_hittest(void) test_lvm_hittest(hwnd, x, y, 0, LVHT_ONITEMSTATEICON, FALSE, FALSE, __LINE__); test_lvm_subitemhittest(hwnd, x, y, 0, 0, LVHT_ONITEMSTATEICON, FALSE, FALSE, FALSE, __LINE__); y = (bounds.bottom - bounds.top) / 2; - test_lvm_subitemhittest(hwnd, x, y, 0, 0, LVHT_ONITEMSTATEICON, TRUE, FALSE, FALSE, __LINE__); + test_lvm_subitemhittest(hwnd, x, y, 0, 0, LVHT_ONITEMSTATEICON, FALSE, FALSE, FALSE, __LINE__); himl2 = (HIMAGELIST)SendMessage(hwnd, LVM_SETIMAGELIST, LVSIL_STATE, (LPARAM)NULL); ok(himl2 == himl, "should return handle\n"); @@ -2765,7 +2765,7 @@ static void test_hittest(void) test_lvm_hittest(hwnd, x, y, 0, LVHT_ONITEMICON, FALSE, FALSE, __LINE__); test_lvm_subitemhittest(hwnd, x, y, 0, 0, LVHT_ONITEMICON, FALSE, FALSE, FALSE, __LINE__); y = (bounds.bottom - bounds.top) / 2; - test_lvm_subitemhittest(hwnd, x, y, 0, 0, LVHT_ONITEMICON, TRUE, FALSE, TRUE, __LINE__); + test_lvm_subitemhittest(hwnd, x, y, 0, 0, LVHT_ONITEMICON, FALSE, FALSE, FALSE, __LINE__); DestroyWindow(hwnd); }
1
0
0
0
Nikolay Sivov : comctl32/listview: More LVM_*HITTEST tests.
by Alexandre Julliard
07 Jul '09
07 Jul '09
Module: wine Branch: master Commit: faebaa575bbc8daff287c39bd7fbff96a0b47d05 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=faebaa575bbc8daff287c39bd…
Author: Nikolay Sivov <bunglehead(a)gmail.com> Date: Tue Jul 7 02:50:15 2009 +0400 comctl32/listview: More LVM_*HITTEST tests. --- dlls/comctl32/tests/listview.c | 23 +++++++++++++++++++++++ 1 files changed, 23 insertions(+), 0 deletions(-) diff --git a/dlls/comctl32/tests/listview.c b/dlls/comctl32/tests/listview.c index 43a7037..98c31c4 100644 --- a/dlls/comctl32/tests/listview.c +++ b/dlls/comctl32/tests/listview.c @@ -2661,11 +2661,17 @@ static void test_hittest(void) y = pos.y + (bounds.bottom - bounds.top) / 2; test_lvm_hittest(hwnd, x, y, -1, LVHT_TORIGHT, FALSE, FALSE, __LINE__); test_lvm_subitemhittest(hwnd, x, y, 0, 1, LVHT_ONITEMLABEL, FALSE, FALSE, FALSE, __LINE__); + y = (bounds.bottom - bounds.top) / 2; + test_lvm_hittest(hwnd, x, y, -1, LVHT_TORIGHT, FALSE, TRUE, __LINE__); + test_lvm_subitemhittest(hwnd, x, y, 0, 1, LVHT_ONITEMLABEL, TRUE, FALSE, TRUE, __LINE__); /* outside possible client rectangle (to right) */ x = pos.x + 500; y = pos.y + (bounds.bottom - bounds.top) / 2; test_lvm_hittest(hwnd, x, y, -1, LVHT_TORIGHT, FALSE, FALSE, __LINE__); test_lvm_subitemhittest(hwnd, x, y, -1, -1, LVHT_NOWHERE, FALSE, FALSE, FALSE, __LINE__); + y = (bounds.bottom - bounds.top) / 2; + test_lvm_hittest(hwnd, x, y, -1, LVHT_TORIGHT, FALSE, TRUE, __LINE__); + test_lvm_subitemhittest(hwnd, x, y, -1, -1, LVHT_NOWHERE, FALSE, FALSE, TRUE, __LINE__); /* subitem returned with -1 item too */ x = pos.x + 150; y = -10; @@ -2676,22 +2682,33 @@ static void test_hittest(void) y = pos.y + (bounds.bottom - bounds.top) / 2; test_lvm_hittest(hwnd, x, y, -1, LVHT_NOWHERE, FALSE, FALSE, __LINE__); test_lvm_subitemhittest(hwnd, x, y, 0, 1, LVHT_ONITEMLABEL, FALSE, FALSE, FALSE, __LINE__); + y = (bounds.bottom - bounds.top) / 2; + test_lvm_hittest(hwnd, x, y, -1, LVHT_NOWHERE, FALSE, TRUE, __LINE__); + test_lvm_subitemhittest(hwnd, x, y, 0, 1, LVHT_ONITEMLABEL, TRUE, FALSE, TRUE, __LINE__); /* the same with LVS_EX_FULLROWSELECT */ SendMessage(hwnd, LVM_SETEXTENDEDLISTVIEWSTYLE, 0, LVS_EX_FULLROWSELECT); x = pos.x + 150; /* outside column */ y = pos.y + (bounds.bottom - bounds.top) / 2; test_lvm_hittest(hwnd, x, y, 0, LVHT_ONITEM, FALSE, FALSE, __LINE__); test_lvm_subitemhittest(hwnd, x, y, 0, 1, LVHT_ONITEMLABEL, FALSE, FALSE, FALSE, __LINE__); + y = (bounds.bottom - bounds.top) / 2; + test_lvm_subitemhittest(hwnd, x, y, 0, 1, LVHT_ONITEMLABEL, TRUE, FALSE, TRUE, __LINE__); MoveWindow(hwnd, 0, 0, 100, 100, FALSE); x = pos.x + 150; /* outside column */ y = pos.y + (bounds.bottom - bounds.top) / 2; test_lvm_hittest(hwnd, x, y, -1, LVHT_TORIGHT, FALSE, FALSE, __LINE__); test_lvm_subitemhittest(hwnd, x, y, 0, 1, LVHT_ONITEMLABEL, FALSE, FALSE, FALSE, __LINE__); + y = (bounds.bottom - bounds.top) / 2; + test_lvm_hittest(hwnd, x, y, -1, LVHT_TORIGHT, FALSE, TRUE, __LINE__); + test_lvm_subitemhittest(hwnd, x, y, 0, 1, LVHT_ONITEMLABEL, TRUE, FALSE, TRUE, __LINE__); /* outside possible client rectangle (to right) */ x = pos.x + 500; y = pos.y + (bounds.bottom - bounds.top) / 2; test_lvm_hittest(hwnd, x, y, -1, LVHT_TORIGHT, FALSE, FALSE, __LINE__); test_lvm_subitemhittest(hwnd, x, y, -1, -1, LVHT_NOWHERE, FALSE, FALSE, FALSE, __LINE__); + y = (bounds.bottom - bounds.top) / 2; + test_lvm_hittest(hwnd, x, y, -1, LVHT_TORIGHT, FALSE, TRUE, __LINE__); + test_lvm_subitemhittest(hwnd, x, y, -1, -1, LVHT_NOWHERE, FALSE, FALSE, TRUE, __LINE__); /* try with icons, state icons index is 1 based so at least 2 bitmaps needed */ himl = ImageList_Create(16, 16, 0, 4, 4); ok(himl != NULL, "failed to create imagelist\n"); @@ -2718,6 +2735,8 @@ static void test_hittest(void) y = pos.y + (bounds.bottom - bounds.top) / 2; test_lvm_hittest(hwnd, x, y, 0, LVHT_ONITEMSTATEICON, FALSE, FALSE, __LINE__); test_lvm_subitemhittest(hwnd, x, y, 0, 0, LVHT_ONITEMSTATEICON, FALSE, FALSE, FALSE, __LINE__); + y = (bounds.bottom - bounds.top) / 2; + test_lvm_subitemhittest(hwnd, x, y, 0, 0, LVHT_ONITEMSTATEICON, TRUE, FALSE, FALSE, __LINE__); /* state icons indices are 1 based, check with valid index */ item.mask = LVIF_STATE; @@ -2732,6 +2751,8 @@ static void test_hittest(void) y = pos.y + (bounds.bottom - bounds.top) / 2; test_lvm_hittest(hwnd, x, y, 0, LVHT_ONITEMSTATEICON, FALSE, FALSE, __LINE__); test_lvm_subitemhittest(hwnd, x, y, 0, 0, LVHT_ONITEMSTATEICON, FALSE, FALSE, FALSE, __LINE__); + y = (bounds.bottom - bounds.top) / 2; + test_lvm_subitemhittest(hwnd, x, y, 0, 0, LVHT_ONITEMSTATEICON, TRUE, FALSE, FALSE, __LINE__); himl2 = (HIMAGELIST)SendMessage(hwnd, LVM_SETIMAGELIST, LVSIL_STATE, (LPARAM)NULL); ok(himl2 == himl, "should return handle\n"); @@ -2743,6 +2764,8 @@ static void test_hittest(void) y = pos.y + (bounds.bottom - bounds.top) / 2; test_lvm_hittest(hwnd, x, y, 0, LVHT_ONITEMICON, FALSE, FALSE, __LINE__); test_lvm_subitemhittest(hwnd, x, y, 0, 0, LVHT_ONITEMICON, FALSE, FALSE, FALSE, __LINE__); + y = (bounds.bottom - bounds.top) / 2; + test_lvm_subitemhittest(hwnd, x, y, 0, 0, LVHT_ONITEMICON, TRUE, FALSE, TRUE, __LINE__); DestroyWindow(hwnd); }
1
0
0
0
Vincent Povirk : windowscodecs: Add support for decoding RLE4-encoded BMP files.
by Alexandre Julliard
07 Jul '09
07 Jul '09
Module: wine Branch: master Commit: 48d58cef5958e6a6a2912a5b8e82eb805ac53fb8 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=48d58cef5958e6a6a2912a5b8…
Author: Vincent Povirk <vincent(a)codeweavers.com> Date: Mon Jul 6 15:51:44 2009 -0500 windowscodecs: Add support for decoding RLE4-encoded BMP files. --- dlls/windowscodecs/bmpdecode.c | 126 +++++++++++++++++++++++++ dlls/windowscodecs/tests/bmpformat.c | 167 ++++++++++++++++++++++++++++++++++ 2 files changed, 293 insertions(+), 0 deletions(-) Diff:
http://source.winehq.org/git/wine.git/?a=commitdiff;h=48d58cef5958e6a6a2912…
1
0
0
0
Vincent Povirk : windowscodecs: Add support for decoding RLE8-encoded BMP files.
by Alexandre Julliard
07 Jul '09
07 Jul '09
Module: wine Branch: master Commit: 07a6b89f87c998a16aa45994bd56286a4533027a URL:
http://source.winehq.org/git/wine.git/?a=commit;h=07a6b89f87c998a16aa45994b…
Author: Vincent Povirk <vincent(a)codeweavers.com> Date: Mon Jul 6 15:20:03 2009 -0500 windowscodecs: Add support for decoding RLE8-encoded BMP files. --- dlls/windowscodecs/bmpdecode.c | 111 +++++++++++++++++++++ dlls/windowscodecs/tests/bmpformat.c | 180 ++++++++++++++++++++++++++++++++++ 2 files changed, 291 insertions(+), 0 deletions(-) Diff:
http://source.winehq.org/git/wine.git/?a=commitdiff;h=07a6b89f87c998a16aa45…
1
0
0
0
Vincent Povirk : windowscodecs: Return proper error codes in unneeded BMP decoder methods.
by Alexandre Julliard
07 Jul '09
07 Jul '09
Module: wine Branch: master Commit: 387b842707e276a4ca0365370da24fb99db95baf URL:
http://source.winehq.org/git/wine.git/?a=commit;h=387b842707e276a4ca0365370…
Author: Vincent Povirk <vincent(a)codeweavers.com> Date: Mon Jul 6 13:10:46 2009 -0500 windowscodecs: Return proper error codes in unneeded BMP decoder methods. --- dlls/windowscodecs/bmpdecode.c | 28 ++++++++++++++-------------- dlls/windowscodecs/tests/bmpformat.c | 24 ++++++++++++++++++++++++ include/wincodec.idl | 1 + 3 files changed, 39 insertions(+), 14 deletions(-) diff --git a/dlls/windowscodecs/bmpdecode.c b/dlls/windowscodecs/bmpdecode.c index 61d68c1..70923a1 100644 --- a/dlls/windowscodecs/bmpdecode.c +++ b/dlls/windowscodecs/bmpdecode.c @@ -311,22 +311,22 @@ static HRESULT WINAPI BmpFrameDecode_CopyPixels(IWICBitmapFrameDecode *iface, static HRESULT WINAPI BmpFrameDecode_GetMetadataQueryReader(IWICBitmapFrameDecode *iface, IWICMetadataQueryReader **ppIMetadataQueryReader) { - FIXME("(%p,%p): stub\n", iface, ppIMetadataQueryReader); - return E_NOTIMPL; + TRACE("(%p,%p)\n", iface, ppIMetadataQueryReader); + return WINCODEC_ERR_UNSUPPORTEDOPERATION; } static HRESULT WINAPI BmpFrameDecode_GetColorContexts(IWICBitmapFrameDecode *iface, UINT cCount, IWICColorContext **ppIColorContexts, UINT *pcActualCount) { - FIXME("(%p,%u,%p,%p): stub\n", iface, cCount, ppIColorContexts, pcActualCount); - return E_NOTIMPL; + TRACE("(%p,%u,%p,%p)\n", iface, cCount, ppIColorContexts, pcActualCount); + return WINCODEC_ERR_UNSUPPORTEDOPERATION; } static HRESULT WINAPI BmpFrameDecode_GetThumbnail(IWICBitmapFrameDecode *iface, IWICBitmapSource **ppIThumbnail) { - FIXME("(%p,%p): stub\n", iface, ppIThumbnail); - return E_NOTIMPL; + TRACE("(%p,%p)\n", iface, ppIThumbnail); + return WINCODEC_ERR_CODECNOTHUMBNAIL; } static HRESULT BmpFrameDecode_ReadUncompressed(BmpFrameDecode* This) @@ -637,29 +637,29 @@ static HRESULT WINAPI BmpDecoder_CopyPalette(IWICBitmapDecoder *iface, static HRESULT WINAPI BmpDecoder_GetMetadataQueryReader(IWICBitmapDecoder *iface, IWICMetadataQueryReader **ppIMetadataQueryReader) { - FIXME("(%p,%p): stub\n", iface, ppIMetadataQueryReader); - return E_NOTIMPL; + TRACE("(%p,%p)\n", iface, ppIMetadataQueryReader); + return WINCODEC_ERR_UNSUPPORTEDOPERATION; } static HRESULT WINAPI BmpDecoder_GetPreview(IWICBitmapDecoder *iface, IWICBitmapSource **ppIBitmapSource) { - FIXME("(%p,%p): stub\n", iface, ppIBitmapSource); - return E_NOTIMPL; + TRACE("(%p,%p)\n", iface, ppIBitmapSource); + return WINCODEC_ERR_UNSUPPORTEDOPERATION; } static HRESULT WINAPI BmpDecoder_GetColorContexts(IWICBitmapDecoder *iface, UINT cCount, IWICColorContext **ppIColorContexts, UINT *pcActualCount) { - FIXME("(%p,%u,%p,%p): stub\n", iface, cCount, ppIColorContexts, pcActualCount); - return E_NOTIMPL; + TRACE("(%p,%u,%p,%p)\n", iface, cCount, ppIColorContexts, pcActualCount); + return WINCODEC_ERR_UNSUPPORTEDOPERATION; } static HRESULT WINAPI BmpDecoder_GetThumbnail(IWICBitmapDecoder *iface, IWICBitmapSource **ppIThumbnail) { - FIXME("(%p,%p): stub\n", iface, ppIThumbnail); - return E_NOTIMPL; + TRACE("(%p,%p)\n", iface, ppIThumbnail); + return WINCODEC_ERR_CODECNOTHUMBNAIL; } static HRESULT WINAPI BmpDecoder_GetFrameCount(IWICBitmapDecoder *iface, diff --git a/dlls/windowscodecs/tests/bmpformat.c b/dlls/windowscodecs/tests/bmpformat.c index 2456245..1ed77e2 100644 --- a/dlls/windowscodecs/tests/bmpformat.c +++ b/dlls/windowscodecs/tests/bmpformat.c @@ -49,6 +49,9 @@ static void test_decode_24bpp(void) { IWICBitmapDecoder *decoder, *decoder2; IWICBitmapFrameDecode *framedecode; + IWICMetadataQueryReader *queryreader; + IWICColorContext *colorcontext; + IWICBitmapSource *thumbnail; HRESULT hr; HGLOBAL hbmpdata; char *bmpdata; @@ -88,6 +91,18 @@ static void test_decode_24bpp(void) ok(SUCCEEDED(hr), "GetContainerFormat failed, hr=%x\n", hr); ok(IsEqualGUID(&guidresult, &GUID_ContainerFormatBmp), "unexpected container format\n"); + hr = IWICBitmapDecoder_GetMetadataQueryReader(decoder, &queryreader); + ok(hr == WINCODEC_ERR_UNSUPPORTEDOPERATION, "expected WINCODEC_ERR_UNSUPPORTEDOPERATION, got %x\n", hr); + + hr = IWICBitmapDecoder_GetColorContexts(decoder, 1, &colorcontext, &count); + ok(hr == WINCODEC_ERR_UNSUPPORTEDOPERATION, "expected WINCODEC_ERR_UNSUPPORTEDOPERATION, got %x\n", hr); + + hr = IWICBitmapDecoder_GetThumbnail(decoder, &thumbnail); + ok(hr == WINCODEC_ERR_CODECNOTHUMBNAIL, "expected WINCODEC_ERR_CODECNOTHUMBNAIL, got %x\n", hr); + + hr = IWICBitmapDecoder_GetPreview(decoder, &thumbnail); + ok(hr == WINCODEC_ERR_UNSUPPORTEDOPERATION, "expected WINCODEC_ERR_UNSUPPORTEDOPERATION, got %x\n", hr); + hr = IWICBitmapDecoder_GetFrameCount(decoder, &count); ok(SUCCEEDED(hr), "GetFrameCount failed, hr=%x\n", hr); ok(count == 1, "unexpected count %u\n", count); @@ -116,6 +131,15 @@ static void test_decode_24bpp(void) ok(SUCCEEDED(hr), "GetPixelFormat failed, hr=%x\n", hr); ok(IsEqualGUID(&guidresult, &GUID_WICPixelFormat24bppBGR), "unexpected pixel format\n"); + hr = IWICBitmapFrameDecode_GetMetadataQueryReader(framedecode, &queryreader); + ok(hr == WINCODEC_ERR_UNSUPPORTEDOPERATION, "expected WINCODEC_ERR_UNSUPPORTEDOPERATION, got %x\n", hr); + + hr = IWICBitmapFrameDecode_GetColorContexts(framedecode, 1, &colorcontext, &count); + ok(hr == WINCODEC_ERR_UNSUPPORTEDOPERATION, "expected WINCODEC_ERR_UNSUPPORTEDOPERATION, got %x\n", hr); + + hr = IWICBitmapFrameDecode_GetThumbnail(framedecode, &thumbnail); + ok(hr == WINCODEC_ERR_CODECNOTHUMBNAIL, "expected WINCODEC_ERR_CODECNOTHUMBNAIL, got %x\n", hr); + hr = CoCreateInstance(&CLSID_WICImagingFactory, NULL, CLSCTX_INPROC_SERVER, &IID_IWICImagingFactory, (void**)&factory); ok(SUCCEEDED(hr), "CoCreateInstance failed, hr=%x\n", hr); diff --git a/include/wincodec.idl b/include/wincodec.idl index d8712b8..691a4fd 100644 --- a/include/wincodec.idl +++ b/include/wincodec.idl @@ -96,6 +96,7 @@ typedef UINT32 WICColor; cpp_quote("#define WINCODEC_ERR_WRONGSTATE 0x88982f04") cpp_quote("#define WINCODEC_ERR_CODECNOTHUMBNAIL 0x88982f44") cpp_quote("#define WINCODEC_ERR_PALETTEUNAVAILABLE 0x88982f45") +cpp_quote("#define WINCODEC_ERR_UNSUPPORTEDOPERATION 0x88982f81") interface IWICBitmap; interface IWICComponentInfo;
1
0
0
0
Vincent Povirk : windowscodecs: Add test for 4-bit indexed color BMP.
by Alexandre Julliard
07 Jul '09
07 Jul '09
Module: wine Branch: master Commit: 6caca236788cfd647246e5e2eed982e85aeb9617 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=6caca236788cfd647246e5e2e…
Author: Vincent Povirk <vincent(a)codeweavers.com> Date: Mon Jul 6 12:44:38 2009 -0500 windowscodecs: Add test for 4-bit indexed color BMP. --- dlls/windowscodecs/tests/bmpformat.c | 160 ++++++++++++++++++++++++++++++++++ 1 files changed, 160 insertions(+), 0 deletions(-) diff --git a/dlls/windowscodecs/tests/bmpformat.c b/dlls/windowscodecs/tests/bmpformat.c index 6538e66..2456245 100644 --- a/dlls/windowscodecs/tests/bmpformat.c +++ b/dlls/windowscodecs/tests/bmpformat.c @@ -17,6 +17,7 @@ */ #include <stdarg.h> +#include <math.h> #define COBJMACROS @@ -359,12 +360,171 @@ static void test_decode_1bpp(void) IWICBitmapDecoder_Release(decoder); } +static const char testbmp_4bpp[] = { + /* BITMAPFILEHEADER */ + 66,77, /* "BM" */ + 82,0,0,0, /* file size */ + 0,0,0,0, /* reserved */ + 74,0,0,0, /* offset to bits */ + /* BITMAPINFOHEADER */ + 40,0,0,0, /* header size */ + 2,0,0,0, /* width */ + 254,255,255,255, /* height = -2 */ + 1,0, /* planes */ + 4,0, /* bit count */ + 0,0,0,0, /* compression = BI_RGB */ + 0,0,0,0, /* image size = 0 */ + 16,39,0,0, /* X pixels per meter = 10000 */ + 32,78,0,0, /* Y pixels per meter = 20000 */ + 5,0,0,0, /* colors used */ + 5,0,0,0, /* colors important */ + /* color table */ + 255,0,0,0, + 0,255,0,255, + 0,0,255,23, + 128,0,128,1, + 255,255,255,0, + /* bits */ + 0x01,0,0,0, + 0x23,0,0,0, +}; + +static void test_decode_4bpp(void) +{ + IWICBitmapDecoder *decoder, *decoder2; + IWICBitmapFrameDecode *framedecode; + HRESULT hr; + HGLOBAL hbmpdata; + char *bmpdata; + IStream *bmpstream; + DWORD capability=0; + GUID guidresult; + UINT count=0, width=0, height=0; + double dpiX, dpiY; + BYTE imagedata[2] = {1}; + const BYTE expected_imagedata[2] = {0x01,0x23}; + WICColor palettedata[5] = {1}; + const WICColor expected_palettedata[5] = + {0xff0000ff,0xff00ff00,0xffff0000,0xff800080,0xffffffff}; + WICRect rc; + + hr = CoCreateInstance(&CLSID_WICBmpDecoder, NULL, CLSCTX_INPROC_SERVER, + &IID_IWICBitmapDecoder, (void**)&decoder); + ok(SUCCEEDED(hr), "CoCreateInstance failed, hr=%x\n", hr); + if (!SUCCEEDED(hr)) return; + + hbmpdata = GlobalAlloc(GMEM_MOVEABLE, sizeof(testbmp_4bpp)); + ok(hbmpdata != 0, "GlobalAlloc failed\n"); + if (hbmpdata) + { + bmpdata = GlobalLock(hbmpdata); + memcpy(bmpdata, testbmp_4bpp, sizeof(testbmp_4bpp)); + GlobalUnlock(hbmpdata); + + hr = CreateStreamOnHGlobal(hbmpdata, FALSE, &bmpstream); + ok(SUCCEEDED(hr), "CreateStreamOnHGlobal failed, hr=%x\n", hr); + if (SUCCEEDED(hr)) + { + hr = IWICBitmapDecoder_Initialize(decoder, bmpstream, WICDecodeMetadataCacheOnLoad); + ok(hr == S_OK, "Initialize failed, hr=%x\n", hr); + + hr = IWICBitmapDecoder_GetContainerFormat(decoder, &guidresult); + ok(SUCCEEDED(hr), "GetContainerFormat failed, hr=%x\n", hr); + ok(IsEqualGUID(&guidresult, &GUID_ContainerFormatBmp), "unexpected container format\n"); + + hr = IWICBitmapDecoder_GetFrameCount(decoder, &count); + ok(SUCCEEDED(hr), "GetFrameCount failed, hr=%x\n", hr); + ok(count == 1, "unexpected count %u\n", count); + + hr = IWICBitmapDecoder_GetFrame(decoder, 0, &framedecode); + ok(SUCCEEDED(hr), "GetFrame failed, hr=%x\n", hr); + if (SUCCEEDED(hr)) + { + IWICImagingFactory *factory; + IWICPalette *palette; + + hr = IWICBitmapFrameDecode_GetSize(framedecode, &width, &height); + ok(SUCCEEDED(hr), "GetSize failed, hr=%x\n", hr); + ok(width == 2, "expected width=2, got %u\n", width); + ok(height == 2, "expected height=2, got %u\n", height); + + hr = IWICBitmapFrameDecode_GetResolution(framedecode, &dpiX, &dpiY); + ok(SUCCEEDED(hr), "GetResolution failed, hr=%x\n", hr); + ok(fabs(dpiX - 254.0) < 0.01, "expected dpiX=96.0, got %f\n", dpiX); + ok(fabs(dpiY - 508.0) < 0.01, "expected dpiY=96.0, got %f\n", dpiY); + + hr = IWICBitmapFrameDecode_GetPixelFormat(framedecode, &guidresult); + ok(SUCCEEDED(hr), "GetPixelFormat failed, hr=%x\n", hr); + ok(IsEqualGUID(&guidresult, &GUID_WICPixelFormat4bppIndexed), "unexpected pixel format\n"); + + hr = CoCreateInstance(&CLSID_WICImagingFactory, NULL, CLSCTX_INPROC_SERVER, + &IID_IWICImagingFactory, (void**)&factory); + ok(SUCCEEDED(hr), "CoCreateInstance failed, hr=%x\n", hr); + if (SUCCEEDED(hr)) + { + hr = IWICImagingFactory_CreatePalette(factory, &palette); + ok(SUCCEEDED(hr), "CreatePalette failed, hr=%x\n", hr); + if (SUCCEEDED(hr)) + { + hr = IWICBitmapDecoder_CopyPalette(decoder, palette); + ok(hr == WINCODEC_ERR_PALETTEUNAVAILABLE, "expected WINCODEC_ERR_PALETTEUNAVAILABLE, got %x\n", hr); + + hr = IWICBitmapFrameDecode_CopyPalette(framedecode, palette); + ok(SUCCEEDED(hr), "CopyPalette failed, hr=%x\n", hr); + + hr = IWICPalette_GetColorCount(palette, &count); + ok(SUCCEEDED(hr), "GetColorCount failed, hr=%x\n", hr); + ok(count == 5, "expected count=5, got %u\n", count); + + hr = IWICPalette_GetColors(palette, 5, palettedata, &count); + ok(SUCCEEDED(hr), "GetColorCount failed, hr=%x\n", hr); + ok(count == 5, "expected count=5, got %u\n", count); + ok(!memcmp(palettedata, expected_palettedata, sizeof(palettedata)), "unexpected palette data\n"); + + IWICPalette_Release(palette); + } + + IWICImagingFactory_Release(factory); + } + + rc.X = 0; + rc.Y = 0; + rc.Width = 2; + rc.Height = 2; + hr = IWICBitmapFrameDecode_CopyPixels(framedecode, &rc, 1, sizeof(imagedata), imagedata); + ok(SUCCEEDED(hr), "CopyPixels failed, hr=%x\n", hr); + ok(!memcmp(imagedata, expected_imagedata, sizeof(imagedata)), "unexpected image data\n"); + + IWICBitmapFrameDecode_Release(framedecode); + } + + hr = CoCreateInstance(&CLSID_WICBmpDecoder, NULL, CLSCTX_INPROC_SERVER, + &IID_IWICBitmapDecoder, (void**)&decoder2); + ok(SUCCEEDED(hr), "CoCreateInstance failed, hr=%x\n", hr); + if (SUCCEEDED(hr)) + { + hr = IWICBitmapDecoder_QueryCapability(decoder2, bmpstream, &capability); + ok(hr == S_OK, "QueryCapability failed, hr=%x\n", hr); + ok(capability == (WICBitmapDecoderCapabilityCanDecodeAllImages), + "unexpected capabilities: %x\n", capability); + } + + IStream_Release(bmpstream); + } + + GlobalFree(hbmpdata); + } + + IWICBitmapDecoder_Release(decoder); +} + START_TEST(bmpformat) { CoInitializeEx(NULL, COINIT_APARTMENTTHREADED); test_decode_24bpp(); test_decode_1bpp(); + test_decode_4bpp(); CoUninitialize(); }
1
0
0
0
Vincent Povirk : windowscodecs: Add test for 1-bit indexed color BMP.
by Alexandre Julliard
07 Jul '09
07 Jul '09
Module: wine Branch: master Commit: aec0ccbd77eaaeb1dd1f9952813140b04a45ed0b URL:
http://source.winehq.org/git/wine.git/?a=commit;h=aec0ccbd77eaaeb1dd1f99528…
Author: Vincent Povirk <vincent(a)codeweavers.com> Date: Mon Jul 6 12:22:21 2009 -0500 windowscodecs: Add test for 1-bit indexed color BMP. --- dlls/windowscodecs/tests/bmpformat.c | 149 ++++++++++++++++++++++++++++++++++ 1 files changed, 149 insertions(+), 0 deletions(-) diff --git a/dlls/windowscodecs/tests/bmpformat.c b/dlls/windowscodecs/tests/bmpformat.c index d312e80..6538e66 100644 --- a/dlls/windowscodecs/tests/bmpformat.c +++ b/dlls/windowscodecs/tests/bmpformat.c @@ -211,11 +211,160 @@ static void test_decode_24bpp(void) IWICBitmapDecoder_Release(decoder); } +static const char testbmp_1bpp[] = { + /* BITMAPFILEHEADER */ + 66,77, /* "BM" */ + 40,0,0,0, /* file size */ + 0,0,0,0, /* reserved */ + 32,0,0,0, /* offset to bits */ + /* BITMAPCOREHEADER */ + 12,0,0,0, /* header size */ + 2,0, /* width */ + 2,0, /* height */ + 1,0, /* planes */ + 1,0, /* bit count */ + /* color table */ + 255,0,0, + 0,255,0, + /* bits */ + 0xc0,0,0,0, + 0x80,0,0,0 +}; + +static void test_decode_1bpp(void) +{ + IWICBitmapDecoder *decoder, *decoder2; + IWICBitmapFrameDecode *framedecode; + HRESULT hr; + HGLOBAL hbmpdata; + char *bmpdata; + IStream *bmpstream; + DWORD capability=0; + GUID guidresult; + UINT count=0, width=0, height=0; + double dpiX, dpiY; + BYTE imagedata[2] = {1}; + const BYTE expected_imagedata[2] = {0x80,0xc0}; + WICColor palettedata[2] = {1}; + const WICColor expected_palettedata[2] = {0xff0000ff,0xff00ff00}; + WICRect rc; + + hr = CoCreateInstance(&CLSID_WICBmpDecoder, NULL, CLSCTX_INPROC_SERVER, + &IID_IWICBitmapDecoder, (void**)&decoder); + ok(SUCCEEDED(hr), "CoCreateInstance failed, hr=%x\n", hr); + if (!SUCCEEDED(hr)) return; + + hbmpdata = GlobalAlloc(GMEM_MOVEABLE, sizeof(testbmp_1bpp)); + ok(hbmpdata != 0, "GlobalAlloc failed\n"); + if (hbmpdata) + { + bmpdata = GlobalLock(hbmpdata); + memcpy(bmpdata, testbmp_1bpp, sizeof(testbmp_1bpp)); + GlobalUnlock(hbmpdata); + + hr = CreateStreamOnHGlobal(hbmpdata, FALSE, &bmpstream); + ok(SUCCEEDED(hr), "CreateStreamOnHGlobal failed, hr=%x\n", hr); + if (SUCCEEDED(hr)) + { + hr = IWICBitmapDecoder_Initialize(decoder, bmpstream, WICDecodeMetadataCacheOnLoad); + ok(hr == S_OK, "Initialize failed, hr=%x\n", hr); + + hr = IWICBitmapDecoder_GetContainerFormat(decoder, &guidresult); + ok(SUCCEEDED(hr), "GetContainerFormat failed, hr=%x\n", hr); + ok(IsEqualGUID(&guidresult, &GUID_ContainerFormatBmp), "unexpected container format\n"); + + hr = IWICBitmapDecoder_GetFrameCount(decoder, &count); + ok(SUCCEEDED(hr), "GetFrameCount failed, hr=%x\n", hr); + ok(count == 1, "unexpected count %u\n", count); + + hr = IWICBitmapDecoder_GetFrame(decoder, 0, &framedecode); + ok(SUCCEEDED(hr), "GetFrame failed, hr=%x\n", hr); + if (SUCCEEDED(hr)) + { + IWICImagingFactory *factory; + IWICPalette *palette; + + hr = IWICBitmapFrameDecode_GetSize(framedecode, &width, &height); + ok(SUCCEEDED(hr), "GetSize failed, hr=%x\n", hr); + ok(width == 2, "expected width=2, got %u\n", width); + ok(height == 2, "expected height=2, got %u\n", height); + + hr = IWICBitmapFrameDecode_GetResolution(framedecode, &dpiX, &dpiY); + ok(SUCCEEDED(hr), "GetResolution failed, hr=%x\n", hr); + ok(dpiX == 96.0, "expected dpiX=96.0, got %f\n", dpiX); + ok(dpiY == 96.0, "expected dpiY=96.0, got %f\n", dpiY); + + hr = IWICBitmapFrameDecode_GetPixelFormat(framedecode, &guidresult); + ok(SUCCEEDED(hr), "GetPixelFormat failed, hr=%x\n", hr); + ok(IsEqualGUID(&guidresult, &GUID_WICPixelFormat1bppIndexed), "unexpected pixel format\n"); + + hr = CoCreateInstance(&CLSID_WICImagingFactory, NULL, CLSCTX_INPROC_SERVER, + &IID_IWICImagingFactory, (void**)&factory); + ok(SUCCEEDED(hr), "CoCreateInstance failed, hr=%x\n", hr); + if (SUCCEEDED(hr)) + { + hr = IWICImagingFactory_CreatePalette(factory, &palette); + ok(SUCCEEDED(hr), "CreatePalette failed, hr=%x\n", hr); + if (SUCCEEDED(hr)) + { + hr = IWICBitmapDecoder_CopyPalette(decoder, palette); + ok(hr == WINCODEC_ERR_PALETTEUNAVAILABLE, "expected WINCODEC_ERR_PALETTEUNAVAILABLE, got %x\n", hr); + + hr = IWICBitmapFrameDecode_CopyPalette(framedecode, palette); + ok(SUCCEEDED(hr), "CopyPalette failed, hr=%x\n", hr); + + hr = IWICPalette_GetColorCount(palette, &count); + ok(SUCCEEDED(hr), "GetColorCount failed, hr=%x\n", hr); + ok(count == 2, "expected count=2, got %u\n", count); + + hr = IWICPalette_GetColors(palette, 2, palettedata, &count); + ok(SUCCEEDED(hr), "GetColorCount failed, hr=%x\n", hr); + ok(count == 2, "expected count=2, got %u\n", count); + ok(!memcmp(palettedata, expected_palettedata, sizeof(palettedata)), "unexpected palette data\n"); + + IWICPalette_Release(palette); + } + + IWICImagingFactory_Release(factory); + } + + rc.X = 0; + rc.Y = 0; + rc.Width = 2; + rc.Height = 2; + hr = IWICBitmapFrameDecode_CopyPixels(framedecode, &rc, 1, sizeof(imagedata), imagedata); + ok(SUCCEEDED(hr), "CopyPixels failed, hr=%x\n", hr); + ok(!memcmp(imagedata, expected_imagedata, sizeof(imagedata)), "unexpected image data\n"); + + IWICBitmapFrameDecode_Release(framedecode); + } + + hr = CoCreateInstance(&CLSID_WICBmpDecoder, NULL, CLSCTX_INPROC_SERVER, + &IID_IWICBitmapDecoder, (void**)&decoder2); + ok(SUCCEEDED(hr), "CoCreateInstance failed, hr=%x\n", hr); + if (SUCCEEDED(hr)) + { + hr = IWICBitmapDecoder_QueryCapability(decoder2, bmpstream, &capability); + ok(hr == S_OK, "QueryCapability failed, hr=%x\n", hr); + ok(capability == (WICBitmapDecoderCapabilityCanDecodeAllImages), + "unexpected capabilities: %x\n", capability); + } + + IStream_Release(bmpstream); + } + + GlobalFree(hbmpdata); + } + + IWICBitmapDecoder_Release(decoder); +} + START_TEST(bmpformat) { CoInitializeEx(NULL, COINIT_APARTMENTTHREADED); test_decode_24bpp(); + test_decode_1bpp(); CoUninitialize(); }
1
0
0
0
Vincent Povirk : windowscodecs: Implement CopyPalette for BMP decoder.
by Alexandre Julliard
07 Jul '09
07 Jul '09
Module: wine Branch: master Commit: 3899c3e2472b22156ab2a2e7aeff65ef0212cfe3 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=3899c3e2472b22156ab2a2e7a…
Author: Vincent Povirk <vincent(a)codeweavers.com> Date: Mon Jul 6 11:39:29 2009 -0500 windowscodecs: Implement CopyPalette for BMP decoder. --- dlls/windowscodecs/bmpdecode.c | 102 ++++++++++++++++++++++++++++++++- dlls/windowscodecs/tests/bmpformat.c | 24 ++++++++ include/wincodec.idl | 1 + 3 files changed, 123 insertions(+), 4 deletions(-) diff --git a/dlls/windowscodecs/bmpdecode.c b/dlls/windowscodecs/bmpdecode.c index b81987c..61d68c1 100644 --- a/dlls/windowscodecs/bmpdecode.c +++ b/dlls/windowscodecs/bmpdecode.c @@ -189,8 +189,101 @@ static HRESULT WINAPI BmpFrameDecode_GetResolution(IWICBitmapFrameDecode *iface, static HRESULT WINAPI BmpFrameDecode_CopyPalette(IWICBitmapFrameDecode *iface, IWICPalette *pIPalette) { - FIXME("(%p,%p): stub\n", iface, pIPalette); - return E_NOTIMPL; + HRESULT hr; + BmpFrameDecode *This = (BmpFrameDecode*)iface; + TRACE("(%p,%p)\n", iface, pIPalette); + + if (This->bih.bV5Size == sizeof(BITMAPCOREHEADER)) + { + BITMAPCOREHEADER *bch = (BITMAPCOREHEADER*)&This->bih; + if (bch->bcBitCount <= 8) + { + /* 2**n colors in BGR format after the header */ + int count = 1 << bch->bcBitCount; + WICColor *wiccolors; + ULONG tablesize, bytesread; + RGBTRIPLE *bgrcolors; + LARGE_INTEGER offset; + int i; + + wiccolors = HeapAlloc(GetProcessHeap(), 0, sizeof(WICColor) * count); + tablesize = sizeof(RGBTRIPLE) * count; + bgrcolors = HeapAlloc(GetProcessHeap(), 0, tablesize); + if (!wiccolors || !bgrcolors) + { + HeapFree(GetProcessHeap(), 0, wiccolors); + HeapFree(GetProcessHeap(), 0, bgrcolors); + return E_OUTOFMEMORY; + } + + offset.QuadPart = sizeof(BITMAPFILEHEADER)+sizeof(BITMAPCOREHEADER); + hr = IStream_Seek(This->stream, offset, STREAM_SEEK_SET, NULL); + if (FAILED(hr)) return hr; + + hr = IStream_Read(This->stream, bgrcolors, tablesize, &bytesread); + if (FAILED(hr)) return hr; + if (bytesread != tablesize) return E_FAIL; + + for (i=0; i<count; i++) + { + wiccolors[i] = 0xff000000| + (bgrcolors[i].rgbtRed<<16)| + (bgrcolors[i].rgbtGreen<<8)| + bgrcolors[i].rgbtBlue; + } + + hr = IWICPalette_InitializeCustom(pIPalette, wiccolors, count); + + HeapFree(GetProcessHeap(), 0, wiccolors); + HeapFree(GetProcessHeap(), 0, bgrcolors); + return hr; + } + else + { + return WINCODEC_ERR_PALETTEUNAVAILABLE; + } + } + else + { + if (This->bih.bV5BitCount <= 8) + { + int count; + WICColor *wiccolors; + ULONG tablesize, bytesread; + LARGE_INTEGER offset; + int i; + + if (This->bih.bV5ClrUsed == 0) + count = 1 << This->bih.bV5BitCount; + else + count = This->bih.bV5ClrUsed; + + tablesize = sizeof(WICColor) * count; + wiccolors = HeapAlloc(GetProcessHeap(), 0, tablesize); + if (!wiccolors) return E_OUTOFMEMORY; + + offset.QuadPart = sizeof(BITMAPFILEHEADER) + This->bih.bV5Size; + hr = IStream_Seek(This->stream, offset, STREAM_SEEK_SET, NULL); + if (FAILED(hr)) return hr; + + hr = IStream_Read(This->stream, wiccolors, tablesize, &bytesread); + if (FAILED(hr)) return hr; + if (bytesread != tablesize) return E_FAIL; + + /* convert from BGR to BGRA by setting alpha to 100% */ + for (i=0; i<count; i++) + wiccolors[i] |= 0xff000000; + + hr = IWICPalette_InitializeCustom(pIPalette, wiccolors, count); + + HeapFree(GetProcessHeap(), 0, wiccolors); + return hr; + } + else + { + return WINCODEC_ERR_PALETTEUNAVAILABLE; + } + } } static HRESULT WINAPI BmpFrameDecode_CopyPixels(IWICBitmapFrameDecode *iface, @@ -536,8 +629,9 @@ static HRESULT WINAPI BmpDecoder_GetDecoderInfo(IWICBitmapDecoder *iface, static HRESULT WINAPI BmpDecoder_CopyPalette(IWICBitmapDecoder *iface, IWICPalette *pIPalette) { - FIXME("(%p,%p): stub\n", iface, pIPalette); - return E_NOTIMPL; + TRACE("(%p,%p)\n", iface, pIPalette); + + return WINCODEC_ERR_PALETTEUNAVAILABLE; } static HRESULT WINAPI BmpDecoder_GetMetadataQueryReader(IWICBitmapDecoder *iface, diff --git a/dlls/windowscodecs/tests/bmpformat.c b/dlls/windowscodecs/tests/bmpformat.c index fb6f491..d312e80 100644 --- a/dlls/windowscodecs/tests/bmpformat.c +++ b/dlls/windowscodecs/tests/bmpformat.c @@ -98,6 +98,9 @@ static void test_decode_24bpp(void) ok(SUCCEEDED(hr), "GetFrame failed, hr=%x\n", hr); if (SUCCEEDED(hr)) { + IWICImagingFactory *factory; + IWICPalette *palette; + hr = IWICBitmapFrameDecode_GetSize(framedecode, &width, &height); ok(SUCCEEDED(hr), "GetSize failed, hr=%x\n", hr); ok(width == 2, "expected width=2, got %u\n", width); @@ -112,6 +115,27 @@ static void test_decode_24bpp(void) ok(SUCCEEDED(hr), "GetPixelFormat failed, hr=%x\n", hr); ok(IsEqualGUID(&guidresult, &GUID_WICPixelFormat24bppBGR), "unexpected pixel format\n"); + hr = CoCreateInstance(&CLSID_WICImagingFactory, NULL, CLSCTX_INPROC_SERVER, + &IID_IWICImagingFactory, (void**)&factory); + ok(SUCCEEDED(hr), "CoCreateInstance failed, hr=%x\n", hr); + if (SUCCEEDED(hr)) + { + hr = IWICImagingFactory_CreatePalette(factory, &palette); + ok(SUCCEEDED(hr), "CreatePalette failed, hr=%x\n", hr); + if (SUCCEEDED(hr)) + { + hr = IWICBitmapDecoder_CopyPalette(decoder, palette); + ok(hr == WINCODEC_ERR_PALETTEUNAVAILABLE, "expected WINCODEC_ERR_PALETTEUNAVAILABLE, got %x\n", hr); + + hr = IWICBitmapFrameDecode_CopyPalette(framedecode, palette); + ok(hr == WINCODEC_ERR_PALETTEUNAVAILABLE, "expected WINCODEC_ERR_PALETTEUNAVAILABLE, got %x\n", hr); + + IWICPalette_Release(palette); + } + + IWICImagingFactory_Release(factory); + } + rc.X = 0; rc.Y = 0; rc.Width = 3; diff --git a/include/wincodec.idl b/include/wincodec.idl index e5f22e3..d8712b8 100644 --- a/include/wincodec.idl +++ b/include/wincodec.idl @@ -95,6 +95,7 @@ typedef UINT32 WICColor; cpp_quote("#define WINCODEC_ERR_WRONGSTATE 0x88982f04") cpp_quote("#define WINCODEC_ERR_CODECNOTHUMBNAIL 0x88982f44") +cpp_quote("#define WINCODEC_ERR_PALETTEUNAVAILABLE 0x88982f45") interface IWICBitmap; interface IWICComponentInfo;
1
0
0
0
Hans Leidekker : winhttp: Implement WinHttpSetTimeouts.
by Alexandre Julliard
07 Jul '09
07 Jul '09
Module: wine Branch: master Commit: 9d9c505a273edbb79ce7dc60a324d2bbf6a2bdab URL:
http://source.winehq.org/git/wine.git/?a=commit;h=9d9c505a273edbb79ce7dc60a…
Author: Hans Leidekker <hans(a)codeweavers.com> Date: Tue Jul 7 10:14:11 2009 +0200 winhttp: Implement WinHttpSetTimeouts. --- dlls/winhttp/session.c | 36 ++++++++++++++++++++++++++++++++++-- dlls/winhttp/winhttp_private.h | 1 + 2 files changed, 35 insertions(+), 2 deletions(-) diff --git a/dlls/winhttp/session.c b/dlls/winhttp/session.c index 11c4b4f..55f9779 100644 --- a/dlls/winhttp/session.c +++ b/dlls/winhttp/session.c @@ -737,8 +737,40 @@ WINHTTP_STATUS_CALLBACK WINAPI WinHttpSetStatusCallback( HINTERNET handle, WINHT */ BOOL WINAPI WinHttpSetTimeouts( HINTERNET handle, int resolve, int connect, int send, int receive ) { - FIXME("%p, %d, %d, %d, %d\n", handle, resolve, connect, send, receive); - return TRUE; + BOOL ret = TRUE; + request_t *request; + + TRACE("%p, %d, %d, %d, %d\n", handle, resolve, connect, send, receive); + + if (resolve < -1 || connect < -1 || send < -1 || receive < -1) + { + set_last_error( ERROR_INVALID_PARAMETER ); + return FALSE; + } + + FIXME("resolve and connect timeout not supported\n"); + + if (!(request = (request_t *)grab_object( handle ))) + { + set_last_error( ERROR_INVALID_HANDLE ); + return FALSE; + } + + if (request->hdr.type != WINHTTP_HANDLE_TYPE_REQUEST) + { + release_object( &request->hdr ); + set_last_error( ERROR_WINHTTP_INCORRECT_HANDLE_TYPE ); + return FALSE; + } + + if (send < 0) send = 0; + if (netconn_set_timeout( &request->netconn, TRUE, send )) ret = FALSE; + + if (receive < 0) receive = 0; + if (netconn_set_timeout( &request->netconn, FALSE, receive )) ret = FALSE; + + release_object( &request->hdr ); + return ret; } static const WCHAR wkday[7][4] = diff --git a/dlls/winhttp/winhttp_private.h b/dlls/winhttp/winhttp_private.h index 511e124..823d0ae 100644 --- a/dlls/winhttp/winhttp_private.h +++ b/dlls/winhttp/winhttp_private.h @@ -214,6 +214,7 @@ BOOL netconn_recv( netconn_t *, void *, size_t, int, int * ); BOOL netconn_resolve( WCHAR *, INTERNET_PORT, struct sockaddr_in * ); BOOL netconn_secure_connect( netconn_t * ); BOOL netconn_send( netconn_t *, const void *, size_t, int, int * ); +DWORD netconn_set_timeout( netconn_t *, BOOL, int ); const void *netconn_get_certificate( netconn_t * ); BOOL set_cookies( request_t *, const WCHAR * );
1
0
0
0
← Newer
1
...
76
77
78
79
80
81
82
...
107
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
Results per page:
10
25
50
100
200