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
October 2016
----- 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
2 participants
451 discussions
Start a n
N
ew thread
Huw Davies : riched20: Add the ability to create ME_Strings from constants.
by Alexandre Julliard
07 Oct '16
07 Oct '16
Module: wine Branch: master Commit: 1abe4cc738699f72479e72712b8fdb36e3a91431 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=1abe4cc738699f72479e72712…
Author: Huw Davies <huw(a)codeweavers.com> Date: Fri Oct 7 10:49:33 2016 +0100 riched20: Add the ability to create ME_Strings from constants. Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/riched20/editor.h | 1 + dlls/riched20/editstr.h | 1 + dlls/riched20/string.c | 37 ++++++++++++++++++++++++++++++++----- 3 files changed, 34 insertions(+), 5 deletions(-) diff --git a/dlls/riched20/editor.h b/dlls/riched20/editor.h index b0a8a1a..24c856b 100644 --- a/dlls/riched20/editor.h +++ b/dlls/riched20/editor.h @@ -100,6 +100,7 @@ void ME_DumpDocument(ME_TextBuffer *buffer) DECLSPEC_HIDDEN; /* string.c */ ME_String *ME_MakeStringN(LPCWSTR szText, int nMaxChars) DECLSPEC_HIDDEN; ME_String *ME_MakeStringR(WCHAR cRepeat, int nMaxChars) DECLSPEC_HIDDEN; +ME_String *ME_MakeStringConst(const WCHAR *str, int len) DECLSPEC_HIDDEN; void ME_DestroyString(ME_String *s) DECLSPEC_HIDDEN; BOOL ME_AppendString(ME_String *s, const WCHAR *append, int len) DECLSPEC_HIDDEN; ME_String *ME_VSplitString(ME_String *orig, int nVPos) DECLSPEC_HIDDEN; diff --git a/dlls/riched20/editstr.h b/dlls/riched20/editstr.h index 35555a9..0e60a3d 100644 --- a/dlls/riched20/editstr.h +++ b/dlls/riched20/editstr.h @@ -58,6 +58,7 @@ typedef struct tagME_String { WCHAR *szData; int nLen, nBuffer; + void (*free)(struct tagME_String *); } ME_String; typedef struct tagME_FontCacheItem diff --git a/dlls/riched20/string.c b/dlls/riched20/string.c index ef06bac..47aceca 100644 --- a/dlls/riched20/string.c +++ b/dlls/riched20/string.c @@ -27,10 +27,37 @@ static int ME_GetOptimalBuffer(int nLen) return ((sizeof(WCHAR) * nLen) + 128) & ~63; } +static ME_String *make_string( void (*free)(ME_String *) ) +{ + ME_String *s = heap_alloc( sizeof(*s) ); + + if (s) s->free = free; + return s; +} + +/* Create a ME_String using the const string provided. + * str must exist for the lifetime of the returned ME_String. + */ +ME_String *ME_MakeStringConst(const WCHAR *str, int len) +{ + ME_String *s = make_string( NULL ); + if (!s) return NULL; + + s->szData = (WCHAR *)str; + s->nLen = len; + s->nBuffer = 0; + return s; +} + +static void heap_string_free(ME_String *s) +{ + heap_free( s->szData ); +} + /* Create a buffer (uninitialized string) of size nMaxChars */ static ME_String *ME_MakeStringB(int nMaxChars) { - ME_String *s = heap_alloc( sizeof(*s) ); + ME_String *s = make_string( heap_string_free ); if (!s) return NULL; s->nLen = nMaxChars; @@ -69,7 +96,7 @@ ME_String *ME_MakeStringR(WCHAR cRepeat, int nMaxChars) void ME_DestroyString(ME_String *s) { if (!s) return; - heap_free( s->szData ); + if (s->free) s->free( s ); heap_free( s ); } @@ -78,6 +105,7 @@ BOOL ME_InsertString(ME_String *s, int ofs, const WCHAR *insert, int len) DWORD new_len = s->nLen + len + 1; WCHAR *new; + assert( s->nBuffer ); /* Not a const string */ assert( ofs <= s->nLen ); if( new_len > s->nBuffer ) @@ -104,9 +132,7 @@ ME_String *ME_VSplitString(ME_String *orig, int charidx) { ME_String *s; - /*if (charidx<0) charidx = 0; - if (charidx>orig->nLen) charidx = orig->nLen; - */ + assert(orig->nBuffer); /* Not a const string */ assert(charidx>=0); assert(charidx<=orig->nLen); @@ -122,6 +148,7 @@ void ME_StrDeleteV(ME_String *s, int nVChar, int nChars) { int end_ofs = nVChar + nChars; + assert(s->nBuffer); /* Not a const string */ assert(nChars >= 0); assert(nVChar >= 0); assert(end_ofs <= s->nLen);
1
0
0
0
Huw Davies : riched20: Implement parsing of the paragraph numbering destination.
by Alexandre Julliard
07 Oct '16
07 Oct '16
Module: wine Branch: master Commit: 880b45ffb011a191c8b535cb346f88c220d74db7 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=880b45ffb011a191c8b535cb3…
Author: Huw Davies <huw(a)codeweavers.com> Date: Fri Oct 7 10:49:32 2016 +0100 riched20: Implement parsing of the paragraph numbering destination. Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/riched20/editor.c | 117 ++++++++++++++++++++++++++++++++++++++----- dlls/riched20/reader.c | 4 +- dlls/riched20/tests/editor.c | 69 +++++++++++++++++++++++++ 3 files changed, 176 insertions(+), 14 deletions(-) diff --git a/dlls/riched20/editor.c b/dlls/riched20/editor.c index da9425e..162daa8 100644 --- a/dlls/riched20/editor.c +++ b/dlls/riched20/editor.c @@ -763,18 +763,6 @@ void ME_RTFParAttrHook(RTF_Info *info) info->fmt.dwMask |= PFM_NUMBERING; info->fmt.wNumbering = 2; /* FIXME: MSDN says it's not used ?? */ break; - case rtfParNumDecimal: - info->fmt.dwMask |= PFM_NUMBERING; - info->fmt.wNumbering = 2; /* FIXME: MSDN says it's not used ?? */ - break; - case rtfParNumIndent: - info->fmt.dwMask |= PFM_NUMBERINGTAB; - info->fmt.wNumberingTab = info->rtfParam; - break; - case rtfParNumStartAt: - info->fmt.dwMask |= PFM_NUMBERINGSTART; - info->fmt.wNumberingStart = info->rtfParam; - break; case rtfBorderLeft: info->borderType = RTFBorderParaLeft; info->fmt.wBorders |= 1; @@ -1432,6 +1420,110 @@ static void ME_RTFReadObjectGroup(RTF_Info *info) RTFRouteToken(info); /* feed "}" back to router */ } +static void ME_RTFReadParnumGroup( RTF_Info *info ) +{ + int level = 1, type = -1; + WORD indent = 0, start = 1; + WCHAR txt_before = 0, txt_after = 0; + + for (;;) + { + RTFGetToken( info ); + + if (RTFCheckCMM( info, rtfControl, rtfDestination, rtfParNumTextBefore ) || + RTFCheckCMM( info, rtfControl, rtfDestination, rtfParNumTextAfter )) + { + int loc = info->rtfMinor; + + RTFGetToken( info ); + if (info->rtfClass == rtfText) + { + if (loc == rtfParNumTextBefore) + txt_before = info->rtfMajor; + else + txt_after = info->rtfMajor; + continue; + } + /* falling through to catch EOFs and group level changes */ + } + + if (info->rtfClass == rtfEOF) + return; + + if (RTFCheckCM( info, rtfGroup, rtfEndGroup )) + { + if (--level == 0) break; + continue; + } + + if (RTFCheckCM( info, rtfGroup, rtfBeginGroup )) + { + level++; + continue; + } + + /* Ignore non para-attr */ + if (!RTFCheckCM( info, rtfControl, rtfParAttr )) + continue; + + switch (info->rtfMinor) + { + case rtfParLevel: /* Para level is ignored */ + case rtfParSimple: + break; + case rtfParBullet: + type = PFN_BULLET; + break; + + case rtfParNumDecimal: + type = PFN_ARABIC; + break; + case rtfParNumULetter: + type = PFN_UCLETTER; + break; + case rtfParNumURoman: + type = PFN_UCROMAN; + break; + case rtfParNumLLetter: + type = PFN_LCLETTER; + break; + case rtfParNumLRoman: + type = PFN_LCROMAN; + break; + + case rtfParNumIndent: + indent = info->rtfParam; + break; + case rtfParNumStartAt: + start = info->rtfParam; + break; + } + } + + if (type != -1) + { + info->fmt.dwMask |= (PFM_NUMBERING | PFM_NUMBERINGSTART | PFM_NUMBERINGSTYLE | PFM_NUMBERINGTAB); + info->fmt.wNumbering = type; + info->fmt.wNumberingStart = start; + info->fmt.wNumberingStyle = PFNS_PAREN; + if (type != PFN_BULLET) + { + if (txt_before == 0 && txt_after == 0) + info->fmt.wNumberingStyle = PFNS_PLAIN; + else if (txt_after == '.') + info->fmt.wNumberingStyle = PFNS_PERIOD; + else if (txt_before == '(' && txt_after == ')') + info->fmt.wNumberingStyle = PFNS_PARENS; + } + info->fmt.wNumberingTab = indent; + } + + TRACE("type %d indent %d start %d txt before %04x txt after %04x\n", + type, indent, start, txt_before, txt_after); + + RTFRouteToken( info ); /* feed "}" back to router */ +} + static void ME_RTFReadHook(RTF_Info *info) { switch(info->rtfClass) @@ -1581,6 +1673,7 @@ static LRESULT ME_StreamIn(ME_TextEditor *editor, DWORD format, EDITSTREAM *stre RTFSetDestinationCallback(&parser, rtfShpPict, ME_RTFReadShpPictGroup); RTFSetDestinationCallback(&parser, rtfPict, ME_RTFReadPictGroup); RTFSetDestinationCallback(&parser, rtfObject, ME_RTFReadObjectGroup); + RTFSetDestinationCallback(&parser, rtfParNumbering, ME_RTFReadParnumGroup); if (!parser.editor->bEmulateVersion10) /* v4.1 */ { RTFSetDestinationCallback(&parser, rtfNoNestTables, RTFSkipGroup); diff --git a/dlls/riched20/reader.c b/dlls/riched20/reader.c index 2e5dafd..a05b7fc 100644 --- a/dlls/riched20/reader.c +++ b/dlls/riched20/reader.c @@ -1774,8 +1774,8 @@ static RTFKey rtfKey[] = { rtfDestination, rtfFooterFirst, "footerf", 0 }, { rtfDestination, rtfParNumText, "pntext", 0 }, { rtfDestination, rtfParNumbering, "pn", 0 }, - { rtfDestination, rtfParNumTextAfter, "pntexta", 0 }, - { rtfDestination, rtfParNumTextBefore, "pntextb", 0 }, + { rtfDestination, rtfParNumTextAfter, "pntxta", 0 }, + { rtfDestination, rtfParNumTextBefore, "pntxtb", 0 }, { rtfDestination, rtfBookmarkStart, "bkmkstart", 0 }, { rtfDestination, rtfBookmarkEnd, "bkmkend", 0 }, { rtfDestination, rtfPict, "pict", 0 }, diff --git a/dlls/riched20/tests/editor.c b/dlls/riched20/tests/editor.c index ad51e64..d694d28 100644 --- a/dlls/riched20/tests/editor.c +++ b/dlls/riched20/tests/editor.c @@ -8414,6 +8414,74 @@ static void test_eop_char_fmt(void) DestroyWindow( edit ); } +static void test_para_numbering(void) +{ + HWND edit = new_richeditW( NULL ); + const char *numbers = "{\\rtf1{\\fonttbl{\\f0\\fswiss\\fprq2\\fcharset0 Arial;}{\\f1\\fnil\\fcharset2 Symbol;}}" + "\\pard{\\pntext\\f0 3.\\tab}{\\*\\pn\\pnlvlbody\\pnfs32\\pnf0\\pnindent1000\\pnstart2\\pndec{\\pntxta.}}" + "\\fs20\\fi200\\li360\\f0 First\\par" + "{\\pntext\\f0 4.\\tab}\\f0 Second\\par" + "{\\pntext\\f0 6.\\tab}\\f0 Third\\par}"; + const WCHAR expect_numbers_txt[] = {'F','i','r','s','t','\r','S','e','c','o','n','d','\r','T','h','i','r','d',0}; + EDITSTREAM es; + WCHAR buf[80]; + LRESULT result; + PARAFORMAT2 fmt, fmt2; + GETTEXTEX get_text; + CHARFORMAT2W cf; + + get_text.cb = sizeof(buf); + get_text.flags = GT_RAWTEXT; + get_text.codepage = 1200; + get_text.lpDefaultChar = NULL; + get_text.lpUsedDefChar = NULL; + + es.dwCookie = (DWORD_PTR)&numbers; + es.dwError = 0; + es.pfnCallback = test_EM_STREAMIN_esCallback; + result = SendMessageA( edit, EM_STREAMIN, SF_RTF, (LPARAM)&es ); + ok( result == lstrlenW( expect_numbers_txt ), "got %ld\n", result ); + + result = SendMessageW( edit, EM_GETTEXTEX, (WPARAM)&get_text, (LPARAM)buf ); + ok( result == lstrlenW( expect_numbers_txt ), "got %ld\n", result ); + ok( !lstrcmpW( buf, expect_numbers_txt ), "got %s\n", wine_dbgstr_w(buf) ); + + SendMessageW( edit, EM_SETSEL, 1, 1 ); + memset( &fmt, 0, sizeof(fmt) ); + fmt.cbSize = sizeof(fmt); + fmt.dwMask = PFM_ALL2; + SendMessageW( edit, EM_GETPARAFORMAT, 0, (LPARAM)&fmt ); + ok( fmt.wNumbering == PFN_ARABIC, "got %d\n", fmt.wNumbering ); + ok( fmt.wNumberingStart == 2, "got %d\n", fmt.wNumberingStart ); + ok( fmt.wNumberingStyle == PFNS_PERIOD, "got %04x\n", fmt.wNumberingStyle ); + ok( fmt.wNumberingTab == 1000, "got %d\n", fmt.wNumberingTab ); + ok( fmt.dxStartIndent == 560, "got %d\n", fmt.dxStartIndent ); + ok( fmt.dxOffset == -200, "got %d\n", fmt.dxOffset ); + + /* Second para should have identical fmt */ + SendMessageW( edit, EM_SETSEL, 10, 10 ); + memset( &fmt2, 0, sizeof(fmt2) ); + fmt2.cbSize = sizeof(fmt2); + fmt2.dwMask = PFM_ALL2; + SendMessageW( edit, EM_GETPARAFORMAT, 0, (LPARAM)&fmt2 ); + ok( !memcmp( &fmt, &fmt2, sizeof(fmt) ), "format mismatch\n" ); + + /* Check the eop heights - this determines the label height */ + SendMessageW( edit, EM_SETSEL, 12, 13 ); + cf.cbSize = sizeof(cf); + cf.dwMask = CFM_SIZE; + SendMessageW( edit, EM_GETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf ); + ok( cf.yHeight == 200, "got %d\n", cf.yHeight ); + + SendMessageW( edit, EM_SETSEL, 18, 19 ); + cf.cbSize = sizeof(cf); + cf.dwMask = CFM_SIZE; + SendMessageW( edit, EM_GETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf ); + ok( cf.yHeight == 200, "got %d\n", cf.yHeight ); + + DestroyWindow( edit ); +} + START_TEST( editor ) { BOOL ret; @@ -8486,6 +8554,7 @@ START_TEST( editor ) test_rtf_specials(); test_background(); test_eop_char_fmt(); + test_para_numbering(); /* Set the environment variable WINETEST_RICHED20 to keep windows * responsive and open for 30 seconds. This is useful for debugging.
1
0
0
0
Huw Davies : riched20: Reset the numbering style info after a \pard .
by Alexandre Julliard
07 Oct '16
07 Oct '16
Module: wine Branch: master Commit: 57446ceed35c67eb9230f91700126f98b28edcf2 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=57446ceed35c67eb9230f9170…
Author: Huw Davies <huw(a)codeweavers.com> Date: Fri Oct 7 10:49:31 2016 +0100 riched20: Reset the numbering style info after a \pard . Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/riched20/editor.c | 10 ++++++++-- dlls/riched20/tests/editor.c | 6 ++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/dlls/riched20/editor.c b/dlls/riched20/editor.c index e2a44d3..da9425e 100644 --- a/dlls/riched20/editor.c +++ b/dlls/riched20/editor.c @@ -553,8 +553,9 @@ void ME_RTFParAttrHook(RTF_Info *info) info->borderType = RTFBorderParaTop; info->fmt.dwMask = PFM_ALIGNMENT | PFM_BORDER | PFM_LINESPACING | PFM_TABSTOPS | PFM_OFFSET | PFM_RIGHTINDENT | PFM_SPACEAFTER | PFM_SPACEBEFORE | - PFM_STARTINDENT | PFM_RTLPARA; - /* TODO: numbering, shading */ + PFM_STARTINDENT | PFM_RTLPARA | PFM_NUMBERING | PFM_NUMBERINGSTART | + PFM_NUMBERINGSTYLE | PFM_NUMBERINGTAB; + /* TODO: shading */ info->fmt.wAlignment = PFA_LEFT; info->fmt.cTabCount = 0; info->fmt.dxOffset = info->fmt.dxStartIndent = info->fmt.dxRightIndent = 0; @@ -564,6 +565,11 @@ void ME_RTFParAttrHook(RTF_Info *info) info->fmt.dySpaceBefore = info->fmt.dySpaceAfter = 0; info->fmt.dyLineSpacing = 0; info->fmt.wEffects &= ~PFE_RTLPARA; + info->fmt.wNumbering = 0; + info->fmt.wNumberingStart = 0; + info->fmt.wNumberingStyle = 0; + info->fmt.wNumberingTab = 0; + if (!info->editor->bEmulateVersion10) /* v4.1 */ { if (info->tableDef && info->tableDef->tableRowStart && diff --git a/dlls/riched20/tests/editor.c b/dlls/riched20/tests/editor.c index 351695a..ad51e64 100644 --- a/dlls/riched20/tests/editor.c +++ b/dlls/riched20/tests/editor.c @@ -1307,6 +1307,12 @@ static void test_SETPARAFORMAT(void) ok(ret == expectedMask, "expected %x got %x\n", expectedMask, ret); ok(fmt.dwMask == expectedMask, "expected %x got %x\n", expectedMask, fmt.dwMask); + /* Test some other paraformat field defaults */ + ok( fmt.wNumbering == 0, "got %d\n", fmt.wNumbering ); + ok( fmt.wNumberingStart == 0, "got %d\n", fmt.wNumberingStart ); + ok( fmt.wNumberingStyle == 0, "got %04x\n", fmt.wNumberingStyle ); + ok( fmt.wNumberingTab == 0, "got %d\n", fmt.wNumberingTab ); + DestroyWindow(hwndRichEdit); }
1
0
0
0
Huw Davies : riched20: Don't try to wrap the end-of-paragraph run.
by Alexandre Julliard
07 Oct '16
07 Oct '16
Module: wine Branch: master Commit: ab65c269f7c6979712a83cc9105a24cdacee2cf7 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=ab65c269f7c6979712a83cc91…
Author: Huw Davies <huw(a)codeweavers.com> Date: Fri Oct 7 10:49:30 2016 +0100 riched20: Don't try to wrap the end-of-paragraph run. Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/riched20/wrap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dlls/riched20/wrap.c b/dlls/riched20/wrap.c index 24a7b16..4c73c5d 100644 --- a/dlls/riched20/wrap.c +++ b/dlls/riched20/wrap.c @@ -624,8 +624,8 @@ static ME_DisplayItem *ME_WrapHandleRun(ME_WrapContext *wc, ME_DisplayItem *p) wc->pt.x + run->nWidth - wc->context->pt.x > wc->nAvailWidth) { int loc = wc->context->pt.x + wc->nAvailWidth - wc->pt.x; - /* total white run ? */ - if (run->nFlags & MERF_WHITESPACE) { + /* total white run or end para */ + if (run->nFlags & (MERF_WHITESPACE | MERF_ENDPARA)) { /* let the overflow logic handle it */ wc->bOverflown = TRUE; return p;
1
0
0
0
Matteo Bruni : d3d9/tests: Add a test for the dsy SM3 instruction.
by Alexandre Julliard
07 Oct '16
07 Oct '16
Module: wine Branch: master Commit: 13ae8c91d1fc1b35d0bf2e88108922188653c1b9 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=13ae8c91d1fc1b35d0bf2e881…
Author: Matteo Bruni <mbruni(a)codeweavers.com> Date: Fri Oct 7 00:57:53 2016 +0200 d3d9/tests: Add a test for the dsy SM3 instruction. Signed-off-by: Matteo Bruni <mbruni(a)codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/d3d9/tests/visual.c | 128 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 128 insertions(+) diff --git a/dlls/d3d9/tests/visual.c b/dlls/d3d9/tests/visual.c index 162620f..20e3eb9 100644 --- a/dlls/d3d9/tests/visual.c +++ b/dlls/d3d9/tests/visual.c @@ -21804,6 +21804,133 @@ static void test_line_antialiasing_blending(void) DestroyWindow(window); } +static void test_dsy(void) +{ + static const DWORD vs_code[] = + { + 0xfffe0300, /* vs_3_0 */ + 0x0200001f, 0x80000000, 0x900f0000, /* dcl_position v0 */ + 0x0200001f, 0x8000000a, 0x900f0001, /* dcl_color0 v1 */ + 0x0200001f, 0x80000000, 0xe00f0000, /* dcl_position o0 */ + 0x0200001f, 0x8000000a, 0xe00f0001, /* dcl_color0 o1 */ + 0x02000001, 0xe00f0000, 0x90e40000, /* mov o0, v0 */ + 0x02000001, 0xe00f0001, 0x90e40001, /* mov o1, v1 */ + 0x0000ffff + }; + static const DWORD ps_code[] = + { + 0xffff0300, /* ps_3_0 */ + 0x0200001f, 0x8000000a, 0x900f0000, /* dcl_color0 v0 */ + 0x05000051, 0xa00f0000, 0x43700000, 0x3f000000, 0x00000000, 0x00000000, /* def c0, 240.0, 0.5, 0.0, 0.0 */ + 0x0200005c, 0x800f0000, 0x90e40000, /* dsy r0, v0 */ + 0x03000005, 0x800f0000, 0x80e40000, 0xa0000000, /* mul r0, r0, c0.x */ + 0x03000002, 0x800f0800, 0x80e40000, 0xa0550000, /* add oC0, r0, c0.y */ + 0x0000ffff + }; + static const struct + { + struct vec3 pos; + D3DCOLOR color; + } + quad[] = + { + {{-1.0f, -1.0f, 0.1f}, 0x00ff0000}, + {{-1.0f, 1.0f, 0.1f}, 0x0000ff00}, + {{ 1.0f, -1.0f, 0.1f}, 0x00ff0000}, + {{ 1.0f, 1.0f, 0.1f}, 0x0000ff00}, + }; + IDirect3DSurface9 *backbuffer, *rt; + IDirect3DVertexShader9 *vs; + IDirect3DPixelShader9 *ps; + IDirect3DDevice9 *device; + IDirect3D9 *d3d; + ULONG refcount; + D3DCAPS9 caps; + DWORD color; + HWND window; + HRESULT hr; + + window = create_window(); + d3d = Direct3DCreate9(D3D_SDK_VERSION); + ok(!!d3d, "Failed to create a D3D object.\n"); + if (!(device = create_device(d3d, window, window, TRUE))) + { + skip("Failed to create a D3D device, skipping tests.\n"); + goto done; + } + + hr = IDirect3DDevice9_GetDeviceCaps(device, &caps); + ok(SUCCEEDED(hr), "Failed to get device caps, hr %#x.\n", hr); + if (caps.PixelShaderVersion < D3DPS_VERSION(3, 0)) + { + skip("No ps_3_0 support, skipping dsy tests.\n"); + IDirect3DDevice9_Release(device); + goto done; + } + + hr = IDirect3DDevice9_GetBackBuffer(device, 0, 0, D3DBACKBUFFER_TYPE_MONO, &backbuffer); + ok(SUCCEEDED(hr), "Failed to get backbuffer, hr %#x.\n", hr); + + hr = IDirect3DDevice9_CreateRenderTarget(device, 640, 480, D3DFMT_A8R8G8B8, + D3DMULTISAMPLE_NONE, 0, FALSE, &rt, NULL); + ok(SUCCEEDED(hr), "Failed to create offscreen render target, hr %#x.\n", hr); + hr = IDirect3DDevice9_SetRenderTarget(device, 0, rt); + ok(SUCCEEDED(hr), "Failed to set render target, hr %#x.\n", hr); + + hr = IDirect3DDevice9_CreateVertexShader(device, vs_code, &vs); + ok(SUCCEEDED(hr), "Failed to create vertex shader, hr %#x.\n", hr); + hr = IDirect3DDevice9_CreatePixelShader(device, ps_code, &ps); + ok(SUCCEEDED(hr), "Failed to create pixel shader, hr %#x.\n", hr); + + hr = IDirect3DDevice9_SetFVF(device, D3DFVF_XYZ | D3DFVF_DIFFUSE); + ok(SUCCEEDED(hr), "Failed to set FVF, hr %#x.\n", hr); + hr = IDirect3DDevice9_SetVertexShader(device, vs); + ok(SUCCEEDED(hr), "Failed to set vertex shader, hr %#x.\n", hr); + hr = IDirect3DDevice9_SetPixelShader(device, ps); + ok(SUCCEEDED(hr), "Failed to set pixel shader, hr %#x.\n", hr); + + hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0xff000000, 1.0f, 0); + ok(SUCCEEDED(hr), "Failed to clear, hr %#x.\n", hr); + hr = IDirect3DDevice9_BeginScene(device); + ok(SUCCEEDED(hr), "Failed to begin scene, hr %#x.\n", hr); + hr = IDirect3DDevice9_DrawPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 2, quad, sizeof(*quad)); + ok(SUCCEEDED(hr), "Failed to draw primitive, hr %#x.\n", hr); + hr = IDirect3DDevice9_EndScene(device); + ok(SUCCEEDED(hr), "Failed to end scene, hr %#x.\n", hr); + + color = getPixelColor(device, 360, 240); + ok(color_match(color, 0x00ff007f, 1), "Got unexpected color 0x%08x.\n", color); + + hr = IDirect3DDevice9_SetRenderTarget(device, 0, backbuffer); + ok(SUCCEEDED(hr), "Failed to set render target, hr %#x.\n", hr); + + hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0xff000000, 1.0f, 0); + ok(SUCCEEDED(hr), "Failed to clear, hr %#x.\n", hr); + hr = IDirect3DDevice9_BeginScene(device); + ok(SUCCEEDED(hr), "Failed to begin scene, hr %#x.\n", hr); + hr = IDirect3DDevice9_DrawPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 2, quad, sizeof(quad[0])); + ok(SUCCEEDED(hr), "Failed to draw primitive, hr %#x.\n", hr); + hr = IDirect3DDevice9_EndScene(device); + ok(SUCCEEDED(hr), "Failed to end scene, hr %#x.\n", hr); + + color = getPixelColor(device, 360, 240); + ok(color_match(color, 0x00ff007f, 1), "Got unexpected color 0x%08x.\n", color); + + hr = IDirect3DDevice9_Present(device, NULL, NULL, NULL, NULL); + ok(SUCCEEDED(hr), "Failed to present frame, hr %#x.\n", hr); + + IDirect3DSurface9_Release(rt); + IDirect3DSurface9_Release(backbuffer); + IDirect3DVertexShader9_Release(vs); + IDirect3DPixelShader9_Release(ps); + + refcount = IDirect3DDevice9_Release(device); + ok(!refcount, "Device has %u references left.\n", refcount); +done: + IDirect3D9_Release(d3d); + DestroyWindow(window); +} + START_TEST(visual) { D3DADAPTER_IDENTIFIER9 identifier; @@ -21928,4 +22055,5 @@ START_TEST(visual) test_texture_blending(); test_color_clamping(); test_line_antialiasing_blending(); + test_dsy(); }
1
0
0
0
Matteo Bruni : d3d9/tests: Make the window client rect match the d3d swapchain size.
by Alexandre Julliard
07 Oct '16
07 Oct '16
Module: wine Branch: master Commit: 65f20ffc50d6f346628338da40b375790bfca217 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=65f20ffc50d6f346628338da4…
Author: Matteo Bruni <mbruni(a)codeweavers.com> Date: Fri Oct 7 00:57:52 2016 +0200 d3d9/tests: Make the window client rect match the d3d swapchain size. Signed-off-by: Matteo Bruni <mbruni(a)codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/d3d9/tests/visual.c | 303 ++++++++++++++++------------------------------- 1 file changed, 103 insertions(+), 200 deletions(-) Diff:
http://source.winehq.org/git/wine.git/?a=commitdiff;h=65f20ffc50d6f34662833…
1
0
0
0
Matteo Bruni : wined3d: Flag WINED3D_SHADER_CONST_PS_Y_CORR on framebuffer changes.
by Alexandre Julliard
07 Oct '16
07 Oct '16
Module: wine Branch: master Commit: dd420ccf1f73a0cc805e20bcc5e1a03d350a7a69 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=dd420ccf1f73a0cc805e20bcc…
Author: Matteo Bruni <mbruni(a)codeweavers.com> Date: Fri Oct 7 00:57:51 2016 +0200 wined3d: Flag WINED3D_SHADER_CONST_PS_Y_CORR on framebuffer changes. Signed-off-by: Matteo Bruni <mbruni(a)codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/wined3d/context.c | 1 + 1 file changed, 1 insertion(+) diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c index 394a2dc..98516f8 100644 --- a/dlls/wined3d/context.c +++ b/dlls/wined3d/context.c @@ -2758,6 +2758,7 @@ void context_state_fb(struct wined3d_context *context, const struct wined3d_stat context_apply_draw_buffers(context, rt_mask); *cur_mask = rt_mask; } + context->constant_update_mask |= WINED3D_SHADER_CONST_PS_Y_CORR; } static void context_map_stage(struct wined3d_context *context, DWORD stage, DWORD unit)
1
0
0
0
Matteo Bruni : wined3d: Account for offscreen rendering in the pixel shader key only if vpos is used.
by Alexandre Julliard
07 Oct '16
07 Oct '16
Module: wine Branch: master Commit: 1c88c557d3e6e2642754ab64bc2056d8c7c094e1 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=1c88c557d3e6e2642754ab64b…
Author: Matteo Bruni <mbruni(a)codeweavers.com> Date: Fri Oct 7 00:57:50 2016 +0200 wined3d: Account for offscreen rendering in the pixel shader key only if vpos is used. Signed-off-by: Matteo Bruni <mbruni(a)codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/wined3d/shader.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dlls/wined3d/shader.c b/dlls/wined3d/shader.c index 594520c..4455416 100644 --- a/dlls/wined3d/shader.c +++ b/dlls/wined3d/shader.c @@ -3280,7 +3280,8 @@ void find_ps_compile_args(const struct wined3d_state *state, const struct wined3 if (d3d_info->emulated_flatshading) args->flatshading = state->render_states[WINED3D_RS_SHADEMODE] == WINED3D_SHADE_FLAT; - args->render_offscreen = gl_info->supported[ARB_FRAGMENT_COORD_CONVENTIONS] ? context->render_offscreen : 0; + args->render_offscreen = shader->reg_maps.vpos && gl_info->supported[ARB_FRAGMENT_COORD_CONVENTIONS] + ? context->render_offscreen : 0; } static HRESULT pixel_shader_init(struct wined3d_shader *shader, struct wined3d_device *device,
1
0
0
0
Matteo Bruni : wined3d: Slightly offset the viewport in the ARB_clip_control case.
by Alexandre Julliard
07 Oct '16
07 Oct '16
Module: wine Branch: master Commit: 1bed10abee7d2439a5c7358596c860c454f06b53 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=1bed10abee7d2439a5c735859…
Author: Matteo Bruni <mbruni(a)codeweavers.com> Date: Fri Oct 7 00:57:49 2016 +0200 wined3d: Slightly offset the viewport in the ARB_clip_control case. Signed-off-by: Matteo Bruni <mbruni(a)codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/wined3d/directx.c | 2 +- dlls/wined3d/state.c | 4 +++- dlls/wined3d/utils.c | 4 ++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c index 5d91981..98b05c1 100644 --- a/dlls/wined3d/directx.c +++ b/dlls/wined3d/directx.c @@ -3862,7 +3862,7 @@ static BOOL wined3d_adapter_init_gl_caps(struct wined3d_adapter *adapter, DWORD gl_info->gl_ops.gl.p_glGetIntegerv(GL_VIEWPORT_SUBPIXEL_BITS, &subpixel_bits); TRACE("Viewport supports %d subpixel bits.\n", subpixel_bits); - if (!subpixel_bits) + if (subpixel_bits < 8) gl_info->supported[ARB_VIEWPORT_ARRAY] = FALSE; } if (gl_info->supported[ARB_CLIP_CONTROL] && !gl_info->supported[ARB_VIEWPORT_ARRAY]) diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c index 0333dd4..71f47d6 100644 --- a/dlls/wined3d/state.c +++ b/dlls/wined3d/state.c @@ -4653,8 +4653,10 @@ static void viewport_miscpart_cc(struct wined3d_context *context, { const struct wined3d_rendertarget_view *depth_stencil = state->fb->depth_stencil; const struct wined3d_rendertarget_view *target = state->fb->render_targets[0]; + /* See get_projection_matrix() in utils.c for a discussion about those + * values. */ float pixel_center_offset = context->device->wined3d->flags - & WINED3D_PIXEL_CENTER_INTEGER ? 0.5f : 0.0f; + & WINED3D_PIXEL_CENTER_INTEGER ? 63.0f / 128.0f : -1.0f / 128.0f; const struct wined3d_gl_info *gl_info = context->gl_info; struct wined3d_viewport vp = state->viewport; unsigned int width, height; diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c index e65907a..8e83040 100644 --- a/dlls/wined3d/utils.c +++ b/dlls/wined3d/utils.c @@ -4502,8 +4502,8 @@ void get_projection_matrix(const struct wined3d_context *context, const struct w * here besides the projection transformation itself: * - We need to flip along the y-axis in case of offscreen rendering. * - OpenGL Z range is {-Wc,...,Wc} while D3D Z range is {0,...,Wc}. - * - D3D coordinates refer to pixel centers while GL coordinates refer - * to pixel corners. + * - <= D3D9 coordinates refer to pixel centers while GL coordinates + * refer to pixel corners. * - D3D has a top-left filling convention. We need to maintain this * even after the y-flip mentioned above. * In order to handle the last two points, we translate by
1
0
0
0
Nikolay Sivov : d2d1/tests: Initial tests for bitmap render target.
by Alexandre Julliard
07 Oct '16
07 Oct '16
Module: wine Branch: master Commit: 7d5bd929e2aa95134d459c2d26ca52d3932ca529 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=7d5bd929e2aa95134d459c2d2…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Thu Oct 6 15:49:52 2016 +0300 d2d1/tests: Initial tests for bitmap render target. Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/d2d1/tests/d2d1.c | 175 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 175 insertions(+) diff --git a/dlls/d2d1/tests/d2d1.c b/dlls/d2d1/tests/d2d1.c index c9e1692..ba4be0c 100644 --- a/dlls/d2d1/tests/d2d1.c +++ b/dlls/d2d1/tests/d2d1.c @@ -17,6 +17,7 @@ */ #define COBJMACROS +#include <limits.h> #include <math.h> #include "d2d1.h" #include "wincrypt.h" @@ -76,6 +77,12 @@ static void set_size_u(D2D1_SIZE_U *size, unsigned int w, unsigned int h) size->height = h; } +static void set_size_f(D2D1_SIZE_F *size, float w, float h) +{ + size->width = w; + size->height = h; +} + static void set_matrix_identity(D2D1_MATRIX_3X2_F *matrix) { matrix->_11 = 1.0f; @@ -115,6 +122,22 @@ static void translate_matrix(D2D1_MATRIX_3X2_F *matrix, float x, float y) matrix->_32 += x * matrix->_12 + y * matrix->_22; } +static BOOL compare_float(float f, float g, unsigned int ulps) +{ + int x = *(int *)&f; + int y = *(int *)&g; + + if (x < 0) + x = INT_MIN - x; + if (y < 0) + y = INT_MIN - y; + + if (abs(x - y) > ulps) + return FALSE; + + return TRUE; +} + static BOOL compare_sha1(void *data, unsigned int pitch, unsigned int bpp, unsigned int w, unsigned int h, const char *ref_sha1) { @@ -2881,6 +2904,157 @@ static void test_hwnd_target(void) ID2D1Factory_Release(factory); } +static void test_bitmap_target(void) +{ + D2D1_HWND_RENDER_TARGET_PROPERTIES hwnd_rt_desc; + D2D1_SIZE_U pixel_size, pixel_size2; + D2D1_RENDER_TARGET_PROPERTIES desc; + ID2D1HwndRenderTarget *hwnd_rt; + ID2D1Bitmap *bitmap, *bitmap2; + ID2D1BitmapRenderTarget *rt; + D2D1_SIZE_F size, size2; + ID2D1Factory *factory; + ID3D10Device1 *device; + float dpi[2], dpi2[2]; + D2D1_COLOR_F color; + ULONG refcount; + HRESULT hr; + + if (!(device = create_device())) + { + skip("Failed to create device, skipping tests.\n"); + return; + } + ID3D10Device1_Release(device); + + hr = D2D1CreateFactory(D2D1_FACTORY_TYPE_SINGLE_THREADED, &IID_ID2D1Factory, NULL, (void **)&factory); + ok(SUCCEEDED(hr), "Failed to create factory, hr %#x.\n", hr); + + desc.type = D2D1_RENDER_TARGET_TYPE_DEFAULT; + desc.pixelFormat.format = DXGI_FORMAT_B8G8R8A8_UNORM; + desc.pixelFormat.alphaMode = D2D1_ALPHA_MODE_PREMULTIPLIED; + desc.dpiX = 96.0f; + desc.dpiY = 192.0f; + desc.usage = D2D1_RENDER_TARGET_USAGE_NONE; + desc.minLevel = D2D1_FEATURE_LEVEL_DEFAULT; + + hwnd_rt_desc.hwnd = CreateWindowA("static", "d2d_test", 0, 0, 0, 0, 0, 0, 0, 0, 0); + ok(!!hwnd_rt_desc.hwnd, "Failed to create target window.\n"); + hwnd_rt_desc.pixelSize.width = 64; + hwnd_rt_desc.pixelSize.height = 64; + hwnd_rt_desc.presentOptions = D2D1_PRESENT_OPTIONS_NONE; + + hr = ID2D1Factory_CreateHwndRenderTarget(factory, &desc, &hwnd_rt_desc, &hwnd_rt); + ok(SUCCEEDED(hr), "Failed to create render target, hr %#x.\n", hr); + + hr = ID2D1HwndRenderTarget_CreateCompatibleRenderTarget(hwnd_rt, NULL, NULL, NULL, + D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS_NONE, &rt); +todo_wine + ok(SUCCEEDED(hr), "Failed to create render target, hr %#x.\n", hr); + + if (FAILED(hr)) + { + ID2D1HwndRenderTarget_Release(hwnd_rt); + DestroyWindow(hwnd_rt_desc.hwnd); + ID2D1Factory_Release(factory); + return; + } + + /* See if parent target is referenced. */ + ID2D1HwndRenderTarget_AddRef(hwnd_rt); + refcount = ID2D1HwndRenderTarget_Release(hwnd_rt); + ok(refcount == 1, "Target should not have been referenced, got %u.\n", refcount); + + /* Size was not specified, should match parent. */ + pixel_size = ID2D1HwndRenderTarget_GetPixelSize(hwnd_rt); + pixel_size2 = ID2D1BitmapRenderTarget_GetPixelSize(rt); + ok(!memcmp(&pixel_size, &pixel_size2, sizeof(pixel_size)), "Got target pixel size mismatch.\n"); + + size = ID2D1HwndRenderTarget_GetSize(hwnd_rt); + size2 = ID2D1BitmapRenderTarget_GetSize(rt); + ok(!memcmp(&size, &size2, sizeof(size)), "Got target DIP size mismatch.\n"); + + ID2D1HwndRenderTarget_GetDpi(hwnd_rt, dpi, dpi + 1); + ID2D1BitmapRenderTarget_GetDpi(rt, dpi2, dpi2 + 1); + ok(!memcmp(dpi, dpi2, sizeof(dpi)), "Got dpi mismatch.\n"); + + ID2D1BitmapRenderTarget_Release(rt); + + /* Pixel size specified. */ + set_size_u(&pixel_size, 32, 32); + hr = ID2D1HwndRenderTarget_CreateCompatibleRenderTarget(hwnd_rt, NULL, &pixel_size, NULL, + D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS_NONE, &rt); + ok(SUCCEEDED(hr), "Failed to create render target, hr %#x.\n", hr); + + pixel_size2 = ID2D1BitmapRenderTarget_GetPixelSize(rt); + ok(!memcmp(&pixel_size, &pixel_size2, sizeof(pixel_size)), "Got target pixel size mismatch.\n"); + + ID2D1BitmapRenderTarget_GetDpi(rt, dpi2, dpi2 + 1); + ok(!memcmp(dpi, dpi2, sizeof(dpi)), "Got dpi mismatch.\n"); + + ID2D1BitmapRenderTarget_Release(rt); + + /* Both pixel size and DIP size are specified. */ + set_size_u(&pixel_size, 128, 128); + hr = ID2D1HwndRenderTarget_CreateCompatibleRenderTarget(hwnd_rt, &size, &pixel_size, NULL, + D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS_NONE, &rt); + ok(SUCCEEDED(hr), "Failed to create render target, hr %#x.\n", hr); + + /* Doubled pixel size dimensions with the same DIP size give doubled dpi. */ + ID2D1BitmapRenderTarget_GetDpi(rt, dpi2, dpi2 + 1); + ok(dpi[0] == dpi2[0] / 2.0f && dpi[1] == dpi2[1] / 2.0f, "Got dpi mismatch.\n"); + + ID2D1BitmapRenderTarget_Release(rt); + + /* DIP size is specified, fractional. */ + set_size_f(&size, 70.1f, 70.4f); + hr = ID2D1HwndRenderTarget_CreateCompatibleRenderTarget(hwnd_rt, &size, NULL, NULL, + D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS_NONE, &rt); + ok(SUCCEEDED(hr), "Failed to create render target, hr %#x.\n", hr); + + ID2D1BitmapRenderTarget_GetDpi(rt, dpi2, dpi2 + 1); + + pixel_size = ID2D1BitmapRenderTarget_GetPixelSize(rt); + ok(pixel_size.width == ceilf(size.width * dpi2[0] / 96.0f) + && pixel_size.height == ceilf(size.height * dpi2[1] / 96.0f), "Wrong pixel size %ux%u\n", + pixel_size.width, pixel_size.height); + + dpi[0] *= (pixel_size.width / size.width) * (96.0f / dpi[0]); + dpi[1] *= (pixel_size.height / size.height) * (96.0f / dpi[1]); + + ok(compare_float(dpi[0], dpi2[0], 1) && compare_float(dpi[1], dpi2[1], 1), "Got dpi mismatch.\n"); + + ID2D1HwndRenderTarget_Release(hwnd_rt); + + /* Check if GetBitmap() returns same instance. */ + hr = ID2D1BitmapRenderTarget_GetBitmap(rt, &bitmap); + ok(SUCCEEDED(hr), "GetBitmap() failed, hr %#x.\n", hr); + hr = ID2D1BitmapRenderTarget_GetBitmap(rt, &bitmap2); + ok(SUCCEEDED(hr), "GetBitmap() failed, hr %#x.\n", hr); + ok(bitmap == bitmap2, "Got different bitmap instances.\n"); + + /* Draw something, see if bitmap instance is retained. */ + ID2D1BitmapRenderTarget_BeginDraw(rt); + set_color(&color, 1.0f, 1.0f, 0.0f, 1.0f); + ID2D1BitmapRenderTarget_Clear(rt, &color); + hr = ID2D1BitmapRenderTarget_EndDraw(rt, NULL, NULL); + ok(SUCCEEDED(hr), "EndDraw() failed, hr %#x.\n", hr); + + ID2D1Bitmap_Release(bitmap2); + hr = ID2D1BitmapRenderTarget_GetBitmap(rt, &bitmap2); + ok(SUCCEEDED(hr), "GetBitmap() failed, hr %#x.\n", hr); + ok(bitmap == bitmap2, "Got different bitmap instances.\n"); + + ID2D1Bitmap_Release(bitmap); + ID2D1Bitmap_Release(bitmap2); + + refcount = ID2D1BitmapRenderTarget_Release(rt); + ok(!refcount, "Target should be released, got %u.\n", refcount); + + DestroyWindow(hwnd_rt_desc.hwnd); + ID2D1Factory_Release(factory); +} + START_TEST(d2d1) { test_clip(); @@ -2897,4 +3071,5 @@ START_TEST(d2d1) test_draw_text_layout(); test_dc_target(); test_hwnd_target(); + test_bitmap_target(); }
1
0
0
0
← Newer
1
...
34
35
36
37
38
39
40
...
46
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
Results per page:
10
25
50
100
200