Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
3f11631e
Commit
3f11631e
authored
Nov 03, 2011
by
Henri Verbeet
Committed by
Alexandre Julliard
Nov 04, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Merge surface_getdc() and gdi_surface_getdc().
parent
739dbab4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
63 deletions
+28
-63
surface.c
dlls/wined3d/surface.c
+28
-62
wined3d_private.h
dlls/wined3d/wined3d_private.h
+0
-1
No files found.
dlls/wined3d/surface.c
View file @
3f11631e
...
...
@@ -1029,43 +1029,6 @@ done:
surface
->
surface_ops
->
surface_draw_overlay
(
surface
);
}
static
HRESULT
surface_getdc
(
struct
wined3d_surface
*
surface
)
{
WINED3DLOCKED_RECT
lock
;
HRESULT
hr
;
TRACE
(
"surface %p.
\n
"
,
surface
);
/* Create a DIB section if there isn't a dc yet. */
if
(
!
surface
->
hDC
)
{
if
(
surface
->
flags
&
SFLAG_CLIENT
)
{
surface_load_location
(
surface
,
SFLAG_INSYSMEM
,
NULL
);
surface_release_client_storage
(
surface
);
}
hr
=
surface_create_dib_section
(
surface
);
if
(
FAILED
(
hr
))
return
WINED3DERR_INVALIDCALL
;
/* Use the DIB section from now on if we are not using a PBO. */
if
(
!
(
surface
->
flags
&
SFLAG_PBO
))
surface
->
resource
.
allocatedMemory
=
surface
->
dib
.
bitmap_data
;
}
/* Map the surface. */
hr
=
wined3d_surface_map
(
surface
,
&
lock
,
NULL
,
0
);
if
(
FAILED
(
hr
))
ERR
(
"Map failed, hr %#x.
\n
"
,
hr
);
/* Sync the DIB with the PBO. This can't be done earlier because Map()
* activates the allocatedMemory. */
if
(
surface
->
flags
&
SFLAG_PBO
)
memcpy
(
surface
->
dib
.
bitmap_data
,
surface
->
resource
.
allocatedMemory
,
surface
->
resource
.
size
);
return
hr
;
}
static
BOOL
surface_is_full_rect
(
const
struct
wined3d_surface
*
surface
,
const
RECT
*
r
)
{
if
((
r
->
left
&&
r
->
right
)
||
abs
(
r
->
right
-
r
->
left
)
!=
surface
->
resource
.
width
)
...
...
@@ -1956,7 +1919,6 @@ static const struct wined3d_surface_ops surface_ops =
surface_preload
,
surface_map
,
surface_unmap
,
surface_getdc
,
};
/*****************************************************************************
...
...
@@ -2085,28 +2047,6 @@ static void gdi_surface_unmap(struct wined3d_surface *surface)
memset
(
&
surface
->
lockedRect
,
0
,
sizeof
(
RECT
));
}
static
HRESULT
gdi_surface_getdc
(
struct
wined3d_surface
*
surface
)
{
WINED3DLOCKED_RECT
lock
;
HRESULT
hr
;
TRACE
(
"surface %p.
\n
"
,
surface
);
/* Should have a DIB section already. */
if
(
!
(
surface
->
flags
&
SFLAG_DIBSECTION
))
{
WARN
(
"DC not supported on this surface
\n
"
);
return
WINED3DERR_INVALIDCALL
;
}
/* Map the surface. */
hr
=
wined3d_surface_map
(
surface
,
&
lock
,
NULL
,
0
);
if
(
FAILED
(
hr
))
ERR
(
"Map failed, hr %#x.
\n
"
,
hr
);
return
hr
;
}
static
const
struct
wined3d_surface_ops
gdi_surface_ops
=
{
gdi_surface_private_setup
,
...
...
@@ -2115,7 +2055,6 @@ static const struct wined3d_surface_ops gdi_surface_ops =
gdi_surface_preload
,
gdi_surface_map
,
gdi_surface_unmap
,
gdi_surface_getdc
,
};
void
surface_set_texture_name
(
struct
wined3d_surface
*
surface
,
GLuint
new_name
,
BOOL
srgb
)
...
...
@@ -3862,6 +3801,7 @@ HRESULT CDECL wined3d_surface_map(struct wined3d_surface *surface,
HRESULT
CDECL
wined3d_surface_getdc
(
struct
wined3d_surface
*
surface
,
HDC
*
dc
)
{
WINED3DLOCKED_RECT
lock
;
HRESULT
hr
;
TRACE
(
"surface %p, dc %p.
\n
"
,
surface
,
dc
);
...
...
@@ -3880,9 +3820,35 @@ HRESULT CDECL wined3d_surface_getdc(struct wined3d_surface *surface, HDC *dc)
if
(
surface
->
flags
&
SFLAG_LOCKED
)
return
WINED3DERR_INVALIDCALL
;
hr
=
surface
->
surface_ops
->
surface_getdc
(
surface
);
/* Create a DIB section if there isn't a dc yet. */
if
(
!
surface
->
hDC
)
{
if
(
surface
->
flags
&
SFLAG_CLIENT
)
{
surface_load_location
(
surface
,
SFLAG_INSYSMEM
,
NULL
);
surface_release_client_storage
(
surface
);
}
hr
=
surface_create_dib_section
(
surface
);
if
(
FAILED
(
hr
))
return
WINED3DERR_INVALIDCALL
;
/* Use the DIB section from now on if we are not using a PBO. */
if
(
!
(
surface
->
flags
&
SFLAG_PBO
))
surface
->
resource
.
allocatedMemory
=
surface
->
dib
.
bitmap_data
;
}
/* Map the surface. */
hr
=
wined3d_surface_map
(
surface
,
&
lock
,
NULL
,
0
);
if
(
FAILED
(
hr
))
{
ERR
(
"Map failed, hr %#x.
\n
"
,
hr
);
return
hr
;
}
/* Sync the DIB with the PBO. This can't be done earlier because Map()
* activates the allocatedMemory. */
if
(
surface
->
flags
&
SFLAG_PBO
)
memcpy
(
surface
->
dib
.
bitmap_data
,
surface
->
resource
.
allocatedMemory
,
surface
->
resource
.
size
);
if
(
surface
->
resource
.
format
->
id
==
WINED3DFMT_P8_UINT
||
surface
->
resource
.
format
->
id
==
WINED3DFMT_P8_UINT_A8_UNORM
)
...
...
dlls/wined3d/wined3d_private.h
View file @
3f11631e
...
...
@@ -2004,7 +2004,6 @@ struct wined3d_surface_ops
void
(
*
surface_preload
)(
struct
wined3d_surface
*
surface
);
void
(
*
surface_map
)(
struct
wined3d_surface
*
surface
,
const
RECT
*
rect
,
DWORD
flags
);
void
(
*
surface_unmap
)(
struct
wined3d_surface
*
surface
);
HRESULT
(
*
surface_getdc
)(
struct
wined3d_surface
*
surface
);
};
struct
wined3d_surface
...
...
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