Last active
August 29, 2015 14:06
-
-
Save mlabbe/c0957e39c5af5fa7ed2c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Uint32 mask = 0; | |
switch ( numChannels ) | |
{ | |
case 1: | |
mask = 0xFF000000; | |
break; | |
case 2: | |
mask = 0xFFFF0000; | |
break; | |
case 3: | |
mask = 0xFFFFFF00; | |
break; | |
case 4: | |
mask = 0xFFFFFFFF; | |
break; | |
default: | |
Assert(0); | |
} | |
const Uint32 WRITEVAL = inVal & mask; | |
// sample inner loop random access pixel wmrite | |
Uint32 *px = (Uint32*)(channels + (j * numChannels) + (pt.y * pitch)); | |
*px |= WRITEVAL; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment