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
fede35d1
Commit
fede35d1
authored
Jun 15, 2009
by
Henri Verbeet
Committed by
Alexandre Julliard
Jun 15, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Introduce surface_calculate_size().
parent
5f581975
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
33 deletions
+30
-33
surface.c
dlls/wined3d/surface.c
+26
-18
surface_base.c
dlls/wined3d/surface_base.c
+3
-15
wined3d_private.h
dlls/wined3d/wined3d_private.h
+1
-0
No files found.
dlls/wined3d/surface.c
View file @
fede35d1
...
...
@@ -94,6 +94,31 @@ static void surface_cleanup(IWineD3DSurfaceImpl *This)
resource_cleanup
((
IWineD3DResource
*
)
This
);
}
UINT
surface_calculate_size
(
const
struct
GlPixelFormatDesc
*
format_desc
,
UINT
alignment
,
UINT
width
,
UINT
height
)
{
UINT
size
;
if
(
format_desc
->
format
==
WINED3DFMT_UNKNOWN
)
{
size
=
0
;
}
else
if
(
format_desc
->
Flags
&
WINED3DFMT_FLAG_COMPRESSED
)
{
UINT
row_block_count
=
(
width
+
format_desc
->
block_width
-
1
)
/
format_desc
->
block_width
;
UINT
row_count
=
(
height
+
format_desc
->
block_height
-
1
)
/
format_desc
->
block_height
;
size
=
row_count
*
row_block_count
*
format_desc
->
block_byte_count
;
}
else
{
/* The pitch is a multiple of 4 bytes. */
size
=
height
*
(((
width
*
format_desc
->
byte_count
)
+
alignment
-
1
)
&
~
(
alignment
-
1
));
}
if
(
format_desc
->
heightscale
!=
0
.
0
)
size
*=
format_desc
->
heightscale
;
return
size
;
}
HRESULT
surface_init
(
IWineD3DSurfaceImpl
*
surface
,
WINED3DSURFTYPE
surface_type
,
UINT
alignment
,
UINT
width
,
UINT
height
,
UINT
level
,
BOOL
lockable
,
BOOL
discard
,
WINED3DMULTISAMPLE_TYPE
multisample_type
,
UINT
multisample_quality
,
IWineD3DDeviceImpl
*
device
,
DWORD
usage
,
WINED3DFORMAT
format
,
...
...
@@ -113,24 +138,7 @@ HRESULT surface_init(IWineD3DSurfaceImpl *surface, WINED3DSURFTYPE surface_type,
/* FIXME: Check that the format is supported by the device. */
if
(
format
==
WINED3DFMT_UNKNOWN
)
{
resource_size
=
0
;
}
else
if
(
format_desc
->
Flags
&
WINED3DFMT_FLAG_COMPRESSED
)
{
UINT
row_block_count
=
(
width
+
format_desc
->
block_width
-
1
)
/
format_desc
->
block_width
;
UINT
row_count
=
(
height
+
format_desc
->
block_height
-
1
)
/
format_desc
->
block_height
;
resource_size
=
row_count
*
row_block_count
*
format_desc
->
block_byte_count
;
}
else
{
/* The pitch is a multiple of 4 bytes. */
resource_size
=
((
width
*
format_desc
->
byte_count
)
+
alignment
-
1
)
&
~
(
alignment
-
1
);
resource_size
*=
height
;
}
if
(
format_desc
->
heightscale
!=
0
.
0
)
resource_size
*=
format_desc
->
heightscale
;
resource_size
=
surface_calculate_size
(
format_desc
,
alignment
,
width
,
height
);
/* Look at the implementation and set the correct Vtable. */
switch
(
surface_type
)
...
...
dlls/wined3d/surface_base.c
View file @
fede35d1
...
...
@@ -519,21 +519,9 @@ HRESULT WINAPI IWineD3DBaseSurfaceImpl_SetFormat(IWineD3DSurface *iface, WINED3D
}
TRACE
(
"(%p) : Setting texture format to (%d,%s)
\n
"
,
This
,
format
,
debug_d3dformat
(
format
));
if
(
format
==
WINED3DFMT_UNKNOWN
)
{
This
->
resource
.
size
=
0
;
}
else
if
(
format_desc
->
Flags
&
WINED3DFMT_FLAG_COMPRESSED
)
{
UINT
row_block_count
=
(
This
->
pow2Width
+
format_desc
->
block_width
-
1
)
/
format_desc
->
block_width
;
UINT
row_count
=
(
This
->
pow2Height
+
format_desc
->
block_height
-
1
)
/
format_desc
->
block_height
;
This
->
resource
.
size
=
row_count
*
row_block_count
*
format_desc
->
block_byte_count
;
}
else
{
unsigned
char
alignment
=
This
->
resource
.
wineD3DDevice
->
surface_alignment
;
This
->
resource
.
size
=
((
This
->
pow2Width
*
format_desc
->
byte_count
)
+
alignment
-
1
)
&
~
(
alignment
-
1
);
This
->
resource
.
size
*=
This
->
pow2Height
;
}
This
->
resource
.
size
=
surface_calculate_size
(
format_desc
,
This
->
resource
.
wineD3DDevice
->
surface_alignment
,
This
->
pow2Width
,
This
->
pow2Height
);
This
->
Flags
|=
(
WINED3DFMT_D16_LOCKABLE
==
format
)
?
SFLAG_LOCKABLE
:
0
;
...
...
dlls/wined3d/wined3d_private.h
View file @
fede35d1
...
...
@@ -1920,6 +1920,7 @@ struct IWineD3DSurfaceImpl
extern
const
IWineD3DSurfaceVtbl
IWineD3DSurface_Vtbl
;
extern
const
IWineD3DSurfaceVtbl
IWineGDISurface_Vtbl
;
UINT
surface_calculate_size
(
const
struct
GlPixelFormatDesc
*
format_desc
,
UINT
alignment
,
UINT
width
,
UINT
height
);
void
surface_gdi_cleanup
(
IWineD3DSurfaceImpl
*
This
);
HRESULT
surface_init
(
IWineD3DSurfaceImpl
*
surface
,
WINED3DSURFTYPE
surface_type
,
UINT
alignment
,
UINT
width
,
UINT
height
,
UINT
level
,
BOOL
lockable
,
BOOL
discard
,
WINED3DMULTISAMPLE_TYPE
multisample_type
,
...
...
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