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
eced5fe8
Commit
eced5fe8
authored
Mar 30, 2010
by
Henri Verbeet
Committed by
Alexandre Julliard
Mar 30, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Calculate "offset" in the appropriate path in IWineD3DDeviceImpl_UpdateSurface().
parent
bb94bc38
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
23 deletions
+17
-23
device.c
dlls/wined3d/device.c
+17
-23
No files found.
dlls/wined3d/device.c
View file @
eced5fe8
...
...
@@ -5161,14 +5161,14 @@ static HRESULT WINAPI IWineD3DDeviceImpl_UpdateSurface(IWineD3DDevice *iface,
int
srcWidth
,
srcHeight
;
unsigned
int
srcSurfaceWidth
,
srcSurfaceHeight
;
WINED3DFORMAT
destFormat
,
srcFormat
;
int
srcLeft
,
destLeft
,
destTop
;
int
destLeft
,
destTop
;
WINED3DPOOL
srcPool
,
destPool
;
int
offset
=
0
;
GLenum
dummy
;
DWORD
sampler
;
int
bpp
;
CONVERT_TYPES
convert
=
NO_CONVERSION
;
struct
wined3d_context
*
context
;
const
unsigned
char
*
data
;
WINED3DSURFACE_DESC
winedesc
;
...
...
@@ -5224,34 +5224,16 @@ static HRESULT WINAPI IWineD3DDeviceImpl_UpdateSurface(IWineD3DDevice *iface,
/* this needs to be done in lines if the sourceRect != the sourceWidth */
srcWidth
=
pSourceRect
?
pSourceRect
->
right
-
pSourceRect
->
left
:
srcSurfaceWidth
;
srcHeight
=
pSourceRect
?
pSourceRect
->
bottom
-
pSourceRect
->
top
:
srcSurfaceHeight
;
srcLeft
=
pSourceRect
?
pSourceRect
->
left
:
0
;
destLeft
=
pDestPoint
?
pDestPoint
->
x
:
0
;
destTop
=
pDestPoint
?
pDestPoint
->
y
:
0
;
if
(
srcWidth
!=
srcSurfaceWidth
||
srcLeft
){
offset
+=
srcLeft
*
src_format_desc
->
byte_count
;
/* TODO: do we ever get 3bpp?, would a shift and an add be quicker than a mul (well maybe a cycle or two) */
}
if
(
pSourceRect
!=
NULL
&&
pSourceRect
->
top
!=
0
){
offset
+=
pSourceRect
->
top
*
srcSurfaceWidth
*
src_format_desc
->
byte_count
;
}
TRACE
(
"(%p) glTexSubImage2D, level %d, left %d, top %d, width %d, height %d, fmt %#x, type %#x, memory %p+%#x
\n
"
,
This
,
dst_impl
->
texture_level
,
destLeft
,
destTop
,
srcWidth
,
srcHeight
,
dst_format_desc
->
glFormat
,
dst_format_desc
->
glType
,
IWineD3DSurface_GetData
(
pSourceSurface
),
offset
);
/* Sanity check */
if
(
IWineD3DSurface_GetData
(
pSourceSurface
)
==
NULL
)
{
/* need to lock the surface to get the data */
FIXME
(
"Surfaces has no allocated memory, but should be an in memory only surface
\n
"
);
}
data
=
IWineD3DSurface_GetData
(
pSourceSurface
);
if
(
!
data
)
ERR
(
"Source surface has no allocated memory, but should be a sysmem surface.
\n
"
);
ENTER_GL
();
if
(
dst_format_desc
->
Flags
&
WINED3DFMT_FLAG_COMPRESSED
)
{
const
unsigned
char
*
data
=
((
const
unsigned
char
*
)
IWineD3DSurface_GetData
(
pSourceSurface
));
UINT
row_length
=
(
srcWidth
/
src_format_desc
->
block_width
)
*
src_format_desc
->
block_byte_count
;
UINT
row_count
=
srcHeight
/
src_format_desc
->
block_height
;
UINT
src_pitch
=
IWineD3DSurface_GetPitch
(
pSourceSurface
);
...
...
@@ -5262,6 +5244,10 @@ static HRESULT WINAPI IWineD3DDeviceImpl_UpdateSurface(IWineD3DDevice *iface,
data
+=
(
pSourceRect
->
left
/
src_format_desc
->
block_width
)
*
src_format_desc
->
block_byte_count
;
}
TRACE
(
"glCompressedTexSubImage2DARB, target %#x, level %d, x %d, y %d, w %d, h %d, "
"format %#x, image_size %#x, data %p.
\n
"
,
dst_impl
->
texture_target
,
dst_impl
->
texture_level
,
destLeft
,
destTop
,
srcWidth
,
srcHeight
,
dst_format_desc
->
glFormat
,
row_count
*
row_length
,
data
);
if
(
row_length
==
src_pitch
)
{
GL_EXTCALL
(
glCompressedTexSubImage2DARB
(
dst_impl
->
texture_target
,
dst_impl
->
texture_level
,
...
...
@@ -5286,7 +5272,15 @@ static HRESULT WINAPI IWineD3DDeviceImpl_UpdateSurface(IWineD3DDevice *iface,
}
else
{
const
unsigned
char
*
data
=
((
const
unsigned
char
*
)
IWineD3DSurface_GetData
(
pSourceSurface
))
+
offset
;
if
(
pSourceRect
)
{
data
+=
pSourceRect
->
top
*
srcSurfaceWidth
*
src_format_desc
->
byte_count
;
data
+=
pSourceRect
->
left
*
src_format_desc
->
byte_count
;
}
TRACE
(
"glTexSubImage2D, target %#x, level %d, x %d, y %d, w %d, h %d, format %#x, type %#x, data %p.
\n
"
,
dst_impl
->
texture_target
,
dst_impl
->
texture_level
,
destLeft
,
destTop
,
srcWidth
,
srcHeight
,
dst_format_desc
->
glFormat
,
dst_format_desc
->
glType
,
data
);
glPixelStorei
(
GL_UNPACK_ROW_LENGTH
,
srcSurfaceWidth
);
glTexSubImage2D
(
dst_impl
->
texture_target
,
dst_impl
->
texture_level
,
destLeft
,
destTop
,
...
...
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