diff src/gba/Mode0.cpp @ 1:f9f4f1b99eed

importing src directory
author Robert McIntyre <rlm@mit.edu>
date Sat, 03 Mar 2012 10:31:27 -0600
parents
children
line wrap: on
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/gba/Mode0.cpp	Sat Mar 03 10:31:27 2012 -0600
     1.3 @@ -0,0 +1,633 @@
     1.4 +#include "GBAGfx.h"
     1.5 +#include "GBAGlobals.h"
     1.6 +
     1.7 +void mode0RenderLine()
     1.8 +{
     1.9 +	u16 *palette = (u16 *)paletteRAM;
    1.10 +
    1.11 +	if (DISPCNT & 0x80)
    1.12 +	{
    1.13 +		for (int x = 0; x < 240; x++)
    1.14 +		{
    1.15 +			lineMix[x] = 0x7fff;
    1.16 +		}
    1.17 +		return;
    1.18 +	}
    1.19 +
    1.20 +	if (layerEnable & 0x0100)
    1.21 +	{
    1.22 +		gfxDrawTextScreen(BG0CNT, BG0HOFS, BG0VOFS, line0);
    1.23 +	}
    1.24 +
    1.25 +	if (layerEnable & 0x0200)
    1.26 +	{
    1.27 +		gfxDrawTextScreen(BG1CNT, BG1HOFS, BG1VOFS, line1);
    1.28 +	}
    1.29 +
    1.30 +	if (layerEnable & 0x0400)
    1.31 +	{
    1.32 +		gfxDrawTextScreen(BG2CNT, BG2HOFS, BG2VOFS, line2);
    1.33 +	}
    1.34 +
    1.35 +	if (layerEnable & 0x0800)
    1.36 +	{
    1.37 +		gfxDrawTextScreen(BG3CNT, BG3HOFS, BG3VOFS, line3);
    1.38 +	}
    1.39 +
    1.40 +	gfxDrawSprites(lineOBJ);
    1.41 +
    1.42 +	u32 backdrop = (READ16LE(&palette[0]) | 0x30000000);
    1.43 +
    1.44 +	for (int x = 0; x < 240; x++)
    1.45 +	{
    1.46 +		u32 color = backdrop;
    1.47 +		u8  top   = 0x20;
    1.48 +
    1.49 +		if (line0[x] < color)
    1.50 +		{
    1.51 +			color = line0[x];
    1.52 +			top   = 0x01;
    1.53 +		}
    1.54 +
    1.55 +		if ((u8)(line1[x]>>24) < (u8)(color >> 24))
    1.56 +		{
    1.57 +			color = line1[x];
    1.58 +			top   = 0x02;
    1.59 +		}
    1.60 +
    1.61 +		if ((u8)(line2[x]>>24) < (u8)(color >> 24))
    1.62 +		{
    1.63 +			color = line2[x];
    1.64 +			top   = 0x04;
    1.65 +		}
    1.66 +
    1.67 +		if ((u8)(line3[x]>>24) < (u8)(color >> 24))
    1.68 +		{
    1.69 +			color = line3[x];
    1.70 +			top   = 0x08;
    1.71 +		}
    1.72 +
    1.73 +		if ((u8)(lineOBJ[x]>>24) < (u8)(color >> 24))
    1.74 +		{
    1.75 +			color = lineOBJ[x];
    1.76 +			top   = 0x10;
    1.77 +		}
    1.78 +
    1.79 +		if ((top & 0x10) && (color & 0x00010000))
    1.80 +		{
    1.81 +			// semi-transparent OBJ
    1.82 +			u32 back = backdrop;
    1.83 +			u8  top2 = 0x20;
    1.84 +
    1.85 +			if ((u8)(line0[x]>>24) < (u8)(back >> 24))
    1.86 +			{
    1.87 +				back = line0[x];
    1.88 +				top2 = 0x01;
    1.89 +			}
    1.90 +
    1.91 +			if ((u8)(line1[x]>>24) < (u8)(back >> 24))
    1.92 +			{
    1.93 +				back = line1[x];
    1.94 +				top2 = 0x02;
    1.95 +			}
    1.96 +
    1.97 +			if ((u8)(line2[x]>>24) < (u8)(back >> 24))
    1.98 +			{
    1.99 +				back = line2[x];
   1.100 +				top2 = 0x04;
   1.101 +			}
   1.102 +
   1.103 +			if ((u8)(line3[x]>>24) < (u8)(back >> 24))
   1.104 +			{
   1.105 +				back = line3[x];
   1.106 +				top2 = 0x08;
   1.107 +			}
   1.108 +
   1.109 +			if (top2 & (BLDMOD>>8))
   1.110 +				color = gfxAlphaBlend(color, back,
   1.111 +				                      coeff[COLEV & 0x1F],
   1.112 +				                      coeff[(COLEV >> 8) & 0x1F]);
   1.113 +			else
   1.114 +			{
   1.115 +				switch ((BLDMOD >> 6) & 3)
   1.116 +				{
   1.117 +				case 2:
   1.118 +					if (BLDMOD & top)
   1.119 +						color = gfxIncreaseBrightness(color, coeff[COLY & 0x1F]);
   1.120 +					break;
   1.121 +				case 3:
   1.122 +					if (BLDMOD & top)
   1.123 +						color = gfxDecreaseBrightness(color, coeff[COLY & 0x1F]);
   1.124 +					break;
   1.125 +				}
   1.126 +			}
   1.127 +		}
   1.128 +
   1.129 +		lineMix[x] = color;
   1.130 +	}
   1.131 +}
   1.132 +
   1.133 +void mode0RenderLineNoWindow()
   1.134 +{
   1.135 +	u16 *palette = (u16 *)paletteRAM;
   1.136 +
   1.137 +	if (DISPCNT & 0x80)
   1.138 +	{
   1.139 +		for (int x = 0; x < 240; x++)
   1.140 +		{
   1.141 +			lineMix[x] = 0x7fff;
   1.142 +		}
   1.143 +		return;
   1.144 +	}
   1.145 +
   1.146 +	if (layerEnable & 0x0100)
   1.147 +	{
   1.148 +		gfxDrawTextScreen(BG0CNT, BG0HOFS, BG0VOFS, line0);
   1.149 +	}
   1.150 +
   1.151 +	if (layerEnable & 0x0200)
   1.152 +	{
   1.153 +		gfxDrawTextScreen(BG1CNT, BG1HOFS, BG1VOFS, line1);
   1.154 +	}
   1.155 +
   1.156 +	if (layerEnable & 0x0400)
   1.157 +	{
   1.158 +		gfxDrawTextScreen(BG2CNT, BG2HOFS, BG2VOFS, line2);
   1.159 +	}
   1.160 +
   1.161 +	if (layerEnable & 0x0800)
   1.162 +	{
   1.163 +		gfxDrawTextScreen(BG3CNT, BG3HOFS, BG3VOFS, line3);
   1.164 +	}
   1.165 +
   1.166 +	gfxDrawSprites(lineOBJ);
   1.167 +
   1.168 +	u32 backdrop = (READ16LE(&palette[0]) | 0x30000000);
   1.169 +
   1.170 +	int effect = (BLDMOD >> 6) & 3;
   1.171 +
   1.172 +	for (int x = 0; x < 240; x++)
   1.173 +	{
   1.174 +		u32 color = backdrop;
   1.175 +		u8  top   = 0x20;
   1.176 +
   1.177 +		if (line0[x] < color)
   1.178 +		{
   1.179 +			color = line0[x];
   1.180 +			top   = 0x01;
   1.181 +		}
   1.182 +
   1.183 +		if (line1[x] < (color & 0xFF000000))
   1.184 +		{
   1.185 +			color = line1[x];
   1.186 +			top   = 0x02;
   1.187 +		}
   1.188 +
   1.189 +		if (line2[x] < (color & 0xFF000000))
   1.190 +		{
   1.191 +			color = line2[x];
   1.192 +			top   = 0x04;
   1.193 +		}
   1.194 +
   1.195 +		if (line3[x] < (color & 0xFF000000))
   1.196 +		{
   1.197 +			color = line3[x];
   1.198 +			top   = 0x08;
   1.199 +		}
   1.200 +
   1.201 +		if (lineOBJ[x] < (color & 0xFF000000))
   1.202 +		{
   1.203 +			color = lineOBJ[x];
   1.204 +			top   = 0x10;
   1.205 +		}
   1.206 +
   1.207 +		if (!(color & 0x00010000))
   1.208 +		{
   1.209 +			switch (effect)
   1.210 +			{
   1.211 +			case 0:
   1.212 +				break;
   1.213 +			case 1:
   1.214 +			{
   1.215 +				if (top & BLDMOD)
   1.216 +				{
   1.217 +					u32 back = backdrop;
   1.218 +					u8  top2 = 0x20;
   1.219 +					if (line0[x] < back)
   1.220 +					{
   1.221 +						if (top != 0x01)
   1.222 +						{
   1.223 +							back = line0[x];
   1.224 +							top2 = 0x01;
   1.225 +						}
   1.226 +					}
   1.227 +
   1.228 +					if (line1[x] < (back & 0xFF000000))
   1.229 +					{
   1.230 +						if (top != 0x02)
   1.231 +						{
   1.232 +							back = line1[x];
   1.233 +							top2 = 0x02;
   1.234 +						}
   1.235 +					}
   1.236 +
   1.237 +					if (line2[x] < (back & 0xFF000000))
   1.238 +					{
   1.239 +						if (top != 0x04)
   1.240 +						{
   1.241 +							back = line2[x];
   1.242 +							top2 = 0x04;
   1.243 +						}
   1.244 +					}
   1.245 +
   1.246 +					if (line3[x] < (back & 0xFF000000))
   1.247 +					{
   1.248 +						if (top != 0x08)
   1.249 +						{
   1.250 +							back = line3[x];
   1.251 +							top2 = 0x08;
   1.252 +						}
   1.253 +					}
   1.254 +
   1.255 +					if (lineOBJ[x] < (back & 0xFF000000))
   1.256 +					{
   1.257 +						if (top != 0x10)
   1.258 +						{
   1.259 +							back = lineOBJ[x];
   1.260 +							top2 = 0x10;
   1.261 +						}
   1.262 +					}
   1.263 +
   1.264 +					if (top2 & (BLDMOD>>8))
   1.265 +						color = gfxAlphaBlend(color, back,
   1.266 +						                      coeff[COLEV & 0x1F],
   1.267 +						                      coeff[(COLEV >> 8) & 0x1F]);
   1.268 +				}
   1.269 +				break;
   1.270 +			}
   1.271 +			case 2:
   1.272 +				if (BLDMOD & top)
   1.273 +					color = gfxIncreaseBrightness(color, coeff[COLY & 0x1F]);
   1.274 +				break;
   1.275 +			case 3:
   1.276 +				if (BLDMOD & top)
   1.277 +					color = gfxDecreaseBrightness(color, coeff[COLY & 0x1F]);
   1.278 +				break;
   1.279 +			}
   1.280 +		}
   1.281 +		else
   1.282 +		{
   1.283 +			// semi-transparent OBJ
   1.284 +			u32 back = backdrop;
   1.285 +			u8  top2 = 0x20;
   1.286 +
   1.287 +			if (line0[x] < back)
   1.288 +			{
   1.289 +				back = line0[x];
   1.290 +				top2 = 0x01;
   1.291 +			}
   1.292 +
   1.293 +			if (line1[x] < (back & 0xFF000000))
   1.294 +			{
   1.295 +				back = line1[x];
   1.296 +				top2 = 0x02;
   1.297 +			}
   1.298 +
   1.299 +			if (line2[x] < (back & 0xFF000000))
   1.300 +			{
   1.301 +				back = line2[x];
   1.302 +				top2 = 0x04;
   1.303 +			}
   1.304 +
   1.305 +			if (line3[x] < (back & 0xFF000000))
   1.306 +			{
   1.307 +				back = line3[x];
   1.308 +				top2 = 0x08;
   1.309 +			}
   1.310 +
   1.311 +			if (top2 & (BLDMOD>>8))
   1.312 +				color = gfxAlphaBlend(color, back,
   1.313 +				                      coeff[COLEV & 0x1F],
   1.314 +				                      coeff[(COLEV >> 8) & 0x1F]);
   1.315 +			else
   1.316 +			{
   1.317 +				switch ((BLDMOD >> 6) & 3)
   1.318 +				{
   1.319 +				case 2:
   1.320 +					if (BLDMOD & top)
   1.321 +						color = gfxIncreaseBrightness(color, coeff[COLY & 0x1F]);
   1.322 +					break;
   1.323 +				case 3:
   1.324 +					if (BLDMOD & top)
   1.325 +						color = gfxDecreaseBrightness(color, coeff[COLY & 0x1F]);
   1.326 +					break;
   1.327 +				}
   1.328 +			}
   1.329 +		}
   1.330 +
   1.331 +		lineMix[x] = color;
   1.332 +	}
   1.333 +}
   1.334 +
   1.335 +void mode0RenderLineAll()
   1.336 +{
   1.337 +	u16 *palette = (u16 *)paletteRAM;
   1.338 +
   1.339 +	if (DISPCNT & 0x80)
   1.340 +	{
   1.341 +		for (int x = 0; x < 240; x++)
   1.342 +		{
   1.343 +			lineMix[x] = 0x7fff;
   1.344 +		}
   1.345 +		return;
   1.346 +	}
   1.347 +
   1.348 +	bool inWindow0 = false;
   1.349 +	bool inWindow1 = false;
   1.350 +
   1.351 +	if (layerEnable & 0x2000)
   1.352 +	{
   1.353 +		u8 v0 = WIN0V >> 8;
   1.354 +		u8 v1 = WIN0V & 255;
   1.355 +		inWindow0 = ((v0 == v1) && (v0 >= 0xe8));
   1.356 +		if (v1 >= v0)
   1.357 +			inWindow0 |= (VCOUNT >= v0 && VCOUNT < v1);
   1.358 +		else
   1.359 +			inWindow0 |= (VCOUNT >= v0 || VCOUNT < v1);
   1.360 +	}
   1.361 +	if (layerEnable & 0x4000)
   1.362 +	{
   1.363 +		u8 v0 = WIN1V >> 8;
   1.364 +		u8 v1 = WIN1V & 255;
   1.365 +		inWindow1 = ((v0 == v1) && (v0 >= 0xe8));
   1.366 +		if (v1 >= v0)
   1.367 +			inWindow1 |= (VCOUNT >= v0 && VCOUNT < v1);
   1.368 +		else
   1.369 +			inWindow1 |= (VCOUNT >= v0 || VCOUNT < v1);
   1.370 +	}
   1.371 +
   1.372 +	if ((layerEnable & 0x0100))
   1.373 +	{
   1.374 +		gfxDrawTextScreen(BG0CNT, BG0HOFS, BG0VOFS, line0);
   1.375 +	}
   1.376 +
   1.377 +	if ((layerEnable & 0x0200))
   1.378 +	{
   1.379 +		gfxDrawTextScreen(BG1CNT, BG1HOFS, BG1VOFS, line1);
   1.380 +	}
   1.381 +
   1.382 +	if ((layerEnable & 0x0400))
   1.383 +	{
   1.384 +		gfxDrawTextScreen(BG2CNT, BG2HOFS, BG2VOFS, line2);
   1.385 +	}
   1.386 +
   1.387 +	if ((layerEnable & 0x0800))
   1.388 +	{
   1.389 +		gfxDrawTextScreen(BG3CNT, BG3HOFS, BG3VOFS, line3);
   1.390 +	}
   1.391 +
   1.392 +	gfxDrawSprites(lineOBJ);
   1.393 +	gfxDrawOBJWin(lineOBJWin);
   1.394 +
   1.395 +	u32 backdrop = (READ16LE(&palette[0]) | 0x30000000);
   1.396 +
   1.397 +	u8 inWin0Mask = WININ & 0xFF;
   1.398 +	u8 inWin1Mask = WININ >> 8;
   1.399 +	u8 outMask    = WINOUT & 0xFF;
   1.400 +
   1.401 +	for (int x = 0; x < 240; x++)
   1.402 +	{
   1.403 +		u32 color = backdrop;
   1.404 +		u8  top   = 0x20;
   1.405 +		u8  mask  = outMask;
   1.406 +
   1.407 +		if (!(lineOBJWin[x] & 0x80000000))
   1.408 +		{
   1.409 +			mask = WINOUT >> 8;
   1.410 +		}
   1.411 +
   1.412 +		if (inWindow1)
   1.413 +		{
   1.414 +			if (gfxInWin1[x])
   1.415 +				mask = inWin1Mask;
   1.416 +		}
   1.417 +
   1.418 +		if (inWindow0)
   1.419 +		{
   1.420 +			if (gfxInWin0[x])
   1.421 +			{
   1.422 +				mask = inWin0Mask;
   1.423 +			}
   1.424 +		}
   1.425 +
   1.426 +		if ((mask & 1) && (line0[x] < color))
   1.427 +		{
   1.428 +			color = line0[x];
   1.429 +			top   = 0x01;
   1.430 +		}
   1.431 +
   1.432 +		if ((mask & 2) && ((u8)(line1[x]>>24) < (u8)(color >> 24)))
   1.433 +		{
   1.434 +			color = line1[x];
   1.435 +			top   = 0x02;
   1.436 +		}
   1.437 +
   1.438 +		if ((mask & 4) && ((u8)(line2[x]>>24) < (u8)(color >> 24)))
   1.439 +		{
   1.440 +			color = line2[x];
   1.441 +			top   = 0x04;
   1.442 +		}
   1.443 +
   1.444 +		if ((mask & 8) && ((u8)(line3[x]>>24) < (u8)(color >> 24)))
   1.445 +		{
   1.446 +			color = line3[x];
   1.447 +			top   = 0x08;
   1.448 +		}
   1.449 +
   1.450 +		if ((mask & 16) && ((u8)(lineOBJ[x]>>24) < (u8)(color >> 24)))
   1.451 +		{
   1.452 +			color = lineOBJ[x];
   1.453 +			top   = 0x10;
   1.454 +		}
   1.455 +
   1.456 +		// special FX on in the window
   1.457 +		if (mask & 32)
   1.458 +		{
   1.459 +			if (!(color & 0x00010000))
   1.460 +			{
   1.461 +				switch ((BLDMOD >> 6) & 3)
   1.462 +				{
   1.463 +				case 0:
   1.464 +					break;
   1.465 +				case 1:
   1.466 +				{
   1.467 +					if (top & BLDMOD)
   1.468 +					{
   1.469 +						u32 back = backdrop;
   1.470 +						u8  top2 = 0x20;
   1.471 +						if ((mask & 1) && (u8)(line0[x]>>24) < (u8)(back >> 24))
   1.472 +						{
   1.473 +							if (top != 0x01)
   1.474 +							{
   1.475 +								back = line0[x];
   1.476 +								top2 = 0x01;
   1.477 +							}
   1.478 +						}
   1.479 +
   1.480 +						if ((mask & 2) && (u8)(line1[x]>>24) < (u8)(back >> 24))
   1.481 +						{
   1.482 +							if (top != 0x02)
   1.483 +							{
   1.484 +								back = line1[x];
   1.485 +								top2 = 0x02;
   1.486 +							}
   1.487 +						}
   1.488 +
   1.489 +						if ((mask & 4) && (u8)(line2[x]>>24) < (u8)(back >> 24))
   1.490 +						{
   1.491 +							if (top != 0x04)
   1.492 +							{
   1.493 +								back = line2[x];
   1.494 +								top2 = 0x04;
   1.495 +							}
   1.496 +						}
   1.497 +
   1.498 +						if ((mask & 8) && (u8)(line3[x]>>24) < (u8)(back >> 24))
   1.499 +						{
   1.500 +							if (top != 0x08)
   1.501 +							{
   1.502 +								back = line3[x];
   1.503 +								top2 = 0x08;
   1.504 +							}
   1.505 +						}
   1.506 +
   1.507 +						if ((mask & 16) && (u8)(lineOBJ[x]>>24) < (u8)(back >> 24))
   1.508 +						{
   1.509 +							if (top != 0x10)
   1.510 +							{
   1.511 +								back = lineOBJ[x];
   1.512 +								top2 = 0x10;
   1.513 +							}
   1.514 +						}
   1.515 +
   1.516 +						if (top2 & (BLDMOD>>8))
   1.517 +							color = gfxAlphaBlend(color, back,
   1.518 +							                      coeff[COLEV & 0x1F],
   1.519 +							                      coeff[(COLEV >> 8) & 0x1F]);
   1.520 +					}
   1.521 +					break;
   1.522 +				}
   1.523 +				case 2:
   1.524 +					if (BLDMOD & top)
   1.525 +						color = gfxIncreaseBrightness(color, coeff[COLY & 0x1F]);
   1.526 +					break;
   1.527 +				case 3:
   1.528 +					if (BLDMOD & top)
   1.529 +						color = gfxDecreaseBrightness(color, coeff[COLY & 0x1F]);
   1.530 +					break;
   1.531 +				}
   1.532 +			}
   1.533 +			else
   1.534 +			{
   1.535 +				// semi-transparent OBJ
   1.536 +				u32 back = backdrop;
   1.537 +				u8  top2 = 0x20;
   1.538 +
   1.539 +				if ((mask & 1) && ((u8)(line0[x]>>24) < (u8)(back >> 24)))
   1.540 +				{
   1.541 +					back = line0[x];
   1.542 +					top2 = 0x01;
   1.543 +				}
   1.544 +
   1.545 +				if ((mask & 2) && ((u8)(line1[x]>>24) < (u8)(back >> 24)))
   1.546 +				{
   1.547 +					back = line1[x];
   1.548 +					top2 = 0x02;
   1.549 +				}
   1.550 +
   1.551 +				if ((mask & 4) && ((u8)(line2[x]>>24) < (u8)(back >> 24)))
   1.552 +				{
   1.553 +					back = line2[x];
   1.554 +					top2 = 0x04;
   1.555 +				}
   1.556 +
   1.557 +				if ((mask & 8) && ((u8)(line3[x]>>24) < (u8)(back >> 24)))
   1.558 +				{
   1.559 +					back = line3[x];
   1.560 +					top2 = 0x08;
   1.561 +				}
   1.562 +
   1.563 +				if (top2 & (BLDMOD>>8))
   1.564 +					color = gfxAlphaBlend(color, back,
   1.565 +					                      coeff[COLEV & 0x1F],
   1.566 +					                      coeff[(COLEV >> 8) & 0x1F]);
   1.567 +				else
   1.568 +				{
   1.569 +					switch ((BLDMOD >> 6) & 3)
   1.570 +					{
   1.571 +					case 2:
   1.572 +						if (BLDMOD & top)
   1.573 +							color = gfxIncreaseBrightness(color, coeff[COLY & 0x1F]);
   1.574 +						break;
   1.575 +					case 3:
   1.576 +						if (BLDMOD & top)
   1.577 +							color = gfxDecreaseBrightness(color, coeff[COLY & 0x1F]);
   1.578 +						break;
   1.579 +					}
   1.580 +				}
   1.581 +			}
   1.582 +		}
   1.583 +		else if (color & 0x00010000)
   1.584 +		{
   1.585 +			// semi-transparent OBJ
   1.586 +			u32 back = backdrop;
   1.587 +			u8  top2 = 0x20;
   1.588 +
   1.589 +			if ((mask & 1) && ((u8)(line0[x]>>24) < (u8)(back >> 24)))
   1.590 +			{
   1.591 +				back = line0[x];
   1.592 +				top2 = 0x01;
   1.593 +			}
   1.594 +
   1.595 +			if ((mask & 2) && ((u8)(line1[x]>>24) < (u8)(back >> 24)))
   1.596 +			{
   1.597 +				back = line1[x];
   1.598 +				top2 = 0x02;
   1.599 +			}
   1.600 +
   1.601 +			if ((mask & 4) && ((u8)(line2[x]>>24) < (u8)(back >> 24)))
   1.602 +			{
   1.603 +				back = line2[x];
   1.604 +				top2 = 0x04;
   1.605 +			}
   1.606 +
   1.607 +			if ((mask & 8) && ((u8)(line3[x]>>24) < (u8)(back >> 24)))
   1.608 +			{
   1.609 +				back = line3[x];
   1.610 +				top2 = 0x08;
   1.611 +			}
   1.612 +
   1.613 +			if (top2 & (BLDMOD>>8))
   1.614 +				color = gfxAlphaBlend(color, back,
   1.615 +				                      coeff[COLEV & 0x1F],
   1.616 +				                      coeff[(COLEV >> 8) & 0x1F]);
   1.617 +			else
   1.618 +			{
   1.619 +				switch ((BLDMOD >> 6) & 3)
   1.620 +				{
   1.621 +				case 2:
   1.622 +					if (BLDMOD & top)
   1.623 +						color = gfxIncreaseBrightness(color, coeff[COLY & 0x1F]);
   1.624 +					break;
   1.625 +				case 3:
   1.626 +					if (BLDMOD & top)
   1.627 +						color = gfxDecreaseBrightness(color, coeff[COLY & 0x1F]);
   1.628 +					break;
   1.629 +				}
   1.630 +			}
   1.631 +		}
   1.632 +
   1.633 +		lineMix[x] = color;
   1.634 +	}
   1.635 +}
   1.636 +