* 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
| 803 | * @param newBaseColor Attention: the actual color + 1, because 0 is no new base color. |
| 804 | */ |
| 805 | void 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 |
no test coverage detected