Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Performance of ID21RenderTarget::CreateBitmapFromWicBitmap

68 views
Skip to first unread message

docschnipp

unread,
Oct 30, 2009, 6:18:01 PM10/30/09
to
I am porting my cross platform "Graphics" class to Direct2D.
Unfortunately, in opposite to all other render engines out there, bitmaps I
can use to draw them must be created from a factory. The library design
actually has a global pool of bitmaps that can be used, but unfortunately I
don't have a render target during the loading of the bitmaps.

So my question is:
- Is ID21RenderTarget::CreateBitmapFromWicBitmap fast enough so I can keep
the WicBitmaps in the pool (already converted to
GUID_WICPixelFormat32bppPBGRA )
- Should I create a bitmap based 32bppPBGRA Rendertarget and use it to load
the bitmaps?
- Can I easily use such a bitmap created by RenderTarget A and draw them
with RenderTarget B (like a ID2D1DCRenderTarget)?

In GDI+ I can just use GDI+ bitmaps and they are not tight to a GDI+
Graphics object.

Thanks for any input on that issue,

doc

docschnipp

unread,
Nov 1, 2009, 10:19:01 AM11/1/09
to
Hi,

I want to add some more information to my post:

"docschnipp" wrote:

> I am porting my cross platform "Graphics" class to Direct2D.
> Unfortunately, in opposite to all other render engines out there, bitmaps I
> can use to draw them must be created from a factory. The library design
> actually has a global pool of bitmaps that can be used, but unfortunately I
> don't have a render target during the loading of the bitmaps.
>
> So my question is:
> - Is ID21RenderTarget::CreateBitmapFromWicBitmap fast enough so I can keep
> the WicBitmaps in the pool (already converted to
> GUID_WICPixelFormat32bppPBGRA )
> - Should I create a bitmap based 32bppPBGRA Rendertarget and use it to load
> the bitmaps?

I mimiced the demo app behaviour and pool WICBitmaps now. When needed, I
create D2DBitmaps of it, but keep them in a cache associated with my
RenderTarget. The Cache gets cleared, when EndDraw() returns
D2DERR_RECREATE_TARGET or the RenderTarget gets destroyed by any reason.

So, questions:
-Is this the most suitable way for an implementation?
-What will be the typical limit for such an implementation (in terms of
memory used by the D2D-Bitmaps)?

> In GDI+ I can just use GDI+ bitmaps and they are not tight to a GDI+
> Graphics object.

should have read "tied".

I have an additional question:

-Will there be a massive performance hit when I don't cache SolidColorBrush
objects?

Thanks again,
doc

0 new messages