gdi32: Move layout to DC_ATTR.
Signed-off-by: Jacek Caban <jacek@codeweavers.com> Signed-off-by: Huw Davies <huw@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
c00b231826
commit
148a2b60a5
|
@ -543,7 +543,7 @@ BOOL WINAPI PatBlt( HDC hdc, INT left, INT top, INT width, INT height, DWORD rop
|
||||||
dst.log_y = top;
|
dst.log_y = top;
|
||||||
dst.log_width = width;
|
dst.log_width = width;
|
||||||
dst.log_height = height;
|
dst.log_height = height;
|
||||||
dst.layout = dc->layout;
|
dst.layout = dc->attr->layout;
|
||||||
if (rop & NOMIRRORBITMAP)
|
if (rop & NOMIRRORBITMAP)
|
||||||
{
|
{
|
||||||
dst.layout |= LAYOUT_BITMAPORIENTATIONPRESERVED;
|
dst.layout |= LAYOUT_BITMAPORIENTATIONPRESERVED;
|
||||||
|
@ -602,12 +602,12 @@ BOOL WINAPI StretchBlt( HDC hdcDst, INT xDst, INT yDst, INT widthDst, INT height
|
||||||
src.log_y = ySrc;
|
src.log_y = ySrc;
|
||||||
src.log_width = widthSrc;
|
src.log_width = widthSrc;
|
||||||
src.log_height = heightSrc;
|
src.log_height = heightSrc;
|
||||||
src.layout = dcSrc->layout;
|
src.layout = dcSrc->attr->layout;
|
||||||
dst.log_x = xDst;
|
dst.log_x = xDst;
|
||||||
dst.log_y = yDst;
|
dst.log_y = yDst;
|
||||||
dst.log_width = widthDst;
|
dst.log_width = widthDst;
|
||||||
dst.log_height = heightDst;
|
dst.log_height = heightDst;
|
||||||
dst.layout = dcDst->layout;
|
dst.layout = dcDst->attr->layout;
|
||||||
if (rop & NOMIRRORBITMAP)
|
if (rop & NOMIRRORBITMAP)
|
||||||
{
|
{
|
||||||
src.layout |= LAYOUT_BITMAPORIENTATIONPRESERVED;
|
src.layout |= LAYOUT_BITMAPORIENTATIONPRESERVED;
|
||||||
|
@ -958,12 +958,12 @@ BOOL WINAPI GdiAlphaBlend(HDC hdcDst, int xDst, int yDst, int widthDst, int heig
|
||||||
src.log_y = ySrc;
|
src.log_y = ySrc;
|
||||||
src.log_width = widthSrc;
|
src.log_width = widthSrc;
|
||||||
src.log_height = heightSrc;
|
src.log_height = heightSrc;
|
||||||
src.layout = dcSrc->layout;
|
src.layout = dcSrc->attr->layout;
|
||||||
dst.log_x = xDst;
|
dst.log_x = xDst;
|
||||||
dst.log_y = yDst;
|
dst.log_y = yDst;
|
||||||
dst.log_width = widthDst;
|
dst.log_width = widthDst;
|
||||||
dst.log_height = heightDst;
|
dst.log_height = heightDst;
|
||||||
dst.layout = dcDst->layout;
|
dst.layout = dcDst->attr->layout;
|
||||||
ret = !get_vis_rectangles( dcDst, &dst, dcSrc, &src );
|
ret = !get_vis_rectangles( dcDst, &dst, dcSrc, &src );
|
||||||
|
|
||||||
TRACE("src %p log=%d,%d %dx%d phys=%d,%d %dx%d vis=%s dst %p log=%d,%d %dx%d phys=%d,%d %dx%d vis=%s blend=%02x/%02x/%02x/%02x\n",
|
TRACE("src %p log=%d,%d %dx%d phys=%d,%d %dx%d vis=%s dst %p log=%d,%d %dx%d phys=%d,%d %dx%d vis=%s blend=%02x/%02x/%02x/%02x\n",
|
||||||
|
|
|
@ -51,7 +51,7 @@ static inline RECT get_clip_rect( DC * dc, int left, int top, int right, int bot
|
||||||
rect.right = right;
|
rect.right = right;
|
||||||
rect.bottom = bottom;
|
rect.bottom = bottom;
|
||||||
lp_to_dp( dc, (POINT *)&rect, 2 );
|
lp_to_dp( dc, (POINT *)&rect, 2 );
|
||||||
if (dc->layout & LAYOUT_RTL)
|
if (dc->attr->layout & LAYOUT_RTL)
|
||||||
{
|
{
|
||||||
int tmp = rect.left;
|
int tmp = rect.left;
|
||||||
rect.left = rect.right + 1;
|
rect.left = rect.right + 1;
|
||||||
|
@ -168,7 +168,7 @@ INT CDECL nulldrv_ExtSelectClipRgn( PHYSDEV dev, HRGN rgn, INT mode )
|
||||||
{
|
{
|
||||||
HRGN mirrored = 0;
|
HRGN mirrored = 0;
|
||||||
|
|
||||||
if (dc->layout & LAYOUT_RTL)
|
if (dc->attr->layout & LAYOUT_RTL)
|
||||||
{
|
{
|
||||||
if (!(mirrored = NtGdiCreateRectRgn( 0, 0, 0, 0 ))) return ERROR;
|
if (!(mirrored = NtGdiCreateRectRgn( 0, 0, 0, 0 ))) return ERROR;
|
||||||
mirror_region( mirrored, rgn, dc->vis_rect.right - dc->vis_rect.left );
|
mirror_region( mirrored, rgn, dc->vis_rect.right - dc->vis_rect.left );
|
||||||
|
@ -235,7 +235,7 @@ INT CDECL nulldrv_OffsetClipRgn( PHYSDEV dev, INT x, INT y )
|
||||||
{
|
{
|
||||||
x = MulDiv( x, dc->vport_ext.cx, dc->wnd_ext.cx );
|
x = MulDiv( x, dc->vport_ext.cx, dc->wnd_ext.cx );
|
||||||
y = MulDiv( y, dc->vport_ext.cy, dc->wnd_ext.cy );
|
y = MulDiv( y, dc->vport_ext.cy, dc->wnd_ext.cy );
|
||||||
if (dc->layout & LAYOUT_RTL) x = -x;
|
if (dc->attr->layout & LAYOUT_RTL) x = -x;
|
||||||
ret = NtGdiOffsetRgn( dc->hClipRgn, x, y );
|
ret = NtGdiOffsetRgn( dc->hClipRgn, x, y );
|
||||||
update_dc_clipping( dc );
|
update_dc_clipping( dc );
|
||||||
}
|
}
|
||||||
|
@ -432,7 +432,7 @@ INT WINAPI GetClipBox( HDC hdc, LPRECT rect )
|
||||||
|
|
||||||
if (get_dc_device_rect( dc, &visrect ) && !intersect_rect( rect, rect, &visrect )) ret = NULLREGION;
|
if (get_dc_device_rect( dc, &visrect ) && !intersect_rect( rect, rect, &visrect )) ret = NULLREGION;
|
||||||
|
|
||||||
if (dc->layout & LAYOUT_RTL)
|
if (dc->attr->layout & LAYOUT_RTL)
|
||||||
{
|
{
|
||||||
int tmp = rect->left;
|
int tmp = rect->left;
|
||||||
rect->left = rect->right - 1;
|
rect->left = rect->right - 1;
|
||||||
|
@ -459,7 +459,7 @@ INT WINAPI GetClipRgn( HDC hdc, HRGN hRgn )
|
||||||
if (NtGdiCombineRgn( hRgn, dc->hClipRgn, 0, RGN_COPY ) != ERROR)
|
if (NtGdiCombineRgn( hRgn, dc->hClipRgn, 0, RGN_COPY ) != ERROR)
|
||||||
{
|
{
|
||||||
ret = 1;
|
ret = 1;
|
||||||
if (dc->layout & LAYOUT_RTL)
|
if (dc->attr->layout & LAYOUT_RTL)
|
||||||
mirror_region( hRgn, hRgn, dc->vis_rect.right - dc->vis_rect.left );
|
mirror_region( hRgn, hRgn, dc->vis_rect.right - dc->vis_rect.left );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -483,7 +483,7 @@ INT WINAPI GetMetaRgn( HDC hdc, HRGN hRgn )
|
||||||
if (dc->hMetaRgn && NtGdiCombineRgn( hRgn, dc->hMetaRgn, 0, RGN_COPY ) != ERROR)
|
if (dc->hMetaRgn && NtGdiCombineRgn( hRgn, dc->hMetaRgn, 0, RGN_COPY ) != ERROR)
|
||||||
{
|
{
|
||||||
ret = 1;
|
ret = 1;
|
||||||
if (dc->layout & LAYOUT_RTL)
|
if (dc->attr->layout & LAYOUT_RTL)
|
||||||
mirror_region( hRgn, hRgn, dc->vis_rect.right - dc->vis_rect.left );
|
mirror_region( hRgn, hRgn, dc->vis_rect.right - dc->vis_rect.left );
|
||||||
}
|
}
|
||||||
release_dc_ptr( dc );
|
release_dc_ptr( dc );
|
||||||
|
|
|
@ -80,7 +80,7 @@ static void set_initial_dc_state( DC *dc )
|
||||||
dc->vport_ext.cx = 1;
|
dc->vport_ext.cx = 1;
|
||||||
dc->vport_ext.cy = 1;
|
dc->vport_ext.cy = 1;
|
||||||
dc->miterLimit = 10.0f; /* 10.0 is the default, from MSDN */
|
dc->miterLimit = 10.0f; /* 10.0 is the default, from MSDN */
|
||||||
dc->layout = 0;
|
dc->attr->layout = 0;
|
||||||
dc->font_code_page = CP_ACP;
|
dc->font_code_page = CP_ACP;
|
||||||
dc->attr->rop_mode = R2_COPYPEN;
|
dc->attr->rop_mode = R2_COPYPEN;
|
||||||
dc->polyFillMode = ALTERNATE;
|
dc->polyFillMode = ALTERNATE;
|
||||||
|
@ -322,14 +322,14 @@ static void construct_window_to_viewport(DC *dc, XFORM *xform)
|
||||||
scaleX = (double)dc->vport_ext.cx / (double)dc->wnd_ext.cx;
|
scaleX = (double)dc->vport_ext.cx / (double)dc->wnd_ext.cx;
|
||||||
scaleY = (double)dc->vport_ext.cy / (double)dc->wnd_ext.cy;
|
scaleY = (double)dc->vport_ext.cy / (double)dc->wnd_ext.cy;
|
||||||
|
|
||||||
if (dc->layout & LAYOUT_RTL) scaleX = -scaleX;
|
if (dc->attr->layout & LAYOUT_RTL) scaleX = -scaleX;
|
||||||
xform->eM11 = scaleX;
|
xform->eM11 = scaleX;
|
||||||
xform->eM12 = 0.0;
|
xform->eM12 = 0.0;
|
||||||
xform->eM21 = 0.0;
|
xform->eM21 = 0.0;
|
||||||
xform->eM22 = scaleY;
|
xform->eM22 = scaleY;
|
||||||
xform->eDx = (double)dc->vport_org.x - scaleX * (double)dc->wnd_org.x;
|
xform->eDx = (double)dc->vport_org.x - scaleX * (double)dc->wnd_org.x;
|
||||||
xform->eDy = (double)dc->vport_org.y - scaleY * (double)dc->wnd_org.y;
|
xform->eDy = (double)dc->vport_org.y - scaleY * (double)dc->wnd_org.y;
|
||||||
if (dc->layout & LAYOUT_RTL) xform->eDx = dc->vis_rect.right - dc->vis_rect.left - 1 - xform->eDx;
|
if (dc->attr->layout & LAYOUT_RTL) xform->eDx = dc->vis_rect.right - dc->vis_rect.left - 1 - xform->eDx;
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
|
@ -393,7 +393,6 @@ INT CDECL nulldrv_SaveDC( PHYSDEV dev )
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
*newdc->attr = *dc->attr;
|
*newdc->attr = *dc->attr;
|
||||||
newdc->layout = dc->layout;
|
|
||||||
newdc->hPen = dc->hPen;
|
newdc->hPen = dc->hPen;
|
||||||
newdc->hBrush = dc->hBrush;
|
newdc->hBrush = dc->hBrush;
|
||||||
newdc->hFont = dc->hFont;
|
newdc->hFont = dc->hFont;
|
||||||
|
@ -470,7 +469,7 @@ BOOL CDECL nulldrv_RestoreDC( PHYSDEV dev, INT level )
|
||||||
|
|
||||||
if (!PATH_RestorePath( dc, dcs )) return FALSE;
|
if (!PATH_RestorePath( dc, dcs )) return FALSE;
|
||||||
|
|
||||||
dc->layout = dcs->layout;
|
dc->attr->layout = dcs->attr->layout;
|
||||||
dc->attr->rop_mode = dcs->attr->rop_mode;
|
dc->attr->rop_mode = dcs->attr->rop_mode;
|
||||||
dc->polyFillMode = dcs->polyFillMode;
|
dc->polyFillMode = dcs->polyFillMode;
|
||||||
dc->stretchBltMode = dcs->stretchBltMode;
|
dc->stretchBltMode = dcs->stretchBltMode;
|
||||||
|
@ -1751,28 +1750,6 @@ BOOL WINAPI GetWindowOrgEx( HDC hdc, LPPOINT pt )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
|
||||||
* GetLayout (GDI32.@)
|
|
||||||
*
|
|
||||||
* Gets left->right or right->left text layout flags of a dc.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
DWORD WINAPI GetLayout(HDC hdc)
|
|
||||||
{
|
|
||||||
DWORD layout = GDI_ERROR;
|
|
||||||
|
|
||||||
DC * dc = get_dc_ptr( hdc );
|
|
||||||
if (dc)
|
|
||||||
{
|
|
||||||
layout = dc->layout;
|
|
||||||
release_dc_ptr( dc );
|
|
||||||
}
|
|
||||||
|
|
||||||
TRACE("hdc : %p, layout : %08x\n", hdc, layout);
|
|
||||||
|
|
||||||
return layout;
|
|
||||||
}
|
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* SetLayout (GDI32.@)
|
* SetLayout (GDI32.@)
|
||||||
*
|
*
|
||||||
|
|
|
@ -492,7 +492,7 @@ INT CDECL nulldrv_StretchDIBits( PHYSDEV dev, INT xDst, INT yDst, INT widthDst,
|
||||||
dst.width = rect.right - rect.left;
|
dst.width = rect.right - rect.left;
|
||||||
dst.height = rect.bottom - rect.top;
|
dst.height = rect.bottom - rect.top;
|
||||||
|
|
||||||
if (dc->layout & LAYOUT_RTL && rop & NOMIRRORBITMAP)
|
if (dc->attr->layout & LAYOUT_RTL && rop & NOMIRRORBITMAP)
|
||||||
{
|
{
|
||||||
dst.x += dst.width;
|
dst.x += dst.width;
|
||||||
dst.width = -dst.width;
|
dst.width = -dst.width;
|
||||||
|
@ -846,7 +846,7 @@ INT CDECL nulldrv_SetDIBitsToDevice( PHYSDEV dev, INT x_dst, INT y_dst, DWORD cx
|
||||||
dst.y = pt.y;
|
dst.y = pt.y;
|
||||||
dst.width = cx;
|
dst.width = cx;
|
||||||
dst.height = cy;
|
dst.height = cy;
|
||||||
if (dc->layout & LAYOUT_RTL) dst.x -= cx - 1;
|
if (dc->attr->layout & LAYOUT_RTL) dst.x -= cx - 1;
|
||||||
|
|
||||||
rect.left = dst.x;
|
rect.left = dst.x;
|
||||||
rect.top = dst.y;
|
rect.top = dst.y;
|
||||||
|
|
|
@ -100,7 +100,7 @@ static RECT get_device_rect( DC *dc, int left, int top, int right, int bottom, B
|
||||||
rect.top = top;
|
rect.top = top;
|
||||||
rect.right = right;
|
rect.right = right;
|
||||||
rect.bottom = bottom;
|
rect.bottom = bottom;
|
||||||
if (rtl_correction && dc->layout & LAYOUT_RTL)
|
if (rtl_correction && dc->attr->layout & LAYOUT_RTL)
|
||||||
{
|
{
|
||||||
/* shift the rectangle so that the right border is included after mirroring */
|
/* shift the rectangle so that the right border is included after mirroring */
|
||||||
/* it would be more correct to do this after LPtoDP but that's not what Windows does */
|
/* it would be more correct to do this after LPtoDP but that's not what Windows does */
|
||||||
|
|
|
@ -800,8 +800,8 @@ static DWORD CDECL nulldrv_SetLayout( PHYSDEV dev, DWORD layout )
|
||||||
DC *dc = get_nulldrv_dc( dev );
|
DC *dc = get_nulldrv_dc( dev );
|
||||||
DWORD old_layout;
|
DWORD old_layout;
|
||||||
|
|
||||||
old_layout = dc->layout;
|
old_layout = dc->attr->layout;
|
||||||
dc->layout = layout;
|
dc->attr->layout = layout;
|
||||||
if (layout != old_layout)
|
if (layout != old_layout)
|
||||||
{
|
{
|
||||||
if (layout & LAYOUT_RTL) dc->MapMode = MM_ANISOTROPIC;
|
if (layout & LAYOUT_RTL) dc->MapMode = MM_ANISOTROPIC;
|
||||||
|
|
|
@ -5951,7 +5951,7 @@ BOOL WINAPI NtGdiExtTextOutW( HDC hdc, INT x, INT y, UINT flags, const RECT *lpr
|
||||||
|
|
||||||
align = dc->attr->text_align;
|
align = dc->attr->text_align;
|
||||||
breakRem = dc->breakRem;
|
breakRem = dc->breakRem;
|
||||||
layout = dc->layout;
|
layout = dc->attr->layout;
|
||||||
|
|
||||||
if (quietfixme == 0 && flags & (ETO_NUMERICSLOCAL | ETO_NUMERICSLATIN))
|
if (quietfixme == 0 && flags & (ETO_NUMERICSLOCAL | ETO_NUMERICSLATIN))
|
||||||
{
|
{
|
||||||
|
|
|
@ -97,6 +97,15 @@ INT WINAPI SetBkMode( HDC hdc, INT mode )
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
* GetLayout (GDI32.@)
|
||||||
|
*/
|
||||||
|
DWORD WINAPI GetLayout( HDC hdc )
|
||||||
|
{
|
||||||
|
DC_ATTR *dc_attr = get_dc_attr( hdc );
|
||||||
|
return dc_attr ? dc_attr->layout : GDI_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* GetCurrentPositionEx (GDI32.@)
|
* GetCurrentPositionEx (GDI32.@)
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -203,7 +203,7 @@ INT CDECL nulldrv_SetMapMode( PHYSDEV dev, INT mode )
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
/* RTL layout is always MM_ANISOTROPIC */
|
/* RTL layout is always MM_ANISOTROPIC */
|
||||||
if (!(dc->layout & LAYOUT_RTL)) dc->MapMode = mode;
|
if (!(dc->attr->layout & LAYOUT_RTL)) dc->MapMode = mode;
|
||||||
DC_UpdateXforms( dc );
|
DC_UpdateXforms( dc );
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -101,7 +101,6 @@ typedef struct tagDC
|
||||||
WCHAR display[CCHDEVICENAME]; /* Display name when created for a specific display device */
|
WCHAR display[CCHDEVICENAME]; /* Display name when created for a specific display device */
|
||||||
|
|
||||||
int flags;
|
int flags;
|
||||||
DWORD layout;
|
|
||||||
HRGN hClipRgn; /* Clip region */
|
HRGN hClipRgn; /* Clip region */
|
||||||
HRGN hMetaRgn; /* Meta region */
|
HRGN hMetaRgn; /* Meta region */
|
||||||
HRGN hVisRgn; /* Visible region */
|
HRGN hVisRgn; /* Visible region */
|
||||||
|
|
|
@ -280,6 +280,8 @@ static void test_dc_layout(void)
|
||||||
|
|
||||||
ret = GetMapMode( hdc );
|
ret = GetMapMode( hdc );
|
||||||
ok(ret == MM_ANISOTROPIC, "expected MM_ANISOTROPIC, got %d\n", ret);
|
ok(ret == MM_ANISOTROPIC, "expected MM_ANISOTROPIC, got %d\n", ret);
|
||||||
|
ret = pGetLayout( hdc );
|
||||||
|
ok(ret == LAYOUT_RTL, "got %x\n", ret);
|
||||||
expect_viewport_ext(hdc, 1, 1);
|
expect_viewport_ext(hdc, 1, 1);
|
||||||
expect_window_ext(hdc, 1, 1);
|
expect_window_ext(hdc, 1, 1);
|
||||||
expect_world_transform(hdc, 1.0, 1.0);
|
expect_world_transform(hdc, 1.0, 1.0);
|
||||||
|
|
|
@ -6396,7 +6396,7 @@ static void test_mf_SetLayout(void)
|
||||||
layout = SetLayout(mf_dc, tests[i]);
|
layout = SetLayout(mf_dc, tests[i]);
|
||||||
ok(layout == LAYOUT_RTL, "Expected %#x, got %#x\n", tests[i], layout);
|
ok(layout == LAYOUT_RTL, "Expected %#x, got %#x\n", tests[i], layout);
|
||||||
layout = GetLayout(mf_dc);
|
layout = GetLayout(mf_dc);
|
||||||
todo_wine ok(layout == GDI_ERROR, "Expected %#x, got %#x\n", GDI_ERROR, layout);
|
ok(layout == GDI_ERROR, "Expected %#x, got %#x\n", GDI_ERROR, layout);
|
||||||
winetest_pop_context();
|
winetest_pop_context();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -101,6 +101,7 @@ typedef struct DC_ATTR
|
||||||
LONG disabled; /* disabled flag, controled by DCHF_(DISABLE|ENABLE)DC */
|
LONG disabled; /* disabled flag, controled by DCHF_(DISABLE|ENABLE)DC */
|
||||||
POINT cur_pos;
|
POINT cur_pos;
|
||||||
INT graphics_mode;
|
INT graphics_mode;
|
||||||
|
DWORD layout;
|
||||||
WORD text_align;
|
WORD text_align;
|
||||||
WORD background_mode;
|
WORD background_mode;
|
||||||
WORD rop_mode;
|
WORD rop_mode;
|
||||||
|
|
Loading…
Reference in New Issue