DXGL r257 - Code Review

Jump to navigation Jump to search
Repository:DXGL
Revision:r256‎ | r257 | r258 >
Date:01:37, 5 September 2012
Author:admin
Status:new
Tags:
Comment:
Fix COM initialization.
Fix QueryInterface on IDirectDraw interfaces after a legacy version's reference count drops to zero.
Fix RGB555 color format regression.
Modified paths:
  • /ddraw/glClassFactory.cpp (modified) (history)
  • /ddraw/glDirectDraw.cpp (modified) (history)
  • /ddraw/texture.cpp (modified) (history)

Diff [purge]

Index: ddraw/glClassFactory.cpp
@@ -62,7 +62,7 @@
6363 if(riid == IID_IDirectDraw)
6464 {
6565 glDD7 = new glDirectDraw7;
66 - *ppvObject = new glDirectDraw1(glDD7);
 66+ glDD7->QueryInterface(IID_IDirectDraw,ppvObject);
6767 glDD7->Release();
6868 return S_OK;
6969 }
@@ -69,7 +69,7 @@
7070 if(riid == IID_IDirectDraw2)
7171 {
7272 glDD7 = new glDirectDraw7;
73 - *ppvObject = new glDirectDraw2(glDD7);
 73+ glDD7->QueryInterface(IID_IDirectDraw2,ppvObject);
7474 glDD7->Release();
7575 return S_OK;
7676 }
@@ -76,7 +76,7 @@
7777 if(riid == IID_IDirectDraw4)
7878 {
7979 glDD7 = new glDirectDraw7;
80 - *ppvObject = new glDirectDraw4(glDD7);
 80+ glDD7->QueryInterface(IID_IDirectDraw4,ppvObject);
8181 glDD7->Release();
8282 return S_OK;
8383 }
Index: ddraw/glDirectDraw.cpp
@@ -549,6 +549,9 @@
550550
551551 glDirectDraw7::glDirectDraw7()
552552 {
 553+ glDD1 = NULL;
 554+ glDD2 = NULL;
 555+ glDD4 = NULL;
553556 glD3D7 = NULL;
554557 clippers = NULL;
555558 surfaces = NULL;
@@ -1460,6 +1463,7 @@
14611464 glDirectDraw1::~glDirectDraw1()
14621465 {
14631466 glDD7->Release();
 1467+ glDD7->glDD1 = NULL;
14641468 }
14651469 HRESULT WINAPI glDirectDraw1::QueryInterface(REFIID riid, void** ppvObj)
14661470 {
@@ -1607,6 +1611,7 @@
16081612 glDirectDraw2::~glDirectDraw2()
16091613 {
16101614 glDD7->Release();
 1615+ glDD7->glDD2 = NULL;
16111616 }
16121617 HRESULT WINAPI glDirectDraw2::QueryInterface(REFIID riid, void** ppvObj)
16131618 {
@@ -1765,6 +1770,7 @@
17661771 glDirectDraw4::~glDirectDraw4()
17671772 {
17681773 glDD7->Release();
 1774+ glDD7->glDD4 = NULL;
17691775 }
17701776 HRESULT WINAPI glDirectDraw4::QueryInterface(REFIID riid, void** ppvObj)
17711777 {
Index: ddraw/texture.cpp
@@ -85,7 +85,7 @@
8686 FIXME("Untested texture format RGB332\n");
8787 break;
8888 case 2: // 16-bit RGB555
89 - texture->internalformat = GL_RGB5;
 89+ texture->internalformat = GL_RGB5_A1;
9090 texture->format = GL_BGRA;
9191 texture->type = GL_UNSIGNED_SHORT_1_5_5_5_REV;
9292 break;