Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
bd86e279
Commit
bd86e279
authored
Oct 08, 2009
by
Vincent Povirk
Committed by
Alexandre Julliard
Oct 09, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdiplus: Use gdi texture brushes to draw hatch brushes.
parent
55162681
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
75 additions
and
37 deletions
+75
-37
brush.c
dlls/gdiplus/brush.c
+75
-37
No files found.
dlls/gdiplus/brush.c
View file @
bd86e279
...
...
@@ -177,19 +177,14 @@ GpStatus WINGDIPAPI GdipCloneBrush(GpBrush *brush, GpBrush **clone)
return
Ok
;
}
static
LONG
HatchStyleToHatch
(
HatchStyle
hatchstyle
)
{
switch
(
hatchstyle
)
{
case
HatchStyleHorizontal
:
return
HS_HORIZONTAL
;
case
HatchStyleVertical
:
return
HS_VERTICAL
;
case
HatchStyleForwardDiagonal
:
return
HS_FDIAGONAL
;
case
HatchStyleBackwardDiagonal
:
return
HS_BDIAGONAL
;
case
HatchStyleCross
:
return
HS_CROSS
;
case
HatchStyleDiagonalCross
:
return
HS_DIAGCROSS
;
default:
return
0
;
}
}
static
const
char
HatchBrushes
[][
8
]
=
{
{
0x00
,
0x00
,
0x00
,
0xff
,
0x00
,
0x00
,
0x00
,
0x00
},
/* HatchStyleHorizontal */
{
0x08
,
0x08
,
0x08
,
0x08
,
0x08
,
0x08
,
0x08
,
0x08
},
/* HatchStyleVertical */
{
0x01
,
0x02
,
0x04
,
0x08
,
0x10
,
0x20
,
0x40
,
0x80
},
/* HatchStyleForwardDiagonal */
{
0x80
,
0x40
,
0x20
,
0x10
,
0x08
,
0x04
,
0x02
,
0x01
},
/* HatchStyleBackwardDiagonal */
{
0x08
,
0x08
,
0x08
,
0xff
,
0x08
,
0x08
,
0x08
,
0x08
},
/* HatchStyleCross */
{
0x81
,
0x42
,
0x24
,
0x18
,
0x18
,
0x24
,
0x42
,
0x81
},
/* HatchStyleDiagonalCross */
};
/******************************************************************************
* GdipCreateHatchBrush [GDIPLUS.@]
...
...
@@ -197,6 +192,7 @@ static LONG HatchStyleToHatch(HatchStyle hatchstyle)
GpStatus
WINGDIPAPI
GdipCreateHatchBrush
(
HatchStyle
hatchstyle
,
ARGB
forecol
,
ARGB
backcol
,
GpHatch
**
brush
)
{
COLORREF
fgcol
=
ARGB2COLORREF
(
forecol
);
GpStatus
stat
=
Ok
;
TRACE
(
"(%d, %d, %d, %p)
\n
"
,
hatchstyle
,
forecol
,
backcol
,
brush
);
...
...
@@ -205,37 +201,79 @@ GpStatus WINGDIPAPI GdipCreateHatchBrush(HatchStyle hatchstyle, ARGB forecol, AR
*
brush
=
GdipAlloc
(
sizeof
(
GpHatch
));
if
(
!*
brush
)
return
OutOfMemory
;
switch
(
hatchstyle
)
if
(
hatchstyle
<
sizeof
(
HatchBrushes
)
/
sizeof
(
HatchBrushes
[
0
])
)
{
case
HatchStyleHorizontal
:
case
HatchStyleVertical
:
case
HatchStyleForwardDiagonal
:
case
HatchStyleBackwardDiagonal
:
case
HatchStyleCross
:
case
HatchStyleDiagonalCross
:
/* Brushes that map to BS_HATCHED */
(
*
brush
)
->
brush
.
lb
.
lbStyle
=
BS_HATCHED
;
(
*
brush
)
->
brush
.
lb
.
lbColor
=
fgcol
;
(
*
brush
)
->
brush
.
lb
.
lbHatch
=
HatchStyleToHatch
(
hatchstyle
);
break
;
HBITMAP
hbmp
;
HDC
hdc
;
BITMAPINFOHEADER
bmih
;
DWORD
*
bits
;
int
x
,
y
;
default:
FIXME
(
"Unimplemented hatch style %d
\n
"
,
hatchstyle
);
hdc
=
CreateCompatibleDC
(
0
);
(
*
brush
)
->
brush
.
lb
.
lbStyle
=
BS_SOLID
;
(
*
brush
)
->
brush
.
lb
.
lbColor
=
fgcol
;
(
*
brush
)
->
brush
.
lb
.
lbHatch
=
0
;
break
;
if
(
hdc
)
{
bmih
.
biSize
=
sizeof
(
bmih
);
bmih
.
biWidth
=
8
;
bmih
.
biHeight
=
8
;
bmih
.
biPlanes
=
1
;
bmih
.
biBitCount
=
32
;
bmih
.
biCompression
=
BI_RGB
;
bmih
.
biSizeImage
=
0
;
hbmp
=
CreateDIBSection
(
hdc
,
(
BITMAPINFO
*
)
&
bmih
,
DIB_RGB_COLORS
,
(
void
**
)
&
bits
,
NULL
,
0
);
if
(
hbmp
)
{
for
(
y
=
0
;
y
<
8
;
y
++
)
for
(
x
=
0
;
x
<
8
;
x
++
)
if
((
HatchBrushes
[
hatchstyle
][
y
]
&
(
0x80
>>
x
))
!=
0
)
bits
[
y
*
8
+
x
]
=
forecol
;
else
bits
[
y
*
8
+
x
]
=
backcol
;
}
else
stat
=
GenericError
;
DeleteDC
(
hdc
);
}
else
stat
=
GenericError
;
if
(
stat
==
Ok
)
{
(
*
brush
)
->
brush
.
lb
.
lbStyle
=
BS_PATTERN
;
(
*
brush
)
->
brush
.
lb
.
lbColor
=
0
;
(
*
brush
)
->
brush
.
lb
.
lbHatch
=
(
ULONG_PTR
)
hbmp
;
(
*
brush
)
->
brush
.
gdibrush
=
CreateBrushIndirect
(
&
(
*
brush
)
->
brush
.
lb
);
DeleteObject
(
hbmp
);
}
}
else
{
FIXME
(
"Unimplemented hatch style %d
\n
"
,
hatchstyle
);
(
*
brush
)
->
brush
.
lb
.
lbStyle
=
BS_SOLID
;
(
*
brush
)
->
brush
.
lb
.
lbColor
=
fgcol
;
(
*
brush
)
->
brush
.
lb
.
lbHatch
=
0
;
(
*
brush
)
->
brush
.
gdibrush
=
CreateBrushIndirect
(
&
(
*
brush
)
->
brush
.
lb
);
}
(
*
brush
)
->
brush
.
gdibrush
=
CreateBrushIndirect
(
&
(
*
brush
)
->
brush
.
lb
);
(
*
brush
)
->
brush
.
bt
=
BrushTypeHatchFill
;
(
*
brush
)
->
forecol
=
forecol
;
(
*
brush
)
->
backcol
=
backcol
;
(
*
brush
)
->
hatchstyle
=
hatchstyle
;
if
(
stat
==
Ok
)
{
(
*
brush
)
->
brush
.
bt
=
BrushTypeHatchFill
;
(
*
brush
)
->
forecol
=
forecol
;
(
*
brush
)
->
backcol
=
backcol
;
(
*
brush
)
->
hatchstyle
=
hatchstyle
;
}
else
{
GdipFree
(
*
brush
);
*
brush
=
NULL
;
}
return
Ok
;
return
stat
;
}
/******************************************************************************
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment