Turning transparency off for speed

DLL Edition of the F-IN-BOX
Delphium
Posts: 6
Joined: Sun Sep 03, 2006 12:29 pm

Turning transparency off for speed

Postby Delphium » Sun Sep 03, 2006 12:44 pm

FlashPlayerControl looks great.

Is there a way to turn transparency off?

Since FlashPlayerControl renders the swf twice each frame and then does calculations to get the alpha channel, can this be turned off to get a serious increase in speed?

Delphium
Posts: 6
Joined: Sun Sep 03, 2006 12:29 pm

Postby Delphium » Sun Sep 03, 2006 12:53 pm

FPC_PutWMode(m_hwndFlashPlayerControl, "opaque") does the trick!

When WMode is set to 'opaque', does FlashPlayerConrtrol still render twice per frame and do per pixel calculations? (i.e.: will setting WMode to 'opaque' speed up rendering?)

Softanics
Site Admin
Posts: 1402
Joined: Sat Sep 18, 2004 3:03 am
Location: Russia, St. Petersburg
Contact:

Re: Turning transparency off for speed

Postby Softanics » Mon Sep 04, 2006 6:21 am

Delphium wrote:Is there a way to turn transparency off?

Since FlashPlayerControl renders the swf twice each frame and then does calculations to get the alpha channel, can this be turned off to get a serious increase in speed?


FlashPlayerControl draws twice only when it was created with the style WS_EX_LAYERED. In other cases, it draws each frame only one time.
Best regards, Artem A. Razin,
F-IN-BOX support
Ask your question here: http://www.f-in-box.com/support.html

Delphium
Posts: 6
Joined: Sun Sep 03, 2006 12:29 pm

Postby Delphium » Mon Sep 04, 2006 10:01 am

Thanks for your speedy reply, Artem.

What about in the DirectX sample? I've tried using your previous advice and revmoved FPCS_TRANSPARENT added WS_VISIBLE, like so:


// Create FlashPlayerControl as a hidden child control
// in transparent mode (see style FPCS_TRANSPARENT)
g_hwndFlashPlayerControl =
CreateWindow(WC_FLASH,
NULL,
//WS_CHILD | FPCS_TRANSPARENT,
WS_CHILD | WS_VISIBLE,
0,
0,
DEF_WIDTH,
DEF_HEIGHT,
hWnd,
NULL,
NULL,
NULL);

...but that crashes your DirectX demo.

Is there any other way to turn off transparency (for use like in your DirectX demo) to boost performance?

Softanics
Site Admin
Posts: 1402
Joined: Sat Sep 18, 2004 3:03 am
Location: Russia, St. Petersburg
Contact:

Postby Softanics » Mon Sep 04, 2006 11:46 am

Yes, it crashes if you remove FPCS_TRANSPARENT. See the code:

Code: Select all

      SFPCGetFrameBitmap FPCGetFrameBitmap = { 0 };
      ::SendMessage(g_hwndFlashPlayerControl, FPCM_GET_FRAME_BITMAP, 0, (LPARAM)&FPCGetFrameBitmap);
      HBITMAP hBitmap = FPCGetFrameBitmap.hBitmap;
      {
         BITMAP bmp_info;
         GetObject(hBitmap, sizeof(bmp_info), &bmp_info);

         BYTE* pTextureBits = (BYTE*)rcLockedRect.pBits;
         DWORD* pBitmapBits = (DWORD*)bmp_info.bmBits;


If FPCS_TRANSPARENT is not using, pBitmapBits == NULL.
You can get pixels, using winapi function GetDIBits.
Best regards, Artem A. Razin,

F-IN-BOX support

Ask your question here: http://www.f-in-box.com/support.html

Delphium
Posts: 6
Joined: Sun Sep 03, 2006 12:29 pm

Postby Delphium » Mon Sep 04, 2006 1:46 pm

Softanics wrote:If FPCS_TRANSPARENT is not using, pBitmapBits == NULL.
You can get pixels, using winapi function GetDIBits.

Thanks. That works well - it seems to have a significant performace boost without the transparency (I haven't timed it yet, but on my test the framerate seemed a lot faster).

Since I'm only after the bits (and not a full HBITMAP), should I be calling FPCM_COPY_FRAME_TO_BUFFER instead of FPCM_GET_FRAME_BITMAP?

Softanics
Site Admin
Posts: 1402
Joined: Sat Sep 18, 2004 3:03 am
Location: Russia, St. Petersburg
Contact:

Postby Softanics » Mon Sep 04, 2006 3:19 pm

Use FPCM_GET_FRAME_BITMAP
Best regards, Artem A. Razin,

F-IN-BOX support

Ask your question here: http://www.f-in-box.com/support.html


Return to “DLL Edition”

Who is online

Users browsing this forum: No registered users and 18 guests

cron