DXGL r255 - Code Review
For
DXGL
(
recent comments
|
status changes
|
tags
|
authors
|
states
|
release notes
|
statistics
)
Jump to navigation
Jump to search
Repository:
DXGL
Revision:
<
r254
|
r255
|
r256
>
Date:
23:16, 3 September 2012
Author:
admin
Status:
new
Tags:
Comment:
Cache legacy DDraw interfaces.
Add reference when adding texture to D3D interface.
Modified paths:
/ddraw/glDirectDraw.cpp
(modified) (
history
)
/ddraw/glDirectDraw.h
(modified) (
history
)
/ddraw/glDirectDrawSurface.cpp
(modified) (
history
)
Diff
[
purge
]
Index: ddraw/glDirectDraw.cpp
—
—
@@ -610,26 +610,54 @@
611
611
}
612
612
if(riid == IID_IDirectDraw)
613
613
{
614
- // Create an IDirectDraw1 interface
615
- this->AddRef();
616
- *ppvObj = new glDirectDraw1(this);
617
- this->Release();
618
- return DD_OK;
614
+ if(glDD1)
615
+ {
616
+ *ppvObj = glDD1;
617
+ glDD1->AddRef();
618
+ return DD_OK;
619
+ }
620
+ else
621
+ {
622
+ // Create an IDirectDraw1 interface
623
+ this->AddRef();
624
+ *ppvObj = new glDirectDraw1(this);
625
+ glDD1 = (glDirectDraw1*)*ppvObj;
626
+ return DD_OK;
627
+ }
619
628
}
620
629
if(riid == IID_IDirectDraw2)
621
630
{
622
- // Create an IDirectDraw2 interface
623
- this->AddRef();
624
- *ppvObj = new glDirectDraw2(this);
625
- this->Release();
626
- return DD_OK;
631
+ if(glDD2)
632
+ {
633
+ *ppvObj = glDD2;
634
+ glDD2->AddRef();
635
+ return DD_OK;
636
+ }
637
+ else
638
+ {
639
+ // Create an IDirectDraw2 interface
640
+ this->AddRef();
641
+ *ppvObj = new glDirectDraw2(this);
642
+ glDD2 = (glDirectDraw2*)*ppvObj;
643
+ return DD_OK;
644
+ }
627
645
}
628
646
if(riid == IID_IDirectDraw4)
629
647
{
630
- // Create an IDirectDraw4 interface
631
- this->AddRef();
632
- *ppvObj = new glDirectDraw4(this);
633
- return DD_OK;
648
+ if(glDD4)
649
+ {
650
+ *ppvObj = glDD4;
651
+ glDD4->AddRef();
652
+ return DD_OK;
653
+ }
654
+ else
655
+ {
656
+ // Create an IDirectDraw4 interface
657
+ this->AddRef();
658
+ *ppvObj = new glDirectDraw4(this);
659
+ glDD4 = (glDirectDraw4*)*ppvObj;
660
+ return DD_OK;
661
+ }
634
662
}
635
663
if(riid == IID_IDirectDraw7)
636
664
{
—
—
@@ -963,6 +991,9 @@
964
992
if(initialized) return DDERR_ALREADYINITIALIZED;
965
993
primarylost = true;
966
994
glD3D7 = NULL;
995
+ glDD1 = NULL;
996
+ glDD2 = NULL;
997
+ glDD4 = NULL;
967
998
renderer = NULL;
968
999
primary = NULL;
969
1000
fullscreen = false;
—
—
@@ -1424,7 +1455,6 @@
1425
1456
glDirectDraw1::glDirectDraw1(glDirectDraw7 *gl_DD7)
1426
1457
{
1427
1458
glDD7 = gl_DD7;
1428
- glDD7->AddRef();
1429
1459
refcount = 1;
1430
1460
}
1431
1461
glDirectDraw1::~glDirectDraw1()
—
—
@@ -1572,7 +1602,6 @@
1573
1603
glDirectDraw2::glDirectDraw2(glDirectDraw7 *gl_DD7)
1574
1604
{
1575
1605
glDD7 = gl_DD7;
1576
- glDD7->AddRef();
1577
1606
refcount = 1;
1578
1607
}
1579
1608
glDirectDraw2::~glDirectDraw2()
Index: ddraw/glDirectDraw.h
—
—
@@ -24,6 +24,9 @@
25
25
class glDirect3D7;
26
26
class glRenderer;
27
27
28
+class glDirectDraw1;
29
+class glDirectDraw2;
30
+class glDirectDraw4;
28
31
class glDirectDraw7 : public IDirectDraw7
29
32
{
30
33
public:
—
—
@@ -81,6 +84,9 @@
82
85
void DeleteClipper(glDirectDrawClipper *clipper);
83
86
glDirectDrawSurface7 *primary;
84
87
bool primarylost;
88
+ glDirectDraw1 *glDD1;
89
+ glDirectDraw2 *glDD2;
90
+ glDirectDraw4 *glDD4;
85
91
private:
86
92
HRESULT error;
87
93
ULONG refcount;
Index: ddraw/glDirectDrawSurface.cpp
—
—
@@ -1168,6 +1168,7 @@
1169
1169
}
1170
1170
device = glD3DDev7;
1171
1171
handle = device->AddTexture(this);
1172
+ device->AddRef();
1172
1173
*lpHandle = handle;
1173
1174
return D3D_OK;
1174
1175
}
Navigation menu
Personal tools
Log in
Namespaces
Special page
English
expanded
collapsed
Views
More
expanded
collapsed
Search
Navigation
Home
Main page
Recent changes
Random page
MediaWiki help
Introduction
Progress
Downloads
Source code
Build from source
AppDB
Bug reports
Forums
Tools
Special pages
Printable version