Double buffer and shader fixes (#273)

* DoubleBufferFixes

* Add NeoBitmapFile Render
This commit is contained in:
Michael Miller
2019-06-12 23:10:42 -07:00
committed by GitHub
parent 0eed256d33
commit 2d3609e15d
12 changed files with 113 additions and 34 deletions
+42 -4
View File
@@ -189,7 +189,9 @@ public:
return color;
};
void Blt(NeoBufferContext<T_COLOR_FEATURE> destBuffer,
template <typename T_SHADER> void Render(NeoBufferContext<T_COLOR_FEATURE> destBuffer,
T_SHADER& shader,
uint16_t indexPixel,
int16_t xSrc,
int16_t ySrc,
@@ -208,6 +210,7 @@ public:
{
if (readPixel(&color))
{
color = shader.Apply(indexPixel, color);
xSrc++;
}
}
@@ -216,8 +219,20 @@ public:
}
}
}
void Blt(NeoBufferContext<T_COLOR_FEATURE> destBuffer,
uint16_t indexPixel,
int16_t xSrc,
int16_t ySrc,
int16_t wSrc)
{
NeoShaderNop<typename T_COLOR_FEATURE::ColorObject> shaderNop;
Render<NeoShaderNop<typename T_COLOR_FEATURE::ColorObject>>(destBuffer, shaderNop, indexPixel, xSrc, ySrc, wSrc);
};
template <typename T_SHADER> void Render(NeoBufferContext<T_COLOR_FEATURE> destBuffer,
T_SHADER& shader,
int16_t xDest,
int16_t yDest,
int16_t xSrc,
@@ -238,15 +253,16 @@ public:
{
for (int16_t x = 0; x < wSrc; x++)
{
uint16_t indexDest = layoutMap(xDest + x, yDest + y);
if ((uint16_t)xFile < _width)
{
if (readPixel(&color))
{
color = shader.Apply(indexDest, color);
xFile++;
}
}
uint16_t indexDest = layoutMap(xDest + x, yDest + y);
if (indexDest < destPixelCount)
{
@@ -257,6 +273,28 @@ public:
}
};
void Blt(NeoBufferContext<T_COLOR_FEATURE> destBuffer,
int16_t xDest,
int16_t yDest,
int16_t xSrc,
int16_t ySrc,
int16_t wSrc,
int16_t hSrc,
LayoutMapCallback layoutMap)
{
NeoShaderNop<typename T_COLOR_FEATURE::ColorObject> shaderNop;
Render<NeoShaderNop<typename T_COLOR_FEATURE::ColorObject>>(destBuffer,
shaderNop,
xDest,
yDest,
xSrc,
ySrc,
wSrc,
hSrc,
layoutMap);
};
private:
T_FILE_METHOD _file;