TINYGL: Avoid unneeded calls in writePixel.

This commit is contained in:
Vincent Pelletier
2017-04-26 13:11:00 +00:00
parent f8ef0b2261
commit 5ab94de318
+3 -3
View File
@@ -191,15 +191,15 @@ struct FrameBuffer {
template <bool kEnableAlphaTest, bool kBlendingEnabled, bool kDepthWrite>
FORCEINLINE void writePixel(int pixel, int value, unsigned int z) {
byte rSrc, gSrc, bSrc, aSrc;
this->pbuf.getFormat().colorToARGB(value, aSrc, rSrc, gSrc, bSrc);
if (kBlendingEnabled == false) {
this->pbuf.setPixelAt(pixel, value);
if (kDepthWrite) {
_zbuf[pixel] = z;
}
} else {
byte rSrc, gSrc, bSrc, aSrc;
this->pbuf.getFormat().colorToARGB(value, aSrc, rSrc, gSrc, bSrc);
writePixel<kEnableAlphaTest, kBlendingEnabled, kDepthWrite>(pixel, aSrc, rSrc, gSrc, bSrc, z);
}
}