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
e56c6610
Commit
e56c6610
authored
Sep 16, 2007
by
Stefan Dösinger
Committed by
Alexandre Julliard
Sep 18, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Clean up SetFormatDesc.
parent
26000417
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
55 additions
and
42 deletions
+55
-42
surface.c
dlls/wined3d/surface.c
+13
-40
surface_base.c
dlls/wined3d/surface_base.c
+40
-0
surface_gdi.c
dlls/wined3d/surface_gdi.c
+1
-1
wined3d_private.h
dlls/wined3d/wined3d_private.h
+1
-1
No files found.
dlls/wined3d/surface.c
View file @
e56c6610
...
...
@@ -2518,50 +2518,23 @@ extern HRESULT WINAPI IWineD3DSurfaceImpl_AddDirtyRect(IWineD3DSurface *iface, C
HRESULT
WINAPI
IWineD3DSurfaceImpl_SetFormat
(
IWineD3DSurface
*
iface
,
WINED3DFORMAT
format
)
{
IWineD3DSurfaceImpl
*
This
=
(
IWineD3DSurfaceImpl
*
)
iface
;
HRESULT
hr
;
const
GlPixelFormatDesc
*
glDesc
;
const
StaticPixelFormatDesc
*
formatEntry
=
getFormatDescEntry
(
format
,
&
GLINFO_LOCATION
,
&
glDesc
);
if
(
This
->
resource
.
format
!=
WINED3DFMT_UNKNOWN
)
{
FIXME
(
"(%p) : The format of the surface must be WINED3DFORMAT_UNKNOWN
\n
"
,
This
);
return
WINED3DERR_INVALIDCALL
;
}
getFormatDescEntry
(
format
,
&
GLINFO_LOCATION
,
&
glDesc
);
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
==
WINED3DFMT_DXT1
)
{
/* DXT1 is half byte per pixel */
This
->
resource
.
size
=
((
max
(
This
->
pow2Width
,
4
)
*
formatEntry
->
bpp
)
*
max
(
This
->
pow2Height
,
4
))
>>
1
;
TRACE
(
"(%p) : Calling base function first
\n
"
,
This
);
hr
=
IWineD3DBaseSurfaceImpl_SetFormat
(
iface
,
format
);
if
(
SUCCEEDED
(
hr
))
{
/* Setup some glformat defaults */
This
->
glDescription
.
glFormat
=
glDesc
->
glFormat
;
This
->
glDescription
.
glFormatInternal
=
glDesc
->
glInternal
;
This
->
glDescription
.
glType
=
glDesc
->
glType
;
}
else
if
(
format
==
WINED3DFMT_DXT2
||
format
==
WINED3DFMT_DXT3
||
format
==
WINED3DFMT_DXT4
||
format
==
WINED3DFMT_DXT5
)
{
This
->
resource
.
size
=
((
max
(
This
->
pow2Width
,
4
)
*
formatEntry
->
bpp
)
*
max
(
This
->
pow2Height
,
4
));
}
else
{
unsigned
char
alignment
=
This
->
resource
.
wineD3DDevice
->
surface_alignment
;
This
->
resource
.
size
=
((
This
->
pow2Width
*
formatEntry
->
bpp
)
+
alignment
-
1
)
&
~
(
alignment
-
1
);
This
->
resource
.
size
*=
This
->
pow2Height
;
This
->
Flags
&=
~
SFLAG_ALLOCATED
;
TRACE
(
"(%p) : glFormat %d, glFotmatInternal %d, glType %d
\n
"
,
This
,
This
->
glDescription
.
glFormat
,
This
->
glDescription
.
glFormatInternal
,
This
->
glDescription
.
glType
);
}
/* Setup some glformat defaults */
This
->
glDescription
.
glFormat
=
glDesc
->
glFormat
;
This
->
glDescription
.
glFormatInternal
=
glDesc
->
glInternal
;
This
->
glDescription
.
glType
=
glDesc
->
glType
;
if
(
format
!=
WINED3DFMT_UNKNOWN
)
{
This
->
bytesPerPixel
=
formatEntry
->
bpp
;
}
else
{
This
->
bytesPerPixel
=
0
;
}
This
->
Flags
|=
(
WINED3DFMT_D16_LOCKABLE
==
format
)
?
SFLAG_LOCKABLE
:
0
;
This
->
Flags
&=
~
SFLAG_ALLOCATED
;
This
->
resource
.
format
=
format
;
TRACE
(
"(%p) : Size %d, bytesPerPixel %d, glFormat %d, glFotmatInternal %d, glType %d
\n
"
,
This
,
This
->
resource
.
size
,
This
->
bytesPerPixel
,
This
->
glDescription
.
glFormat
,
This
->
glDescription
.
glFormatInternal
,
This
->
glDescription
.
glType
);
return
WINED3D_OK
;
return
hr
;
}
HRESULT
WINAPI
IWineD3DSurfaceImpl_SetMem
(
IWineD3DSurface
*
iface
,
void
*
Mem
)
{
...
...
dlls/wined3d/surface_base.c
View file @
e56c6610
...
...
@@ -436,3 +436,43 @@ HRESULT WINAPI IWineD3DBaseSurfaceImpl_SetContainer(IWineD3DSurface *iface, IWin
return
WINED3D_OK
;
}
HRESULT
WINAPI
IWineD3DBaseSurfaceImpl_SetFormat
(
IWineD3DSurface
*
iface
,
WINED3DFORMAT
format
)
{
IWineD3DSurfaceImpl
*
This
=
(
IWineD3DSurfaceImpl
*
)
iface
;
const
StaticPixelFormatDesc
*
formatEntry
=
getFormatDescEntry
(
format
,
NULL
,
NULL
);
if
(
This
->
resource
.
format
!=
WINED3DFMT_UNKNOWN
)
{
FIXME
(
"(%p) : The format of the surface must be WINED3DFORMAT_UNKNOWN
\n
"
,
This
);
return
WINED3DERR_INVALIDCALL
;
}
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
==
WINED3DFMT_DXT1
)
{
/* DXT1 is half byte per pixel */
This
->
resource
.
size
=
((
max
(
This
->
pow2Width
,
4
)
*
formatEntry
->
bpp
)
*
max
(
This
->
pow2Height
,
4
))
>>
1
;
}
else
if
(
format
==
WINED3DFMT_DXT2
||
format
==
WINED3DFMT_DXT3
||
format
==
WINED3DFMT_DXT4
||
format
==
WINED3DFMT_DXT5
)
{
This
->
resource
.
size
=
((
max
(
This
->
pow2Width
,
4
)
*
formatEntry
->
bpp
)
*
max
(
This
->
pow2Height
,
4
));
}
else
{
unsigned
char
alignment
=
This
->
resource
.
wineD3DDevice
->
surface_alignment
;
This
->
resource
.
size
=
((
This
->
pow2Width
*
formatEntry
->
bpp
)
+
alignment
-
1
)
&
~
(
alignment
-
1
);
This
->
resource
.
size
*=
This
->
pow2Height
;
}
if
(
format
!=
WINED3DFMT_UNKNOWN
)
{
This
->
bytesPerPixel
=
formatEntry
->
bpp
;
}
else
{
This
->
bytesPerPixel
=
0
;
}
This
->
Flags
|=
(
WINED3DFMT_D16_LOCKABLE
==
format
)
?
SFLAG_LOCKABLE
:
0
;
This
->
resource
.
format
=
format
;
TRACE
(
"(%p) : Size %d, bytesPerPixel %d
\n
"
,
This
,
This
->
resource
.
size
,
This
->
bytesPerPixel
);
return
WINED3D_OK
;
}
dlls/wined3d/surface_gdi.c
View file @
e56c6610
...
...
@@ -1614,6 +1614,6 @@ const IWineD3DSurfaceVtbl IWineGDISurface_Vtbl =
IWineGDISurfaceImpl_SetGlTextureDesc
,
IWineGDISurfaceImpl_GetGlDesc
,
IWineD3DSurfaceImpl_GetData
,
IWineD3DSurfaceImpl_SetFormat
,
IWineD3D
Base
SurfaceImpl_SetFormat
,
IWineGDISurfaceImpl_PrivateSetup
};
dlls/wined3d/wined3d_private.h
View file @
e56c6610
...
...
@@ -1168,13 +1168,13 @@ HRESULT WINAPI IWineD3DBaseSurfaceImpl_UpdateOverlayZOrder(IWineD3DSurface *ifac
HRESULT
WINAPI
IWineD3DBaseSurfaceImpl_UpdateOverlay
(
IWineD3DSurface
*
iface
,
RECT
*
SrcRect
,
IWineD3DSurface
*
DstSurface
,
RECT
*
DstRect
,
DWORD
Flags
,
WINEDDOVERLAYFX
*
FX
);
HRESULT
WINAPI
IWineD3DBaseSurfaceImpl_SetClipper
(
IWineD3DSurface
*
iface
,
IWineD3DClipper
*
clipper
);
HRESULT
WINAPI
IWineD3DBaseSurfaceImpl_GetClipper
(
IWineD3DSurface
*
iface
,
IWineD3DClipper
**
clipper
);
HRESULT
WINAPI
IWineD3DBaseSurfaceImpl_SetFormat
(
IWineD3DSurface
*
iface
,
WINED3DFORMAT
format
);
ULONG
WINAPI
IWineD3DSurfaceImpl_Release
(
IWineD3DSurface
*
iface
);
void
WINAPI
IWineD3DSurfaceImpl_PreLoad
(
IWineD3DSurface
*
iface
);
HRESULT
WINAPI
IWineD3DSurfaceImpl_SetPixelFormat
(
IWineD3DSurface
*
iface
,
WINED3DFORMAT
Format
,
BYTE
*
Surface
,
DWORD
Size
);
extern
HRESULT
WINAPI
IWineD3DSurfaceImpl_AddDirtyRect
(
IWineD3DSurface
*
iface
,
CONST
RECT
*
pDirtyRect
);
const
void
*
WINAPI
IWineD3DSurfaceImpl_GetData
(
IWineD3DSurface
*
iface
);
HRESULT
WINAPI
IWineD3DSurfaceImpl_SetFormat
(
IWineD3DSurface
*
iface
,
WINED3DFORMAT
format
);
HRESULT
WINAPI
IWineD3DSurfaceImpl_GetDC
(
IWineD3DSurface
*
iface
,
HDC
*
pHDC
);
HRESULT
WINAPI
IWineD3DSurfaceImpl_ReleaseDC
(
IWineD3DSurface
*
iface
,
HDC
hDC
);
HRESULT
WINAPI
IWineD3DSurfaceImpl_SetMem
(
IWineD3DSurface
*
iface
,
void
*
Mem
);
...
...
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