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
3eba8b5d
Commit
3eba8b5d
authored
Aug 18, 2010
by
Henri Verbeet
Committed by
Alexandre Julliard
Aug 19, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ddraw: Merge gamma.c into surface.c.
parent
9d3e2f1b
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
120 additions
and
221 deletions
+120
-221
Makefile.in
dlls/ddraw/Makefile.in
+0
-1
gamma.c
dlls/ddraw/gamma.c
+0
-220
surface.c
dlls/ddraw/surface.c
+120
-0
No files found.
dlls/ddraw/Makefile.in
View file @
3eba8b5d
...
...
@@ -11,7 +11,6 @@ C_SRCS = \
ddraw.c
\
device.c
\
executebuffer.c
\
gamma.c
\
light.c
\
main.c
\
material.c
\
...
...
dlls/ddraw/gamma.c
deleted
100644 → 0
View file @
9d3e2f1b
/* DirectDrawGammaControl implementation
*
* Copyright 2001 TransGaming Technologies Inc.
* Copyright 2006 Stefan Dösinger
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "config.h"
#include "wine/port.h"
#include "wine/debug.h"
#include <assert.h>
#include <stdarg.h>
#include <string.h>
#include <stdlib.h>
#define COBJMACROS
#include "windef.h"
#include "winbase.h"
#include "winerror.h"
#include "wingdi.h"
#include "wine/exception.h"
#include "ddraw.h"
#include "d3d.h"
#include "ddraw_private.h"
WINE_DEFAULT_DEBUG_CHANNEL
(
ddraw
);
WINE_DECLARE_DEBUG_CHANNEL
(
ddraw_thunk
);
static
inline
IDirectDrawSurfaceImpl
*
surface_from_gamma_control
(
IDirectDrawGammaControl
*
iface
)
{
return
(
IDirectDrawSurfaceImpl
*
)((
char
*
)
iface
-
FIELD_OFFSET
(
IDirectDrawSurfaceImpl
,
IDirectDrawGammaControl_vtbl
));
}
/**********************************************************
* IUnknown parts follow
**********************************************************/
/**********************************************************
* IDirectDrawGammaControl::QueryInterface
*
* QueryInterface, thunks to IDirectDrawSurface
*
* Params:
* riid: Interface id queried for
* obj: Returns the interface pointer
*
* Returns:
* S_OK or E_NOINTERFACE: See IDirectDrawSurface7::QueryInterface
*
**********************************************************/
static
HRESULT
WINAPI
IDirectDrawGammaControlImpl_QueryInterface
(
IDirectDrawGammaControl
*
iface
,
REFIID
riid
,
void
**
obj
)
{
IDirectDrawSurfaceImpl
*
This
=
surface_from_gamma_control
(
iface
);
TRACE_
(
ddraw_thunk
)(
"(%p)->(%s,%p): Thunking to IDirectDrawSurface7
\n
"
,
This
,
debugstr_guid
(
riid
),
obj
);
return
IDirectDrawSurface7_QueryInterface
((
IDirectDrawSurface7
*
)
This
,
riid
,
obj
);
}
/**********************************************************
* IDirectDrawGammaControl::AddRef
*
* Addref, thunks to IDirectDrawSurface
*
* Returns:
* The new refcount
*
**********************************************************/
static
ULONG
WINAPI
IDirectDrawGammaControlImpl_AddRef
(
IDirectDrawGammaControl
*
iface
)
{
IDirectDrawSurfaceImpl
*
This
=
surface_from_gamma_control
(
iface
);
TRACE_
(
ddraw_thunk
)(
"(%p)->() Thunking to IDirectDrawSurface7
\n
"
,
This
);
return
IDirectDrawSurface7_AddRef
((
IDirectDrawSurface7
*
)
This
);
}
/**********************************************************
* IDirectDrawGammaControl::Release
*
* Release, thunks to IDirectDrawSurface
*
* Returns:
* The new refcount
*
**********************************************************/
static
ULONG
WINAPI
IDirectDrawGammaControlImpl_Release
(
IDirectDrawGammaControl
*
iface
)
{
IDirectDrawSurfaceImpl
*
This
=
surface_from_gamma_control
(
iface
);
TRACE_
(
ddraw_thunk
)(
"(%p)->() Thunking to IDirectDrawSurface7
\n
"
,
This
);
return
IDirectDrawSurface7_Release
((
IDirectDrawSurface7
*
)
This
);
}
/**********************************************************
* IDirectDrawGammaControl
**********************************************************/
/**********************************************************
* IDirectDrawGammaControl::GetGammaRamp
*
* Returns the current gamma ramp for a surface
*
* Params:
* Flags: Ignored
* GammaRamp: Address to write the ramp to
*
* Returns:
* DD_OK on success
* DDERR_INVALIDPARAMS if GammaRamp is NULL
*
**********************************************************/
static
HRESULT
WINAPI
IDirectDrawGammaControlImpl_GetGammaRamp
(
IDirectDrawGammaControl
*
iface
,
DWORD
Flags
,
DDGAMMARAMP
*
GammaRamp
)
{
IDirectDrawSurfaceImpl
*
This
=
surface_from_gamma_control
(
iface
);
TRACE
(
"(%p)->(%08x,%p)
\n
"
,
This
,
Flags
,
GammaRamp
);
/* This looks sane */
if
(
!
GammaRamp
)
{
ERR
(
"(%p) GammaRamp is NULL, returning DDERR_INVALIDPARAMS
\n
"
,
This
);
return
DDERR_INVALIDPARAMS
;
}
EnterCriticalSection
(
&
ddraw_cs
);
if
(
This
->
surface_desc
.
ddsCaps
.
dwCaps
&
DDSCAPS_PRIMARYSURFACE
)
{
/* Note: DDGAMMARAMP is compatible with WINED3DGAMMARAMP */
IWineD3DDevice_GetGammaRamp
(
This
->
ddraw
->
wineD3DDevice
,
0
/* Swapchain */
,
(
WINED3DGAMMARAMP
*
)
GammaRamp
);
}
else
{
ERR
(
"(%p) Unimplemented for non-primary surfaces
\n
"
,
This
);
}
LeaveCriticalSection
(
&
ddraw_cs
);
return
DD_OK
;
}
/**********************************************************
* IDirectDrawGammaControl::SetGammaRamp
*
* Sets the red, green and blue gamma ramps for
*
* Params:
* Flags: Can be DDSGR_CALIBRATE to request calibration
* GammaRamp: Structure containing the new gamma ramp
*
* Returns:
* DD_OK on success
* DDERR_INVALIDPARAMS if GammaRamp is NULL
*
**********************************************************/
static
HRESULT
WINAPI
IDirectDrawGammaControlImpl_SetGammaRamp
(
IDirectDrawGammaControl
*
iface
,
DWORD
Flags
,
DDGAMMARAMP
*
GammaRamp
)
{
IDirectDrawSurfaceImpl
*
This
=
surface_from_gamma_control
(
iface
);
TRACE
(
"(%p)->(%08x,%p)
\n
"
,
This
,
Flags
,
GammaRamp
);
/* This looks sane */
if
(
!
GammaRamp
)
{
ERR
(
"(%p) GammaRamp is NULL, returning DDERR_INVALIDPARAMS
\n
"
,
This
);
return
DDERR_INVALIDPARAMS
;
}
EnterCriticalSection
(
&
ddraw_cs
);
if
(
This
->
surface_desc
.
ddsCaps
.
dwCaps
&
DDSCAPS_PRIMARYSURFACE
)
{
/* Note: DDGAMMARAMP is compatible with WINED3DGAMMARAMP */
IWineD3DDevice_SetGammaRamp
(
This
->
ddraw
->
wineD3DDevice
,
0
/* Swapchain */
,
Flags
,
(
WINED3DGAMMARAMP
*
)
GammaRamp
);
}
else
{
ERR
(
"(%p) Unimplemented for non-primary surfaces
\n
"
,
This
);
}
LeaveCriticalSection
(
&
ddraw_cs
);
return
DD_OK
;
}
const
IDirectDrawGammaControlVtbl
IDirectDrawGammaControl_Vtbl
=
{
IDirectDrawGammaControlImpl_QueryInterface
,
IDirectDrawGammaControlImpl_AddRef
,
IDirectDrawGammaControlImpl_Release
,
IDirectDrawGammaControlImpl_GetGammaRamp
,
IDirectDrawGammaControlImpl_SetGammaRamp
};
dlls/ddraw/surface.c
View file @
3eba8b5d
...
...
@@ -48,6 +48,12 @@
WINE_DEFAULT_DEBUG_CHANNEL
(
ddraw
);
static
inline
IDirectDrawSurfaceImpl
*
surface_from_gamma_control
(
IDirectDrawGammaControl
*
iface
)
{
return
(
IDirectDrawSurfaceImpl
*
)((
char
*
)
iface
-
FIELD_OFFSET
(
IDirectDrawSurfaceImpl
,
IDirectDrawGammaControl_vtbl
));
}
/*****************************************************************************
* IUnknown parts follow
*****************************************************************************/
...
...
@@ -153,6 +159,13 @@ static HRESULT WINAPI ddraw_surface3_QueryInterface(IDirectDrawSurface3 *iface,
return
ddraw_surface7_QueryInterface
((
IDirectDrawSurface7
*
)
surface_from_surface3
(
iface
),
riid
,
object
);
}
static
HRESULT
WINAPI
ddraw_gamma_control_QueryInterface
(
IDirectDrawGammaControl
*
iface
,
REFIID
riid
,
void
**
object
)
{
TRACE
(
"iface %p, riid %s, object %p.
\n
"
,
iface
,
debugstr_guid
(
riid
),
object
);
return
ddraw_surface7_QueryInterface
((
IDirectDrawSurface7
*
)
surface_from_gamma_control
(
iface
),
riid
,
object
);
}
/*****************************************************************************
* IDirectDrawSurface7::AddRef
*
...
...
@@ -185,6 +198,13 @@ static ULONG WINAPI ddraw_surface3_AddRef(IDirectDrawSurface3 *iface)
return
ddraw_surface7_AddRef
((
IDirectDrawSurface7
*
)
surface_from_surface3
(
iface
));
}
static
ULONG
WINAPI
ddraw_gamma_control_AddRef
(
IDirectDrawGammaControl
*
iface
)
{
TRACE
(
"iface %p.
\n
"
,
iface
);
return
ddraw_surface7_AddRef
((
IDirectDrawSurface7
*
)
surface_from_gamma_control
(
iface
));
}
/*****************************************************************************
* ddraw_surface_destroy
*
...
...
@@ -420,6 +440,13 @@ static ULONG WINAPI ddraw_surface3_Release(IDirectDrawSurface3 *iface)
return
ddraw_surface7_Release
((
IDirectDrawSurface7
*
)
surface_from_surface3
(
iface
));
}
static
ULONG
WINAPI
ddraw_gamma_control_Release
(
IDirectDrawGammaControl
*
iface
)
{
TRACE
(
"iface %p.
\n
"
,
iface
);
return
ddraw_surface7_Release
((
IDirectDrawSurface7
*
)
surface_from_gamma_control
(
iface
));
}
/*****************************************************************************
* IDirectDrawSurface7::GetAttachedSurface
*
...
...
@@ -2874,6 +2901,90 @@ static HRESULT WINAPI ddraw_surface3_SetPalette(IDirectDrawSurface3 *iface, IDir
return
ddraw_surface7_SetPalette
((
IDirectDrawSurface7
*
)
surface_from_surface3
(
iface
),
palette
);
}
/**********************************************************
* IDirectDrawGammaControl::GetGammaRamp
*
* Returns the current gamma ramp for a surface
*
* Params:
* flags: Ignored
* gamma_ramp: Address to write the ramp to
*
* Returns:
* DD_OK on success
* DDERR_INVALIDPARAMS if gamma_ramp is NULL
*
**********************************************************/
static
HRESULT
WINAPI
ddraw_gamma_control_GetGammaRamp
(
IDirectDrawGammaControl
*
iface
,
DWORD
flags
,
DDGAMMARAMP
*
gamma_ramp
)
{
IDirectDrawSurfaceImpl
*
surface
=
surface_from_gamma_control
(
iface
);
TRACE
(
"iface %p, flags %#x, gamma_ramp %p.
\n
"
,
iface
,
flags
,
gamma_ramp
);
if
(
!
gamma_ramp
)
{
WARN
(
"Invalid gamma_ramp passed.
\n
"
);
return
DDERR_INVALIDPARAMS
;
}
EnterCriticalSection
(
&
ddraw_cs
);
if
(
surface
->
surface_desc
.
ddsCaps
.
dwCaps
&
DDSCAPS_PRIMARYSURFACE
)
{
/* Note: DDGAMMARAMP is compatible with WINED3DGAMMARAMP. */
IWineD3DDevice_GetGammaRamp
(
surface
->
ddraw
->
wineD3DDevice
,
0
,
(
WINED3DGAMMARAMP
*
)
gamma_ramp
);
}
else
{
ERR
(
"Not implemented for non-primary surfaces.
\n
"
);
}
LeaveCriticalSection
(
&
ddraw_cs
);
return
DD_OK
;
}
/**********************************************************
* IDirectDrawGammaControl::SetGammaRamp
*
* Sets the red, green and blue gamma ramps for
*
* Params:
* flags: Can be DDSGR_CALIBRATE to request calibration
* gamma_ramp: Structure containing the new gamma ramp
*
* Returns:
* DD_OK on success
* DDERR_INVALIDPARAMS if gamma_ramp is NULL
*
**********************************************************/
static
HRESULT
WINAPI
ddraw_gamma_control_SetGammaRamp
(
IDirectDrawGammaControl
*
iface
,
DWORD
flags
,
DDGAMMARAMP
*
gamma_ramp
)
{
IDirectDrawSurfaceImpl
*
surface
=
surface_from_gamma_control
(
iface
);
TRACE
(
"iface %p, flags %#x, gamma_ramp %p.
\n
"
,
iface
,
flags
,
gamma_ramp
);
if
(
!
gamma_ramp
)
{
WARN
(
"Invalid gamma_ramp passed.
\n
"
);
return
DDERR_INVALIDPARAMS
;
}
EnterCriticalSection
(
&
ddraw_cs
);
if
(
surface
->
surface_desc
.
ddsCaps
.
dwCaps
&
DDSCAPS_PRIMARYSURFACE
)
{
/* Note: DDGAMMARAMP is compatible with WINED3DGAMMARAMP */
IWineD3DDevice_SetGammaRamp
(
surface
->
ddraw
->
wineD3DDevice
,
0
,
flags
,
(
WINED3DGAMMARAMP
*
)
gamma_ramp
);
}
else
{
ERR
(
"Not implemented for non-primary surfaces.
\n
"
);
}
LeaveCriticalSection
(
&
ddraw_cs
);
return
DD_OK
;
}
/*****************************************************************************
* The VTable
*****************************************************************************/
...
...
@@ -2984,3 +3095,12 @@ const IDirectDrawSurface3Vtbl IDirectDrawSurface3_Vtbl =
/* IDirectDrawSurface3 */
ddraw_surface3_SetSurfaceDesc
,
};
const
IDirectDrawGammaControlVtbl
IDirectDrawGammaControl_Vtbl
=
{
ddraw_gamma_control_QueryInterface
,
ddraw_gamma_control_AddRef
,
ddraw_gamma_control_Release
,
ddraw_gamma_control_GetGammaRamp
,
ddraw_gamma_control_SetGammaRamp
,
};
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