Skip to content

Commit 0cc25f0

Browse files
author
Owen
authored
Make swpixel pure virtual (#6)
Make swpixel pure virtual
2 parents 5c1c8bf + 3f39164 commit 0cc25f0

File tree

2 files changed

+2
-18
lines changed

2 files changed

+2
-18
lines changed

src/hyperdisplay.cpp

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -238,23 +238,7 @@ hd_pixels_t hyperdisplay::wToPix( wind_info_t* wind, hd_hw_extent_t x0, hd_hw_e
238238
return pixOffst;
239239
}
240240

241-
void hyperdisplay::swpixel( hd_extent_t x0, hd_extent_t y0, color_t data, hd_colors_t colorCycleLength, hd_colors_t startColorOffset)
242-
{
243-
if(data == NULL){ return; }
244-
if(colorCycleLength == 0){ return; }
245-
246-
startColorOffset = getNewColorOffset(colorCycleLength, startColorOffset, 0); // This line is needed to condition the user's input start color offset because it could be greater than the cycle length
247-
color_t value = getOffsetColor(data, startColorOffset);
248-
249-
hd_hw_extent_t x0w = (hd_hw_extent_t)x0; // Cast to hw extent type to be sure of integer values
250-
hd_hw_extent_t y0w = (hd_hw_extent_t)y0;
251-
252-
hd_pixels_t pixOffst = wToPix(pCurrentWindow, x0, y0); // It was already ensured that this will be in range
253-
color_t dest = getOffsetColor(pCurrentWindow->data, pixOffst); // Rely on the user's definition of a pixel's width in memory
254-
uint32_t len = (uint32_t)getOffsetColor(0x00, 1); // Getting the offset from zero for one pixel tells us how many bytes to copy
255-
256-
memcpy((void*)dest, (void*)value, (size_t)len); // Copy data into the window's buffer
257-
}
241+
// void swpixel( hd_extent_t x0, hd_extent_t y0, color_t data, hd_colors_t colorCycleLength, hd_colors_t startColorOffset) = 0;
258242

259243
void hyperdisplay::swxline( hd_extent_t x0, hd_extent_t y0, hd_extent_t len, color_t data, hd_colors_t colorCycleLength, hd_colors_t startColorOffset, bool goLeft)
260244
{

src/hyperdisplay.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ class hyperdisplay : public Print{
144144

145145
// Buffer writing functions - all buffers areread left-to-right and top to bottom. Width and height are specified in the associated window's settings. Coordinates are window coordinates
146146
hd_pixels_t wToPix( wind_info_t* wind, hd_hw_extent_t x0, hd_hw_extent_t y0); // Computes the pixel offset for a window-coordinate pair (multiply by bytes per pixel to get a byte offset)
147-
void swpixel( hd_extent_t x0, hd_extent_t y0, color_t data = NULL, hd_colors_t colorCycleLength = 1, hd_colors_t startColorOffset = 0);
147+
virtual void swpixel( hd_extent_t x0, hd_extent_t y0, color_t data = NULL, hd_colors_t colorCycleLength = 1, hd_colors_t startColorOffset = 0) = 0; // Made pure vitual to force control of buffered memory access to be handled by derived classes
148148
void swxline( hd_extent_t x0, hd_extent_t y0, hd_extent_t len, color_t data = NULL, hd_colors_t colorCycleLength = 1, hd_colors_t startColorOffset = 0, bool goLeft = false);
149149
void swyline( hd_extent_t x0, hd_extent_t y0, hd_extent_t len, color_t data = NULL, hd_colors_t colorCycleLength = 1, hd_colors_t startColorOffset = 0, bool goUp = false);
150150
void swrectangle( hd_extent_t x0, hd_extent_t y0, hd_extent_t x1, hd_extent_t y1, bool filled = false, color_t data = NULL, hd_colors_t colorCycleLength = 1, hd_colors_t startColorOffset = 0, bool reverseGradient = false, bool gradientVertical = false);

0 commit comments

Comments
 (0)