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
01199072
Commit
01199072
authored
Mar 12, 2007
by
Erich Hoover
Committed by
Alexandre Julliard
Mar 17, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Fix LockRect memory location calculation for WINED3DFMT_DXT*.
parent
7a43e790
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
3 deletions
+13
-3
surface.c
dlls/d3d9/tests/surface.c
+1
-1
surface.c
dlls/wined3d/surface.c
+12
-2
No files found.
dlls/d3d9/tests/surface.c
View file @
01199072
...
...
@@ -218,7 +218,7 @@ static void test_lockrect_offset(IDirect3DDevice9 *device)
offset
=
(
BYTE
*
)
locked_rect
.
pBits
-
base
;
expected_offset
=
(
rect
.
top
/
dxt_formats
[
i
].
block_height
)
*
locked_rect
.
Pitch
+
(
rect
.
left
/
dxt_formats
[
i
].
block_width
)
*
dxt_formats
[
i
].
block_size
;
todo_wine
ok
(
offset
==
expected_offset
,
"Got offset %u, expected offset %u for format %s
\n
"
,
offset
,
expected_offset
,
dxt_formats
[
i
].
name
);
ok
(
offset
==
expected_offset
,
"Got offset %u, expected offset %u for format %s
\n
"
,
offset
,
expected_offset
,
dxt_formats
[
i
].
name
);
hr
=
IDirect3DSurface9_UnlockRect
(
surface
);
ok
(
SUCCEEDED
(
hr
),
"UnlockRect failed (%08x)
\n
"
,
hr
);
...
...
dlls/wined3d/surface.c
View file @
01199072
...
...
@@ -623,8 +623,18 @@ static HRESULT WINAPI IWineD3DSurfaceImpl_LockRect(IWineD3DSurface *iface, WINED
return
WINED3DERR_INVALIDCALL
;
}
if
(
This
->
resource
.
format
==
WINED3DFMT_DXT1
)
{
/* DXT1 is half byte per pixel */
pLockedRect
->
pBits
=
This
->
resource
.
allocatedMemory
+
(
pLockedRect
->
Pitch
*
pRect
->
top
)
+
((
pRect
->
left
*
This
->
bytesPerPixel
/
2
));
/* DXTn textures are based on compressed blocks of 4x4 pixels, each
* 16 bytes large (8 bytes in case of DXT1). Because of that Pitch has
* slightly different meaning compared to regular textures. For DXTn
* textures Pitch is the size of a row of blocks, 4 high and "width"
* long. The x offset is calculated differently as well, since moving 4
* pixels to the right actually moves an entire 4x4 block to right, ie
* 16 bytes (8 in case of DXT1). */
if
(
This
->
resource
.
format
==
WINED3DFMT_DXT1
)
{
pLockedRect
->
pBits
=
This
->
resource
.
allocatedMemory
+
(
pLockedRect
->
Pitch
*
pRect
->
top
/
4
)
+
(
pRect
->
left
*
2
);
}
else
if
(
This
->
resource
.
format
==
WINED3DFMT_DXT2
||
This
->
resource
.
format
==
WINED3DFMT_DXT3
||
This
->
resource
.
format
==
WINED3DFMT_DXT4
||
This
->
resource
.
format
==
WINED3DFMT_DXT5
)
{
pLockedRect
->
pBits
=
This
->
resource
.
allocatedMemory
+
(
pLockedRect
->
Pitch
*
pRect
->
top
/
4
)
+
(
pRect
->
left
*
4
);
}
else
{
pLockedRect
->
pBits
=
This
->
resource
.
allocatedMemory
+
(
pLockedRect
->
Pitch
*
pRect
->
top
)
+
(
pRect
->
left
*
This
->
bytesPerPixel
);
}
...
...
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