branlwyd / bdcpu16

DCPU-16 simulator based on version 1.7 of the DCPU-16 specification. See http://dcpu.com/.
0 stars 0 forks source link

create glyph cache #13

Closed branlwyd closed 11 years ago

branlwyd commented 11 years ago

Create a cache of Images of each glyph, so that drawing the screen is just blitting the appropriate images rather than manually drawing each rectangle.

This will require creating a cache of (glyphCount * foreColors * backColors) = 32768 Images. Alternatively, just create (glyphCount) images and use image transforms to set the colors appropriately.

branlwyd commented 11 years ago

Proper scaling can be done by: 1) Write out screen at 1x scaling to an image's Graphics. 2) Draw that image to the panel's Graphics with proper scaling.

branlwyd commented 11 years ago

Drawing to a backing screen image added in 2a57a090e2dddfbf4f5b4e22cd6cf858e3cbed6f.

Using a mono-colored glyph cache and then coloring at draw time turned out to be slower (by about a factor of 2) than drawing each glyph manually!

32768 images seems like an awfully large cache for something that isn't really a big performance issue anyway.

This didn't pan out. Closing.