Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/windows/native/sun/java2d/d3d/D3DSurfaceData.cpp
32288 views
/*1* Copyright (c) 2007, 2009, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425#include "D3DPipeline.h"26#include <jlong.h>27#include "D3DSurfaceData.h"28#include "D3DPipelineManager.h"29#include "Trace.h"30#include "awt_Toolkit.h"31#include "awt_Window.h"32#include "awt_BitmapUtil.h"33#include "D3DRenderQueue.h"343536// REMIND: move to awt_Component.h37extern "C" HWND AwtComponent_GetHWnd(JNIEnv *env, jlong pData);3839/* This looks weird. but since some AWT headers need to be included,40* we end up with AWT's alloc.h macro definition of ExceptionOccurred.41* The reasons for that re-defintion do not apply to this code, so undef it.42*/43#undef ExceptionOccurred4445/**46* Initializes nativeWidth/Height fields of the SurfaceData object with47* dimensions on the native surface.48*/49void D3DSD_SetNativeDimensions(JNIEnv *env, D3DSDOps *d3dsdo) {50jobject sdObject;51jint width, height;5253RETURN_IF_NULL(sdObject = env->NewLocalRef(d3dsdo->sdOps.sdObject));5455if (d3dsdo->pResource != NULL) {56width = d3dsdo->pResource->GetDesc()->Width;57height = d3dsdo->pResource->GetDesc()->Height;58} else {59width = d3dsdo->width;60height = d3dsdo->height;61}6263JNU_SetFieldByName(env, NULL, sdObject, "nativeWidth", "I", width);64if (!(env->ExceptionOccurred())) {65JNU_SetFieldByName(env, NULL, sdObject, "nativeHeight", "I", height);66}6768env->DeleteLocalRef(sdObject);69}7071void D3DSD_Flush(void *pData)72{73J2dTraceLn(J2D_TRACE_INFO, "D3DSD_Flush");74RETURN_IF_NULL(pData);7576D3DSDOps *d3dsdo = (D3DSDOps*)pData;77if (d3dsdo->pResource != NULL) {78D3DContext *pCtx;79D3DPipelineManager *pMgr;8081d3dsdo->pResource->SetSDOps(NULL);8283if ((pMgr = D3DPipelineManager::GetInstance()) != NULL &&84SUCCEEDED(pMgr->GetD3DContext(d3dsdo->adapter, &pCtx)))85{86if (pCtx->GetResourceManager()) {87pCtx->GetResourceManager()->ReleaseResource(d3dsdo->pResource);88}89}90d3dsdo->pResource = NULL;91}92}9394void95D3DSD_MarkLost(void *pData)96{97D3DSDOps *d3dsdo;98jobject sdObject;99JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);100101J2dTraceLn(J2D_TRACE_INFO, "D3DSD_MarkLost");102103RETURN_IF_NULL(pData);104105d3dsdo = (D3DSDOps*)pData;106RETURN_IF_NULL(sdObject = env->NewLocalRef(d3dsdo->sdOps.sdObject));107108JNU_CallMethodByName(env, NULL, sdObject,109"setSurfaceLost", "(Z)V", JNI_TRUE);110111env->DeleteLocalRef(sdObject);112}113114// ------------ generic SurfaceData.h functions ----------------115116void117D3DSD_Dispose(JNIEnv *env, SurfaceDataOps *ops)118{119D3DSDOps *d3dsdo = (D3DSDOps *)ops;120RETURN_IF_NULL(d3dsdo);121122JNU_CallStaticMethodByName(env, NULL, "sun/java2d/d3d/D3DSurfaceData",123"dispose", "(J)V",124ptr_to_jlong(ops));125}126127/**128* This is the implementation of the general surface LockFunc defined in129* SurfaceData.h.130*/131jint132D3DSD_Lock(JNIEnv *env,133SurfaceDataOps *ops,134SurfaceDataRasInfo *pRasInfo,135jint lockflags)136{137JNU_ThrowInternalError(env, "D3DSD_Lock not implemented!");138return SD_FAILURE;139}140141/**142* This is the implementation of the general GetRasInfoFunc defined in143* SurfaceData.h.144*/145void146D3DSD_GetRasInfo(JNIEnv *env,147SurfaceDataOps *ops,148SurfaceDataRasInfo *pRasInfo)149{150JNU_ThrowInternalError(env, "D3DSD_GetRasInfo not implemented!");151}152153/**154* This is the implementation of the general surface UnlockFunc defined in155* SurfaceData.h.156*/157void158D3DSD_Unlock(JNIEnv *env,159SurfaceDataOps *ops,160SurfaceDataRasInfo *pRasInfo)161{162JNU_ThrowInternalError(env, "D3DSD_Unlock not implemented!");163}164165// ------------ D3DSurfaceData's JNI methods ----------------166167168extern "C" {169170/*171* Class: sun_java2d_d3d_D3DSurfaceData172* Method: initOps173* Signature: (III)V174*/175JNIEXPORT void176JNICALL Java_sun_java2d_d3d_D3DSurfaceData_initOps177(JNIEnv *env, jobject d3dsd, jint gdiScreen, jint width, jint height)178{179D3DPipelineManager *pMgr;180D3DSDOps *d3dsdo = (D3DSDOps *)SurfaceData_InitOps(env, d3dsd,181sizeof(D3DSDOps));182183J2dTraceLn(J2D_TRACE_INFO, "D3DSurfaceData_initOps");184185if (d3dsdo == NULL) {186JNU_ThrowOutOfMemoryError(env, "creating native d3d ops");187return;188}189190d3dsdo->sdOps.Lock = D3DSD_Lock;191d3dsdo->sdOps.GetRasInfo = D3DSD_GetRasInfo;192d3dsdo->sdOps.Unlock = D3DSD_Unlock;193d3dsdo->sdOps.Dispose = D3DSD_Dispose;194195d3dsdo->xoff = 0;196d3dsdo->yoff = 0;197d3dsdo->width = width;198d3dsdo->height = height;199200d3dsdo->pResource = NULL;201202d3dsdo->adapter =203(pMgr = D3DPipelineManager::GetInstance()) == NULL ?204D3DADAPTER_DEFAULT :205pMgr->GetAdapterOrdinalForScreen(gdiScreen);206}207208209/*210* Class: sun_java2d_d3d_D3DSurfaceData211* Method: initTexture212* Signature: (JZZ)Z213*/214JNIEXPORT jboolean215JNICALL Java_sun_java2d_d3d_D3DSurfaceData_initTexture216(JNIEnv *env, jobject d3dsd,217jlong pData, jboolean isRTT, jboolean isOpaque)218{219HRESULT res;220D3DSDOps *d3dsdo;221D3DContext *pCtx;222D3DPipelineManager *pMgr;223D3DFORMAT format;224225J2dTraceLn(J2D_TRACE_INFO, "D3DSurfaceData_initTexture");226227RETURN_STATUS_IF_NULL(d3dsdo = (D3DSDOps *)jlong_to_ptr(pData), JNI_FALSE);228RETURN_STATUS_IF_NULL(pMgr = D3DPipelineManager::GetInstance(), JNI_FALSE);229230if (FAILED(res = pMgr->GetD3DContext(d3dsdo->adapter, &pCtx))) {231D3DRQ_MarkLostIfNeeded(res, d3dsdo);232return JNI_FALSE;233}234RETURN_STATUS_IF_NULL(pCtx->GetResourceManager(), JNI_FALSE);235236pCtx->GetResourceManager()->ReleaseResource(d3dsdo->pResource);237d3dsdo->pResource = NULL;238239if (isRTT && isOpaque) {240format = pCtx->GetPresentationParams()->BackBufferFormat;241} else {242format = D3DFMT_UNKNOWN;243}244245res = pCtx->GetResourceManager()->246CreateTexture(d3dsdo->width, d3dsdo->height,247isRTT, isOpaque,248&format, 0/*usage*/, &d3dsdo->pResource);249if (SUCCEEDED(res)) {250J2dTraceLn1(J2D_TRACE_VERBOSE,251" created texture pResource=%x", d3dsdo->pResource);252d3dsdo->pResource->SetSDOps(d3dsdo);253} else {254D3DRQ_MarkLostIfNeeded(res, d3dsdo);255}256D3DSD_SetNativeDimensions(env, d3dsdo);257258return SUCCEEDED(res);259}260261/*262* Class: sun_java2d_d3d_D3DSurfaceData263* Method: initPlain264* Signature: (JZ)Z265*/266JNIEXPORT jboolean JNICALL267Java_sun_java2d_d3d_D3DSurfaceData_initRTSurface268(JNIEnv *env, jobject d3dsd, jlong pData, jboolean isOpaque)269{270HRESULT res;271D3DSDOps *d3dsdo;272D3DContext *pCtx;273D3DPipelineManager *pMgr;274D3DFORMAT format = D3DFMT_UNKNOWN;275276J2dTraceLn(J2D_TRACE_INFO, "D3DSurfaceData_initRTSurface");277278RETURN_STATUS_IF_NULL(d3dsdo = (D3DSDOps *)jlong_to_ptr(pData), JNI_FALSE);279RETURN_STATUS_IF_NULL(pMgr = D3DPipelineManager::GetInstance(), JNI_FALSE);280281if (FAILED(res = pMgr->GetD3DContext(d3dsdo->adapter, &pCtx))) {282D3DRQ_MarkLostIfNeeded(res, d3dsdo);283return JNI_FALSE;284}285RETURN_STATUS_IF_NULL(pCtx->GetResourceManager(), JNI_FALSE);286287pCtx->GetResourceManager()->ReleaseResource(d3dsdo->pResource);288d3dsdo->pResource = NULL;289290res = pCtx->GetResourceManager()->291CreateRTSurface(d3dsdo->width, d3dsdo->height,292isOpaque, FALSE /*lockable*/,293&format, &d3dsdo->pResource);294if (SUCCEEDED(res)) {295J2dTraceLn1(J2D_TRACE_VERBOSE, " created RT surface pResource=0x%x",296d3dsdo->pResource);297d3dsdo->pResource->SetSDOps(d3dsdo);298} else {299D3DRQ_MarkLostIfNeeded(res, d3dsdo);300}301D3DSD_SetNativeDimensions(env, d3dsdo);302303return SUCCEEDED(res);304}305306/*307* Class: sun_java2d_d3d_D3DSurfaceData308* Method: initFlipBackbuffer309* Signature: (JJIZ)Z310*/311JNIEXPORT jboolean312JNICALL Java_sun_java2d_d3d_D3DSurfaceData_initFlipBackbuffer313(JNIEnv *env, jobject d3dsd, jlong pData, jlong pPeerData,314jint numBuffers, jint swapEffect,315jint vSyncType)316{317HRESULT res;318D3DSDOps *d3dsdo;319D3DContext *pCtx;320D3DPipelineManager *pMgr;321HWND hWnd;322UINT presentationInterval;323AwtComponent *pPeer;324RECT r = { 0, 0, 0, 0 };325326J2dTraceLn(J2D_TRACE_INFO, "D3DSurfaceData_initFlipBackbuffer");327328RETURN_STATUS_IF_NULL(d3dsdo = (D3DSDOps *)jlong_to_ptr(pData), JNI_FALSE);329RETURN_STATUS_IF_NULL(pMgr = D3DPipelineManager::GetInstance(), JNI_FALSE);330RETURN_STATUS_IF_NULL(pPeer = (AwtComponent *)jlong_to_ptr(pPeerData),331JNI_FALSE);332333hWnd = pPeer->GetHWnd();334if (!IsWindow(hWnd)) {335J2dTraceLn(J2D_TRACE_WARNING,336"D3DSurfaceData_initFlipBackbuffer: disposed component");337return JNI_FALSE;338}339340pPeer->GetInsets(&r);341d3dsdo->xoff = -r.left;342d3dsdo->yoff = -r.top;343344if (FAILED(res = pMgr->GetD3DContext(d3dsdo->adapter, &pCtx))) {345D3DRQ_MarkLostIfNeeded(res, d3dsdo);346return JNI_FALSE;347}348RETURN_STATUS_IF_NULL(pCtx->GetResourceManager(), JNI_FALSE);349350pCtx->GetResourceManager()->ReleaseResource(d3dsdo->pResource);351d3dsdo->pResource = NULL;352353d3dsdo->swapEffect = (D3DSWAPEFFECT)swapEffect;354355// in full-screen mode we should v-sync356if (pCtx->GetPresentationParams()->Windowed) {357if (vSyncType == VSYNC_ON) {358presentationInterval = D3DPRESENT_INTERVAL_ONE;359J2dTraceLn(J2D_TRACE_VERBOSE,360" windowed, forced interval: ONE");361} else {362presentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE;363J2dTraceLn(J2D_TRACE_VERBOSE,364" windowed, default interval: IMMEDIATE");365}366367// REMIND: this is a workaround for the current issue368// we have with non-copy flip chains: since we can not specify369// the dest rectangle for Present for these modes, the result of370// Present(NULL, NULL) is scaled to the client area.371if (d3dsdo->xoff != 0 || d3dsdo->yoff != 0) {372d3dsdo->swapEffect = D3DSWAPEFFECT_COPY;373}374} else {375if (vSyncType == VSYNC_OFF) {376presentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE;377J2dTraceLn(J2D_TRACE_VERBOSE,378" full-screen, forced interval: IMMEDIATE");379} else {380presentationInterval = D3DPRESENT_INTERVAL_ONE;381J2dTraceLn(J2D_TRACE_VERBOSE,382" full-screen, default interval: ONE");383}384}385386res = pCtx->GetResourceManager()->387CreateSwapChain(hWnd, numBuffers,388d3dsdo->width, d3dsdo->height,389d3dsdo->swapEffect, presentationInterval,390&d3dsdo->pResource);391if (SUCCEEDED(res)) {392J2dTraceLn1(J2D_TRACE_VERBOSE, " created swap chain pResource=0x%x",393d3dsdo->pResource);394d3dsdo->pResource->SetSDOps(d3dsdo);395} else {396D3DRQ_MarkLostIfNeeded(res, d3dsdo);397}398D3DSD_SetNativeDimensions(env, d3dsdo);399400return SUCCEEDED(res);401}402403/*404* Class: sun_java2d_d3d_D3DSurfaceData405* Method: dbGetPixelNative406* Signature: (JII)I407*/408JNIEXPORT jint JNICALL Java_sun_java2d_d3d_D3DSurfaceData_dbGetPixelNative409(JNIEnv *env, jclass clazz, jlong pData, jint x, jint y)410{411HRESULT res;412D3DSDOps *d3dsdo;413D3DContext *pCtx;414D3DPipelineManager *pMgr;415D3DResource *pLockableRes;416jint pixel = 0;417418J2dTraceLn(J2D_TRACE_INFO, "D3DSurfaceData_dbGetPixelNative");419420RETURN_STATUS_IF_NULL(d3dsdo = (D3DSDOps *)jlong_to_ptr(pData), pixel);421RETURN_STATUS_IF_NULL(d3dsdo->pResource, pixel);422RETURN_STATUS_IF_NULL(pMgr = D3DPipelineManager::GetInstance(), pixel);423424if (FAILED(res = pMgr->GetD3DContext(d3dsdo->adapter, &pCtx))) {425D3DRQ_MarkLostIfNeeded(res, d3dsdo);426return pixel;427}428RETURN_STATUS_IF_NULL(pCtx->GetResourceManager(), 0);429430IDirect3DDevice9 *pd3dDevice = pCtx->Get3DDevice();431IDirect3DSurface9 *pSrc = d3dsdo->pResource->GetSurface();432D3DFORMAT srcFmt = d3dsdo->pResource->GetDesc()->Format;433434pCtx->UpdateState(STATE_OTHEROP);435436res = pCtx->GetResourceManager()->437GetLockableRTSurface(1, 1, srcFmt, &pLockableRes);438if (SUCCEEDED(res)) {439IDirect3DSurface9 *pTmpSurface;440RECT srcRect = { x, y, x+1, y+1};441RECT dstRect = { 0l, 0l, 1, 1 };442443pTmpSurface = pLockableRes->GetSurface();444res = pd3dDevice->StretchRect(pSrc, &srcRect, pTmpSurface, &dstRect,445D3DTEXF_NONE);446if (SUCCEEDED(res)) {447D3DLOCKED_RECT lRect;448449res = pTmpSurface->LockRect(&lRect, &dstRect, D3DLOCK_NOSYSLOCK);450if (SUCCEEDED(res)) {451if (srcFmt == D3DFMT_X8R8G8B8) {452pixel = *(jint*)lRect.pBits;453} else {454pixel = *(unsigned short*)lRect.pBits;455}456pTmpSurface->UnlockRect();457}458}459}460D3DRQ_MarkLostIfNeeded(res, d3dsdo);461462return pixel;463}464465/*466* Class: sun_java2d_d3d_D3DSurfaceData467* Method: dbSetPixelNative468* Signature: (JIII)V469*/470JNIEXPORT void JNICALL Java_sun_java2d_d3d_D3DSurfaceData_dbSetPixelNative471(JNIEnv *env, jclass clazz, jlong pData, jint x, jint y, jint pixel)472{473HRESULT res;474D3DSDOps *d3dsdo;475D3DResource *pLockableRes;476D3DContext *pCtx;477D3DPipelineManager *pMgr;478479J2dTraceLn(J2D_TRACE_INFO, "D3DSurfaceData_dbSetPixelNative");480481RETURN_IF_NULL(d3dsdo = (D3DSDOps *)jlong_to_ptr(pData));482RETURN_IF_NULL(d3dsdo->pResource);483RETURN_IF_NULL(pMgr = D3DPipelineManager::GetInstance());484485if (FAILED(res = pMgr->GetD3DContext(d3dsdo->adapter, &pCtx))) {486D3DRQ_MarkLostIfNeeded(res, d3dsdo);487return;488}489RETURN_IF_NULL(pCtx->GetResourceManager());490491IDirect3DDevice9 *pd3dDevice = pCtx->Get3DDevice();492IDirect3DSurface9 *pSrc = d3dsdo->pResource->GetSurface();493D3DFORMAT srcFmt = d3dsdo->pResource->GetDesc()->Format;494495pCtx->UpdateState(STATE_OTHEROP);496497res = pCtx->GetResourceManager()->498GetLockableRTSurface(1, 1, srcFmt, &pLockableRes);499if (SUCCEEDED(res)) {500IDirect3DSurface9 *pTmpSurface;501D3DLOCKED_RECT lRect;502RECT srcRect = { 0l, 0l, 1, 1 };503RECT dstRect = { x, y, x+1, y+1};504505pTmpSurface = pLockableRes->GetSurface();506res = pTmpSurface->LockRect(&lRect, &srcRect, D3DLOCK_NOSYSLOCK);507if (SUCCEEDED(res)) {508if (srcFmt == D3DFMT_X8R8G8B8) {509*(jint*)lRect.pBits = pixel;510} else {511*(unsigned short*)lRect.pBits = (unsigned short)pixel;512}513pTmpSurface->UnlockRect();514515res = pd3dDevice->StretchRect(pTmpSurface, &srcRect, pSrc, &dstRect,516D3DTEXF_NONE);517}518}519D3DRQ_MarkLostIfNeeded(res, d3dsdo);520}521522/*523* Class: sun_java2d_d3d_D3DSurfaceData524* Method: getNativeResourceNative525* Signature: (JI)J526*/527JNIEXPORT jlong JNICALL528Java_sun_java2d_d3d_D3DSurfaceData_getNativeResourceNative529(JNIEnv *env, jclass d3sdc, jlong pData, jint resType)530{531D3DSDOps *d3dsdo;532533J2dTraceLn(J2D_TRACE_INFO, "D3DSurfaceData_getNativeResourceNative")534535RETURN_STATUS_IF_NULL(d3dsdo = (D3DSDOps *)jlong_to_ptr(pData), 0L);536537if (resType == D3D_DEVICE_RESOURCE) {538HRESULT res;539D3DPipelineManager *pMgr;540D3DContext *pCtx;541542RETURN_STATUS_IF_NULL(pMgr = D3DPipelineManager::GetInstance(), 0L);543if (FAILED(res = pMgr->GetD3DContext(d3dsdo->adapter, &pCtx))) {544D3DRQ_MarkLostIfNeeded(res, d3dsdo);545return 0L;546}547return ptr_to_jlong(pCtx->Get3DDevice());548}549550RETURN_STATUS_IF_NULL(d3dsdo->pResource, 0L);551552if (resType == RT_PLAIN || resType == RT_TEXTURE) {553return ptr_to_jlong(d3dsdo->pResource->GetSurface());554}555if (resType == TEXTURE) {556return ptr_to_jlong(d3dsdo->pResource->GetTexture());557}558if (resType == FLIP_BACKBUFFER) {559return ptr_to_jlong(d3dsdo->pResource->GetSwapChain());560}561562return 0L;563}564565/*566* Class: sun_java2d_d3d_D3DSurfaceData567* Method: updateWindowAccelImpl568* Signature: (JJII)Z569*/570JNIEXPORT jboolean571JNICALL Java_sun_java2d_d3d_D3DSurfaceData_updateWindowAccelImpl572(JNIEnv *env, jclass clazz, jlong pd3dsd, jlong pData, jint w, jint h)573{574HRESULT res;575AwtWindow *window;576HBITMAP hBitmap = NULL;577D3DSDOps *d3dsdo;578D3DResource *pSrcRes;579D3DContext *pCtx;580D3DPipelineManager *pMgr;581D3DResource *pLockableRes = NULL;582IDirect3DSurface9 *pTmpSurface = NULL;583IDirect3DDevice9 *pd3dDevice = NULL;584D3DLOCKED_RECT lockedRect;585586J2dTraceLn(J2D_TRACE_ERROR, "D3DSurfaceData_updateWindowAccelImpl");587588if (w <= 0 || h <= 0) {589return JNI_TRUE;590}591592RETURN_STATUS_IF_NULL(window = (AwtWindow *)jlong_to_ptr(pData), JNI_FALSE);593RETURN_STATUS_IF_NULL(d3dsdo = (D3DSDOps *)jlong_to_ptr(pd3dsd), JNI_FALSE);594RETURN_STATUS_IF_NULL(pMgr = D3DPipelineManager::GetInstance(), JNI_FALSE);595RETURN_STATUS_IF_NULL(pSrcRes = d3dsdo->pResource, JNI_FALSE);596597if (FAILED(res = pMgr->GetD3DContext(d3dsdo->adapter, &pCtx))) {598D3DRQ_MarkLostIfNeeded(res, d3dsdo);599return JNI_FALSE;600}601602RETURN_STATUS_IF_NULL(pd3dDevice = pCtx->Get3DDevice(), JNI_FALSE);603pCtx->UpdateState(STATE_OTHEROP);604605res = pCtx->GetResourceManager()->606GetBlitOSPSurface(pSrcRes->GetDesc()->Width,607pSrcRes->GetDesc()->Height,608pSrcRes->GetDesc()->Format,609&pLockableRes);610if (FAILED(res)) {611D3DRQ_MarkLostIfNeeded(res, d3dsdo);612return JNI_FALSE;613}614pTmpSurface = pLockableRes->GetSurface();615616res = pd3dDevice->GetRenderTargetData(pSrcRes->GetSurface(), pTmpSurface);617if (FAILED(res)) {618D3DRQ_MarkLostIfNeeded(res, d3dsdo);619return JNI_FALSE;620}621622res = pTmpSurface->LockRect(&lockedRect, NULL, D3DLOCK_NOSYSLOCK);623if (SUCCEEDED(res)) {624hBitmap =625BitmapUtil::CreateBitmapFromARGBPre(w, h,626lockedRect.Pitch,627(int*)lockedRect.pBits);628pTmpSurface->UnlockRect();629}630RETURN_STATUS_IF_NULL(hBitmap, JNI_FALSE);631632window->UpdateWindow(env, NULL, w, h, hBitmap);633634// hBitmap is released in UpdateWindow635636return JNI_TRUE;637}638}639640641