From e60078c34fa46c8d6f6cd9577118d8c4c9f4d0ab Mon Sep 17 00:00:00 2001 From: Chien Yang Date: Wed, 11 Oct 2006 23:47:10 +0000 Subject: 1) Fixed an exception in clear background. 2) Clean up unwanted d3d code. git-svn-id: https://svn.java.net/svn/j3d-core~svn/trunk@718 ba19aa83-45c5-6ac9-afd3-db810772062c --- src/native/d3d/Canvas3D.cpp | 26 +---- src/native/d3d/D3dCtx.cpp | 5 +- src/native/d3d/D3dImageComponent.cpp | 171 ------------------------------ src/native/d3d/D3dImageComponent.hpp | 53 --------- src/native/d3d/D3dUtil.cpp | 37 +------ src/native/d3d/D3dUtil.hpp | 4 - src/native/d3d/StdAfx.h | 1 - src/native/d3d/build-windows-amd64-vc.xml | 4 +- src/native/d3d/build-windows-i586-vc.xml | 4 +- 9 files changed, 12 insertions(+), 293 deletions(-) delete mode 100644 src/native/d3d/D3dImageComponent.cpp delete mode 100644 src/native/d3d/D3dImageComponent.hpp (limited to 'src/native') diff --git a/src/native/d3d/Canvas3D.cpp b/src/native/d3d/Canvas3D.cpp index ba9c918..6988d57 100644 --- a/src/native/d3d/Canvas3D.cpp +++ b/src/native/d3d/Canvas3D.cpp @@ -348,7 +348,7 @@ void JNICALL Java_javax_media_j3d_NativePipeline_clear( } extern "C" JNIEXPORT -void JNICALL Java_javax_media_j3d_NativePipeline_textureFill( +void JNICALL Java_javax_media_j3d_NativePipeline_textureFillBackground( JNIEnv *env, jobject obj, jlong ctx, @@ -362,9 +362,9 @@ void JNICALL Java_javax_media_j3d_NativePipeline_textureFill( jfloat mapMaxY) { GetDevice(); - /* printf("Canvas3D.textureFill()\n"); */ - /* TODO : Implement textureFill() */ - printf("[Java3D] D3D : textureFill is not implemented yet.\n"); + /* printf("Canvas3D.textureFillBackground()\n"); */ + /* TODO : Implement textureFillBackground() */ + printf("[Java3D] D3D : textureFillBackground is not implemented yet.\n"); } @@ -1128,24 +1128,6 @@ void JNICALL Java_javax_media_j3d_NativePipeline_cleanupRenderer( freePointerList(); } -extern "C" JNIEXPORT -void JNICALL Java_javax_media_j3d_NativePipeline_freeD3DSurface( - JNIEnv *env, - jobject obj, - jobject image, - jint hashCode) - -{ - /* - lockImage(); - D3dImageComponent::remove(&RasterList, hashCode); - unlockImage(); - lockBackground(); - D3dImageComponent::remove(&BackgroundImageList, hashCode); - unlockBackground(); - */ -} - extern "C" JNIEXPORT void JNICALL Java_javax_media_j3d_NativePipeline_beginScene( diff --git a/src/native/d3d/D3dCtx.cpp b/src/native/d3d/D3dCtx.cpp index 8ad3b2f..f48b24c 100644 --- a/src/native/d3d/D3dCtx.cpp +++ b/src/native/d3d/D3dCtx.cpp @@ -349,10 +349,7 @@ VOID D3dCtx::releaseVB() VOID D3dCtx::release() { - /* - D3dImageComponent::removeAll(&BackgroundImageList); - D3dImageComponent::removeAll(&RasterList); - */ + releaseTexture(); SafeFree(bindTextureId); bindTextureIdLen = 0; diff --git a/src/native/d3d/D3dImageComponent.cpp b/src/native/d3d/D3dImageComponent.cpp deleted file mode 100644 index 6ae5ef1..0000000 --- a/src/native/d3d/D3dImageComponent.cpp +++ /dev/null @@ -1,171 +0,0 @@ -/* - * $RCSfile$ - * - * Copyright (c) 2006 Sun Microsystems, Inc. All rights reserved. - * - * Use is subject to license terms. - * - * $Revision$ - * $Date$ - * $State$ - */ - -#include "StdAfx.h" - -D3dImageComponent::D3dImageComponent() -{ - init(); -} - - -D3dImageComponent::D3dImageComponent(D3dCtx *_ctx, - int _hashCode, - LPDIRECT3DTEXTURE9 _surf) -{ - ctx = _ctx; - hashCode = _hashCode; - surf = _surf; - next = NULL; -} - -D3dImageComponent::~D3dImageComponent() -{ - if ((ctx != NULL) && (surf != NULL)) { - ctx->freeResource(surf); - } -} - -VOID D3dImageComponent::init() -{ - next = NULL; - surf = NULL; - hashCode = 0; - ctx = NULL; -} - -D3dImageComponent* D3dImageComponent::add(D3dImageComponent *list, - D3dCtx *ctx, - int hashCode, - LPDIRECT3DTEXTURE9 surf) -{ - D3dImageComponent *p = list->next; - - D3dImageComponent *ic = new D3dImageComponent(ctx, hashCode, surf); - - if (ic == NULL) { - return NULL; - } - list->next = ic; - ic->next = p; - return ic; -} - -D3dImageComponent* D3dImageComponent::find(D3dImageComponent *list, - D3dCtx *ctx, - int hashCode) -{ - // skip the first dummy node - D3dImageComponent *p = list->next; - while (p != NULL) { - if ((p->ctx == ctx) && - (p->hashCode == hashCode)) { - return p; - } - p = p->next; - } - return NULL; -} - - -VOID D3dImageComponent::remove(D3dImageComponent *list, - D3dCtx *ctx, int hashCode) -{ - // skip the first dummy node - D3dImageComponent *p = list->next; - D3dImageComponent *q = list; - - while (p != NULL) { - if ((p->ctx == ctx) && - (p->hashCode == hashCode)) { - q->next = p->next; - delete p; - break; - } - q = p; - p = p->next; - - } -} - - -VOID D3dImageComponent::remove(D3dImageComponent *list, - int hashCode) -{ - // skip the first dummy node - D3dImageComponent *p = list->next; - D3dImageComponent *q = list; - - while (p != NULL) { - if (p->hashCode == hashCode) { - q->next = p->next; - delete p; - // continue for image in another ctx - p = q->next; - } else { - q = p; - p = p->next; - } - } -} - -VOID D3dImageComponent::remove(D3dImageComponent *list, - D3dCtx *ctx) -{ - // skip the first dummy node - D3dImageComponent *p = list->next; - D3dImageComponent *q = list; - - while (p != NULL) { - if (p->ctx == ctx) { - q->next = p->next; - delete p; - p = q->next; - // continue for other images - } else { - q = p; - p = p->next; - } - } -} - -VOID D3dImageComponent::remove(D3dImageComponent *list, - D3dImageComponent *ic) -{ - // skip the first dummy node - D3dImageComponent *p = list->next; - D3dImageComponent *q = list; - - while (p != NULL) { - if (p == ic) { - q->next = p->next; - delete p; - break; - } - q = p; - p = p->next; - } -} - -VOID D3dImageComponent::removeAll(D3dImageComponent *list) -{ - // skip the first dummy node - D3dImageComponent *q, *p = list->next; - - list->next = NULL; - - while (p != NULL) { - q = p->next; - delete p; - p = q; - } -} diff --git a/src/native/d3d/D3dImageComponent.hpp b/src/native/d3d/D3dImageComponent.hpp deleted file mode 100644 index 8226d30..0000000 --- a/src/native/d3d/D3dImageComponent.hpp +++ /dev/null @@ -1,53 +0,0 @@ -/* - * $RCSfile$ - * - * Copyright (c) 2006 Sun Microsystems, Inc. All rights reserved. - * - * Use is subject to license terms. - * - * $Revision$ - * $Date$ - * $State$ - */ - -#if !defined(D3DIMAGECOMPONENT_H) -#define D3DIMAGECOMPONENT_H - -#include "StdAfx.h" - -class D3dImageComponent { -public: - - LPDIRECT3DTEXTURE9 surf; - D3dCtx *ctx; - int hashCode; - D3dImageComponent *next; - - D3dImageComponent(); - - D3dImageComponent(D3dCtx *ctx, int hashCode, - LPDIRECT3DTEXTURE9 surf); - - ~D3dImageComponent(); - - VOID init(); - - static D3dImageComponent* find(D3dImageComponent *list, - D3dCtx *ctx, int hashCode); - - static D3dImageComponent* add(D3dImageComponent *list, - D3dCtx *ctx, int hashCode, - LPDIRECT3DTEXTURE9 surf); - - static VOID remove(D3dImageComponent *list, D3dCtx *ctx, int hashCode); - static VOID remove(D3dImageComponent *list, D3dCtx *ctx); - static VOID remove(D3dImageComponent *list, int hashCode); - static VOID remove(D3dImageComponent *list, D3dImageComponent *ic); - static VOID removeAll(D3dImageComponent *list); -}; - -/* - extern D3dImageComponent RasterList; - extern D3dImageComponent BackgroundImageList; -*/ -#endif diff --git a/src/native/d3d/D3dUtil.cpp b/src/native/d3d/D3dUtil.cpp index 12ff9d6..8700e65 100644 --- a/src/native/d3d/D3dUtil.cpp +++ b/src/native/d3d/D3dUtil.cpp @@ -13,10 +13,7 @@ #include "StdAfx.h" HANDLE hSema = CreateSemaphore(NULL, 1, 1, "Java3d_Ctx"); -HANDLE imageSema = CreateSemaphore(NULL, 1, 1, - "Java3d_ImageComponent2DLock"); -HANDLE backgroundSema = CreateSemaphore(NULL, 1, 1, - "Java3d_ImageBackgroundLock"); + HANDLE geometrySema = CreateSemaphore(NULL, 1, 1, "Java3d_GeometryArrayLock"); HANDLE surfaceListSema = CreateSemaphore(NULL, 1, 1, "Java3d_SurfaceListLock"); @@ -624,6 +621,8 @@ void getTexWidthHeight(D3dDeviceInfo *deviceInfo, *height = texHeight; } + +/* TODO : Need to modify to handle more format ---- Chien */ D3DFORMAT getTexFormat(jint internalFormat) { switch (internalFormat) { @@ -688,36 +687,6 @@ inline VOID unlockSurfaceList() } } -inline VOID lockBackground() -{ - if (backgroundSema != NULL) { - WaitForSingleObject(backgroundSema, INFINITE); - } -} - -inline VOID unlockBackground() -{ - if (backgroundSema != NULL) { - ReleaseSemaphore(backgroundSema, 1, NULL); - } -} - -inline VOID lockImage() -{ - if (imageSema != NULL) { - WaitForSingleObject(imageSema, INFINITE); - } -} - -inline VOID unlockImage() -{ - if (imageSema != NULL) { - ReleaseSemaphore(imageSema, 1, NULL); - } -} - - - inline VOID lockGeometry() { if (geometrySema != NULL) { diff --git a/src/native/d3d/D3dUtil.hpp b/src/native/d3d/D3dUtil.hpp index c0961a4..7e7ea44 100644 --- a/src/native/d3d/D3dUtil.hpp +++ b/src/native/d3d/D3dUtil.hpp @@ -131,10 +131,6 @@ extern OSVERSIONINFO osvi; // OS info extern D3dCtx* findCtx(HWND hwnd); extern VOID lock(); extern VOID unlock(); -extern VOID lockImage(); -extern VOID unlockImage(); -extern VOID lockBackground(); -extern VOID unlockBackground(); extern VOID lockGeometry(); extern VOID unlockGeometry(); extern VOID lockSurfaceList(); diff --git a/src/native/d3d/StdAfx.h b/src/native/d3d/StdAfx.h index c914ee1..8707d11 100644 --- a/src/native/d3d/StdAfx.h +++ b/src/native/d3d/StdAfx.h @@ -68,6 +68,5 @@ using namespace std ; #include "D3dUtil.hpp" #include "D3dVertexBuffer.hpp" #include "D3dDisplayList.hpp" -#include "D3dImageComponent.hpp" #endif diff --git a/src/native/d3d/build-windows-amd64-vc.xml b/src/native/d3d/build-windows-amd64-vc.xml index 7182711..b1fa917 100644 --- a/src/native/d3d/build-windows-amd64-vc.xml +++ b/src/native/d3d/build-windows-amd64-vc.xml @@ -36,13 +36,13 @@ - + - + diff --git a/src/native/d3d/build-windows-i586-vc.xml b/src/native/d3d/build-windows-i586-vc.xml index f432e0b..78d1a4b 100644 --- a/src/native/d3d/build-windows-i586-vc.xml +++ b/src/native/d3d/build-windows-i586-vc.xml @@ -36,13 +36,13 @@ - + - + -- cgit v1.2.3