11#include " framebuffer.hpp"
22
3- FrameBuffer::FrameBuffer (uint32_t * pixels, float width, float height) : pixels(pixels), width(width), height(height)
3+ FrameBuffer::FrameBuffer (uint32 * pixels, float width, float height) : pixels(pixels), width(width), height(height)
44{
55 numOfPixels = width * height;
66}
77
8- void FrameBuffer::DrawPixel (int x, int y, uint32_t Color)
8+ void FrameBuffer::DrawPixel (int x, int y, uint32 Color)
99{
1010 if (x >= 0 && x < width && y >= 0 && y < height)
1111 {
@@ -14,7 +14,7 @@ void FrameBuffer::DrawPixel(int x, int y, uint32_t Color)
1414 }
1515}
1616
17- void FrameBuffer::DrawLine (int x0, int y0, int x1, int y1, uint32_t Color)
17+ void FrameBuffer::DrawLine (int x0, int y0, int x1, int y1, uint32 Color)
1818{
1919 for (float t = 0 .; t < 1 .; t += .01 ) {
2020 int x = (x1 - x0) * t + x0;
@@ -23,7 +23,7 @@ void FrameBuffer::DrawLine(int x0, int y0, int x1, int y1, uint32_t Color)
2323 }
2424}
2525
26- void FrameBuffer::DrawLineDDA (int x0, int y0, int x1, int y1, uint32_t Color)
26+ void FrameBuffer::DrawLineDDA (int x0, int y0, int x1, int y1, uint32 Color)
2727{
2828 int DeltaX = (x1 - x0);
2929 int DeltaY = (y1 - y0);
@@ -44,7 +44,7 @@ void FrameBuffer::DrawLineDDA(int x0, int y0, int x1, int y1, uint32_t Color)
4444 }
4545}
4646
47- void FrameBuffer::DrawLineBresenham (int x0, int y0, int x1, int y1, uint32_t Color)
47+ void FrameBuffer::DrawLineBresenham (int x0, int y0, int x1, int y1, uint32 Color)
4848{
4949 bool steep = false ;
5050 if (std::abs (x0 - x1) < std::abs (y0 - y1)) {
@@ -77,7 +77,7 @@ void FrameBuffer::DrawLineBresenham(int x0, int y0, int x1, int y1, uint32_t Col
7777 }
7878}
7979
80- void FrameBuffer::DrawRect (int x, int y, int width, int height, uint32_t color)
80+ void FrameBuffer::DrawRect (int x, int y, int width, int height, uint32 color)
8181{
8282 for (int i = 0 ; i < width; i++)
8383 {
@@ -90,14 +90,14 @@ void FrameBuffer::DrawRect(int x, int y, int width, int height, uint32_t color)
9090 }
9191}
9292
93- void FrameBuffer::DrawTriangle (int x0, int y0, int x1, int y1, int x2, int y2, uint32_t Color)
93+ void FrameBuffer::DrawTriangle (int x0, int y0, int x1, int y1, int x2, int y2, uint32 Color)
9494{
9595 DrawLineBresenham (x0, y0, x1, y1, Color);
9696 DrawLineBresenham (x1, y1, x2, y2, Color);
9797 DrawLineBresenham (x2, y2, x0, y0, Color);
9898}
9999
100- void FrameBuffer::DrawFilledTriangle (int x0, int y0, int x1, int y1, int x2, int y2, uint32_t Color)
100+ void FrameBuffer::DrawFilledTriangle (int x0, int y0, int x1, int y1, int x2, int y2, uint32 Color)
101101{
102102 if (y0 > y1)
103103 {
@@ -137,7 +137,7 @@ void FrameBuffer::DrawFilledTriangle(int x0, int y0, int x1, int y1, int x2, int
137137
138138}
139139
140- void FrameBuffer::DrawFlatBottomTriangle (int x0, int y0, int x1, int y1, int x2, int y2, uint32_t Color)
140+ void FrameBuffer::DrawFlatBottomTriangle (int x0, int y0, int x1, int y1, int x2, int y2, uint32 Color)
141141{
142142 float leftLine = (float )(x1 - x0) / (y1 - y0);
143143 float rightLine = (float )(x2 - x0) / (y2 - y0);
@@ -153,7 +153,7 @@ void FrameBuffer::DrawFlatBottomTriangle(int x0, int y0, int x1, int y1, int x2,
153153 }
154154}
155155
156- void FrameBuffer::DrawFlatTopTriangle (int x0, int y0, int x1, int y1, int x2, int y2, uint32_t Color)
156+ void FrameBuffer::DrawFlatTopTriangle (int x0, int y0, int x1, int y1, int x2, int y2, uint32 Color)
157157{
158158 float leftLine = (float )(x2 - x0) / (y2 - y0);
159159 float rightLine = (float )(x2 - x1) / (y2 - y1);
@@ -168,7 +168,7 @@ void FrameBuffer::DrawFlatTopTriangle(int x0, int y0, int x1, int y1, int x2, in
168168 }
169169}
170170
171- void FrameBuffer::ClearFrameBuffer (uint32_t Color)
171+ void FrameBuffer::ClearFrameBuffer (uint32 Color)
172172{
173173 for (int y = 0 ; y < height; y++)
174174 {
0 commit comments