Advertisement Jump to content


This topic is now archived and is closed to further replies.


Stretching a very large bitmap optimizations

This topic is 6885 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I''m using Blt() to stretch a world bitmap in a window, however my program is really sluggish. The world overview bitmap is really big 1000 x 500 pixels. And I allow the user to specify a section of the world bitmap depending upon the zoom level as the source rectangle upon which to Blt() to the surface. Running the profiler, it says that the function to draw it takes about 60% while the MessagePump() takes only about 30%. That''s probably why it''s so slow. Any ideas on how to speed things up? Should I lock down the surface and do the stretching myself or allow DX to do it using Blt()? I didn''t think stretching would take up that much processing power.

Share this post

Link to post
Share on other sites
The Blt() you are doing is probably falling back to software rendering , which is quite slow in DirectX because it is not optimized for specific cases. If you were to split up the landscape into 8 256x256 sections that are tiled together like this:


You would then have a 1024x512 image and it (hopefully) will be able to use the hardware acceleration capabilities of DirectDraw. The reason behind this is that most graphical accelerators do not support manipulations on bitmaps that are not a power of 2 in size.

Your zoom code will be a bit more complex because you would have to do multiple blits using different source rectangles to achieve the same effect, but you should find that the program runs much faster.


Share this post

Link to post
Share on other sites
Premandrake, thanks for the tip!!! I wish the help files for the SDK would document good stuff like this!

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!