MCPcopy Create free account
hub / github.com/OpenXcom/OpenXcom / blitNShade

Method blitNShade

src/Engine/Surface.cpp:805–823  ·  view source on GitHub ↗

* Specific blit function to blit battlescape terrain data in different shades in a fast way. * Notice there is no surface locking here - you have to make sure you lock the surface yourself * at the start of blitting and unlock it when done. * @param surface to blit to * @param x * @param y * @param off * @param half some tiles are blitted only the right half * @param newBaseColor Attention

Source from the content-addressed store, hash-verified

803 * @param newBaseColor Attention: the actual color + 1, because 0 is no new base color.
804 */
805void Surface::blitNShade(Surface *surface, int x, int y, int off, bool half, int newBaseColor)
806{
807 ShaderMove<Uint8> src(this, x, y);
808 if(half)
809 {
810 GraphSubset g = src.getDomain();
811 g.beg_x = g.end_x/2;
812 src.setDomain(g);
813 }
814 if(newBaseColor)
815 {
816 --newBaseColor;
817 newBaseColor <<= 4;
818 ShaderDraw<ColorReplace>(ShaderSurface(surface), src, ShaderScalar(off), ShaderScalar(newBaseColor));
819 }
820 else
821 ShaderDraw<StandartShade>(ShaderSurface(surface), src, ShaderScalar(off));
822
823}
824
825/**
826 * Set the surface to be redrawn

Callers 6

drawTerrainMethod · 0.80
drawMethod · 0.80
drawMethod · 0.80
drawItemsMethod · 0.80
drawMethod · 0.80
XcomResourcePackMethod · 0.80

Calls 3

ShaderSurfaceFunction · 0.85
ShaderScalarFunction · 0.85
setDomainMethod · 0.45

Tested by

no test coverage detected