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
81fb749e
Commit
81fb749e
authored
Apr 23, 2014
by
Henri Verbeet
Committed by
Alexandre Julliard
Apr 23, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Introduce a separate function to calculate the pitch for a given format and width.
parent
a1c63c27
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
17 deletions
+18
-17
surface.c
dlls/wined3d/surface.c
+4
-14
utils.c
dlls/wined3d/utils.c
+13
-3
wined3d_private.h
dlls/wined3d/wined3d_private.h
+1
-0
No files found.
dlls/wined3d/surface.c
View file @
81fb749e
...
...
@@ -2435,7 +2435,7 @@ struct wined3d_palette * CDECL wined3d_surface_get_palette(const struct wined3d_
DWORD
CDECL
wined3d_surface_get_pitch
(
const
struct
wined3d_surface
*
surface
)
{
const
struct
wined3d_format
*
format
=
surface
->
resource
.
forma
t
;
unsigned
int
alignmen
t
;
DWORD
pitch
;
TRACE
(
"surface %p.
\n
"
,
surface
);
...
...
@@ -2443,19 +2443,9 @@ DWORD CDECL wined3d_surface_get_pitch(const struct wined3d_surface *surface)
if
(
surface
->
pitch
)
return
surface
->
pitch
;
if
(
format
->
flags
&
WINED3DFMT_FLAG_BLOCKS
)
{
/* Since compressed formats are block based, pitch means the amount of
* bytes to the next row of block rather than the next row of pixels. */
UINT
row_block_count
=
(
surface
->
resource
.
width
+
format
->
block_width
-
1
)
/
format
->
block_width
;
pitch
=
row_block_count
*
format
->
block_byte_count
;
}
else
{
unsigned
char
alignment
=
surface
->
resource
.
device
->
surface_alignment
;
pitch
=
surface
->
resource
.
format
->
byte_count
*
surface
->
resource
.
width
;
/* Bytes / row */
pitch
=
(
pitch
+
alignment
-
1
)
&
~
(
alignment
-
1
);
}
alignment
=
surface
->
resource
.
device
->
surface_alignment
;
pitch
=
wined3d_format_calculate_pitch
(
surface
->
resource
.
format
,
surface
->
resource
.
width
);
pitch
=
(
pitch
+
alignment
-
1
)
&
~
(
alignment
-
1
);
TRACE
(
"Returning %u.
\n
"
,
pitch
);
...
...
dlls/wined3d/utils.c
View file @
81fb749e
...
...
@@ -2019,9 +2019,20 @@ const struct wined3d_format *wined3d_get_format(const struct wined3d_gl_info *gl
return
&
gl_info
->
formats
[
idx
];
}
UINT
wined3d_format_calculate_pitch
(
const
struct
wined3d_format
*
format
,
UINT
width
)
{
/* For block based formats, pitch means the amount of bytes to the next
* row of blocks rather than the next row of pixels. */
if
(
format
->
flags
&
WINED3DFMT_FLAG_BLOCKS
)
return
format
->
block_byte_count
*
((
width
+
format
->
block_width
-
1
)
/
format
->
block_width
);
return
format
->
byte_count
*
width
;
}
UINT
wined3d_format_calculate_size
(
const
struct
wined3d_format
*
format
,
UINT
alignment
,
UINT
width
,
UINT
height
,
UINT
depth
)
{
UINT
pitch
=
wined3d_format_calculate_pitch
(
format
,
width
);
UINT
size
;
if
(
format
->
id
==
WINED3DFMT_UNKNOWN
)
...
...
@@ -2030,13 +2041,12 @@ UINT wined3d_format_calculate_size(const struct wined3d_format *format, UINT ali
}
else
if
(
format
->
flags
&
WINED3DFMT_FLAG_BLOCKS
)
{
UINT
row_block_count
=
(
width
+
format
->
block_width
-
1
)
/
format
->
block_width
;
UINT
row_count
=
(
height
+
format
->
block_height
-
1
)
/
format
->
block_height
;
size
=
row_count
*
((
(
row_block_count
*
format
->
block_byte_count
)
+
alignment
-
1
)
&
~
(
alignment
-
1
));
size
=
row_count
*
((
pitch
+
alignment
-
1
)
&
~
(
alignment
-
1
));
}
else
{
size
=
height
*
((
(
width
*
format
->
byte_count
)
+
alignment
-
1
)
&
~
(
alignment
-
1
));
size
=
height
*
((
pitch
+
alignment
-
1
)
&
~
(
alignment
-
1
));
}
if
(
format
->
flags
&
WINED3DFMT_FLAG_HEIGHT_SCALE
)
...
...
dlls/wined3d/wined3d_private.h
View file @
81fb749e
...
...
@@ -3040,6 +3040,7 @@ struct wined3d_format
const
struct
wined3d_format
*
wined3d_get_format
(
const
struct
wined3d_gl_info
*
gl_info
,
enum
wined3d_format_id
format_id
)
DECLSPEC_HIDDEN
;
UINT
wined3d_format_calculate_pitch
(
const
struct
wined3d_format
*
format
,
UINT
width
)
DECLSPEC_HIDDEN
;
UINT
wined3d_format_calculate_size
(
const
struct
wined3d_format
*
format
,
UINT
alignment
,
UINT
width
,
UINT
height
,
UINT
depth
)
DECLSPEC_HIDDEN
;
DWORD
wined3d_format_convert_from_float
(
const
struct
wined3d_surface
*
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