From OpenTTD
Revision as of 21:44, 24 November 2018 by kamnet (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

The blitter's primary task is to draw sprites onto the screen. It has to handle colour remapping and transparency effects. Additional methods are provided to pre-encode the game's sprite data into a format preferred by the blitter.

The following blitters exist in SVN:

  • 32bpp-anim: 32bpp Animation Blitter (palette animation)
  • 32bpp-optimized: 32bpp Optimized Blitter (no palette animation)
  • 32bpp-simple: 32bpp Simple Blitter (no palette animation)
  • 32bpp-sse2: 32bpp SSE2 Blitter (no palette animation)
  • 32bpp-sse4: 32bpp SSE4 Blitter (no palette animation)
  • 32bpp-sse4-anim: SSE4 Blitter (palette animation)
  • 32bpp-ssse3: 32bpp SSSE3 Blitter (no palette animation)
  • 8bpp-optimized: 8bpp Optimized Blitter (compression + all-ZoomLevel cache)
  • 8bpp-simple: 8bpp Simple Blitter (relative slow, but never wrong)
  • null: Null Blitter (does nothing)


uint8 GetScreenDepth()

Get the screen depth this blitter works for. This is either: 8, 16, 24 or 32.

void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom)

Draw an image to the screen, given an amount of params defined above.

void DrawColorMappingRect(void *dst, int width, int height, int pal)

Draw a colortable to the screen. This is: the color of the screen is read and is looked-up in the palette to match a new color, which then is put on the screen again.

Sprite *Encode(SpriteLoader::Sprite *sprite, Blitter::AllocatorProc *allocator)

Convert a sprite from the loader to our own format.

The SpriteLoader calls this method for each real sprite that it loads. This function needs to convert the sprite data from RGBAM format to the blitter's preferred format. For 8bpp blitters, this will usually mean dropping the RGBA data and just using the indexed M part.

const char *GetRenderer()

Get the renderer this class depends on.

Personal tools