clean up warnings
This commit is contained in:
@@ -368,7 +368,7 @@ void DrawPoint(sCanvas* canvas, int x, int y, u8 col)
|
||||
case CANVAS_8:
|
||||
canvas->img[x + y*canvas->wb] = col;
|
||||
break;
|
||||
|
||||
|
||||
// 4-bit pixels
|
||||
case CANVAS_4:
|
||||
{
|
||||
@@ -1151,9 +1151,9 @@ void DrawImg(sCanvas* canvas, sCanvas* src, int xd, int yd, int xs, int ys, int
|
||||
u8* s = src->img + xs/4 + ys*wbs;
|
||||
u8* d0;
|
||||
u8* s0;
|
||||
u8 b, b2, ms, md;
|
||||
int i, rs, rd, xs2, xd2;
|
||||
|
||||
u8 b, b2;
|
||||
int i, rs, rd;
|
||||
|
||||
// faster mode
|
||||
if (((xs & 0x03) == 0) && ((xd & 0x03) == 0) && ((w & 0x03) == 0))
|
||||
{
|
||||
@@ -1219,9 +1219,9 @@ void DrawImg(sCanvas* canvas, sCanvas* src, int xd, int yd, int xs, int ys, int
|
||||
u8* s = src->img + xs/8 + ys*wbs;
|
||||
u8* d0;
|
||||
u8* s0;
|
||||
u8 b, b2, ms, md;
|
||||
int i, rs, rd, xs2, xd2;
|
||||
|
||||
u8 b, b2;
|
||||
int i, rs, rd;
|
||||
|
||||
// faster mode
|
||||
if (((xs & 0x07) == 0) && ((xd & 0x07) == 0) && ((w & 0x07) == 0))
|
||||
{
|
||||
@@ -1291,9 +1291,9 @@ void DrawImg(sCanvas* canvas, sCanvas* src, int xd, int yd, int xs, int ys, int
|
||||
u8* d02;
|
||||
u8* s0;
|
||||
u8* s02;
|
||||
u8 b, b2, bb, bb2, ms, md;
|
||||
int i, rs, rd, xs2, xd2;
|
||||
|
||||
u8 b, b2, bb, bb2;
|
||||
int i, rs, rd;
|
||||
|
||||
// faster mode
|
||||
if (((xs & 0x07) == 0) && ((xd & 0x07) == 0) && ((w & 0x07) == 0))
|
||||
{
|
||||
@@ -1385,9 +1385,9 @@ void DrawImg(sCanvas* canvas, sCanvas* src, int xd, int yd, int xs, int ys, int
|
||||
u8* s0;
|
||||
u8* d02;
|
||||
u8* s02;
|
||||
u8 b, b2, bb, ms, md;
|
||||
int i, rs, rd, xs2, xd2;
|
||||
|
||||
u8 b, b2, bb;
|
||||
int i, rs, rd;
|
||||
|
||||
// faster mode
|
||||
if (((xs & 0x07) == 0) && ((xd & 0x07) == 0) && ((w & 0x07) == 0))
|
||||
{
|
||||
@@ -1396,7 +1396,7 @@ void DrawImg(sCanvas* canvas, sCanvas* src, int xd, int yd, int xs, int ys, int
|
||||
for (; h > 0; h--)
|
||||
{
|
||||
memcpy(d, s, w);
|
||||
if (i)
|
||||
if (i)
|
||||
{
|
||||
memcpy(d2, s2, w);
|
||||
i = False;
|
||||
@@ -1555,9 +1555,9 @@ void DrawBlit(sCanvas* canvas, sCanvas* src, int xd, int yd, int xs, int ys, int
|
||||
u8* s = src->img + xs/2 + ys*wbs;
|
||||
u8* d0;
|
||||
u8* s0;
|
||||
u8 b, b1, b2, ms, md;
|
||||
int i, rs, rd, xs2, xd2;
|
||||
|
||||
u8 b, b1, b2;
|
||||
int i, rs, rd;
|
||||
|
||||
for (; h > 0; h--)
|
||||
{
|
||||
d0 = d;
|
||||
@@ -1611,9 +1611,9 @@ void DrawBlit(sCanvas* canvas, sCanvas* src, int xd, int yd, int xs, int ys, int
|
||||
u8* s = src->img + xs/4 + ys*wbs;
|
||||
u8* d0;
|
||||
u8* s0;
|
||||
u8 b, b1, b2, ms, md;
|
||||
int i, rs, rd, xs2, xd2;
|
||||
|
||||
u8 b, b1, b2;
|
||||
int i, rs, rd;
|
||||
|
||||
for (; h > 0; h--)
|
||||
{
|
||||
d0 = d;
|
||||
@@ -1667,9 +1667,9 @@ void DrawBlit(sCanvas* canvas, sCanvas* src, int xd, int yd, int xs, int ys, int
|
||||
u8* s = src->img + xs/8 + ys*wbs;
|
||||
u8* d0;
|
||||
u8* s0;
|
||||
u8 b, b1, b2, ms, md;
|
||||
int i, rs, rd, xs2, xd2;
|
||||
|
||||
u8 b, b1, b2;
|
||||
int i, rs, rd;
|
||||
|
||||
for (; h > 0; h--)
|
||||
{
|
||||
d0 = d;
|
||||
@@ -1727,9 +1727,9 @@ void DrawBlit(sCanvas* canvas, sCanvas* src, int xd, int yd, int xs, int ys, int
|
||||
u8* d02;
|
||||
u8* s0;
|
||||
u8* s02;
|
||||
u8 b, b1, b12, b2, bb, bb2, ms, md;
|
||||
int i, rs, rd, xs2, xd2;
|
||||
|
||||
u8 b, b1, b12, b2, bb, bb2;
|
||||
int i, rs, rd;
|
||||
|
||||
for (; h > 0; h--)
|
||||
{
|
||||
d0 = d;
|
||||
@@ -1890,7 +1890,7 @@ void DrawImgMat(sCanvas* canvas, const sCanvas* src, int x, int y, int w, int h,
|
||||
{
|
||||
*d++ = *(u8*)interp0->pop[2];
|
||||
}
|
||||
|
||||
|
||||
y0++;
|
||||
d += wbd;
|
||||
}
|
||||
@@ -1905,7 +1905,7 @@ void DrawImgMat(sCanvas* canvas, const sCanvas* src, int x, int y, int w, int h,
|
||||
{
|
||||
xy0m = x0*m11 + y0*m12 + m13;
|
||||
yy0m = x0*m21 + y0*m22 + m23;
|
||||
|
||||
|
||||
for (i = w; i > 0; i--)
|
||||
{
|
||||
x2 = (xy0m>>FRACT) & xmask;
|
||||
@@ -1953,14 +1953,14 @@ void DrawImgMat(sCanvas* canvas, const sCanvas* src, int x, int y, int w, int h,
|
||||
else if (mode == DRAWIMG_CLAMP)
|
||||
{
|
||||
// source image dimension
|
||||
u32 ww = src->w - 1;
|
||||
u32 hh = src->h - 1;
|
||||
int ww = src->w - 1;
|
||||
int hh = src->h - 1;
|
||||
|
||||
for (; h > 0; h--)
|
||||
{
|
||||
xy0m = x0*m11 + y0*m12 + m13;
|
||||
yy0m = x0*m21 + y0*m22 + m23;
|
||||
|
||||
|
||||
for (i = w; i > 0; i--)
|
||||
{
|
||||
x2 = xy0m>>FRACT;
|
||||
@@ -1989,7 +1989,7 @@ void DrawImgMat(sCanvas* canvas, const sCanvas* src, int x, int y, int w, int h,
|
||||
{
|
||||
xy0m = x0*m11 + y0*m12 + m13;
|
||||
yy0m = x0*m21 + y0*m22 + m23;
|
||||
|
||||
|
||||
for (i = w; i > 0; i--)
|
||||
{
|
||||
x2 = xy0m>>FRACT;
|
||||
@@ -2018,7 +2018,7 @@ void DrawImgMat(sCanvas* canvas, const sCanvas* src, int x, int y, int w, int h,
|
||||
{
|
||||
xy0m = x0*m11 + y0*m12 + m13;
|
||||
yy0m = x0*m21 + y0*m22 + m23;
|
||||
|
||||
|
||||
for (i = w; i > 0; i--)
|
||||
{
|
||||
x2 = xy0m>>FRACT;
|
||||
@@ -2081,7 +2081,7 @@ void DrawImgMat(sCanvas* canvas, const sCanvas* src, int x, int y, int w, int h,
|
||||
{
|
||||
*d++ = *(u8*)interp0->pop[2];
|
||||
}
|
||||
|
||||
|
||||
y0++;
|
||||
d += wbd;
|
||||
}
|
||||
@@ -2102,7 +2102,7 @@ void DrawImgMat(sCanvas* canvas, const sCanvas* src, int x, int y, int w, int h,
|
||||
|
||||
xy0m = x0*m11b + y0*m12b + m13;
|
||||
yy0m = x0*m21b + y0*m22b + m23;
|
||||
|
||||
|
||||
for (i = w; i > 0; i--)
|
||||
{
|
||||
x2 = (xy0m>>FRACT) & xmask;
|
||||
@@ -2168,20 +2168,23 @@ void DrawTileMap(sCanvas* canvas, const sCanvas* src, const u8* map, int mapwbit
|
||||
mat->ExportInt(m);
|
||||
|
||||
// prepare variables
|
||||
int wbs = src->wb; // source width bytes
|
||||
const u8* s = src->img; // source image
|
||||
int xy0m, yy0m; // temporary Y members
|
||||
u8* d = canvas->img + canvas->wb*y + x; // destination image
|
||||
int wbd = canvas->wb - w; // destination width bytes
|
||||
int i, x2, y2;
|
||||
int tilesize = 1 << tilebits; // tile size
|
||||
int i;
|
||||
|
||||
#if DRAW_HWINTER
|
||||
int tilebits2 = tilebits*2;
|
||||
#else
|
||||
int tilesize = 1 << tilebits; // tile size
|
||||
int tilemask = tilesize - 1; // tile mask
|
||||
int tileinx; // tile index
|
||||
int mapw = 1<<mapwbits;
|
||||
int maph = 1<<maphbits;
|
||||
int mapmaskx = (mapw * tilesize) - 1; // mask of map width
|
||||
int mapmasky = (maph * tilesize) - 1; // mask of map height
|
||||
#endif
|
||||
|
||||
#if DRAW_HWINTER // 1=use hardware interpolator
|
||||
|
||||
@@ -2215,7 +2218,7 @@ void DrawTileMap(sCanvas* canvas, const sCanvas* src, const u8* map, int mapwbit
|
||||
|
||||
for (; h > 0; h--)
|
||||
{
|
||||
|
||||
|
||||
int m11 = m[0];
|
||||
int m12 = m[1];
|
||||
int m13 = m[2];
|
||||
@@ -2261,6 +2264,8 @@ void DrawTileMap(sCanvas* canvas, const sCanvas* src, const u8* map, int mapwbit
|
||||
|
||||
for (i = w; i > 0; i--)
|
||||
{
|
||||
int x2, y2;
|
||||
|
||||
// pixel X coordinate on the map
|
||||
x2 = (xy0m>>FRACT) & mapmaskx;
|
||||
xy0m += m11;
|
||||
@@ -2307,7 +2312,7 @@ void DrawImgLine(sCanvas* canvas, sCanvas* src, int xd, int yd, int xs, int ys,
|
||||
int wbs = src->wb; // source width bytes
|
||||
u8* d = canvas->img + xd + yd*wbd; // destination address
|
||||
u8* s = src->img + xs + ys*wbs; // source address
|
||||
int i, j;
|
||||
int i;
|
||||
|
||||
#if DRAW_HWINTER // 1=use hardware interpolator to draw images
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* @file
|
||||
/**
|
||||
* @file
|
||||
* @brief Canvas
|
||||
* @author Miroslav Nemecek <Panda38@seznam.cz>
|
||||
* @see CanvasGroup
|
||||
@@ -13,15 +13,15 @@
|
||||
/**
|
||||
* @addtogroup CanvasGroup
|
||||
* @brief Drawing board for shapes and images
|
||||
* @details Canvas is a drawing board. It is a support library for working with graphical surfaces and images.
|
||||
* The sCanvas structure is a set of parameters that describe the graphical surface, for use
|
||||
* in drawing functions. A graphical surface can be either a graphical frame buffer or an image, even in Flash. To draw in a
|
||||
* graphical surface, first attach a canvas to it as a definition describing the structure of the area. Likewise, if you want
|
||||
* @details Canvas is a drawing board. It is a support library for working with graphical surfaces and images.
|
||||
* The sCanvas structure is a set of parameters that describe the graphical surface, for use
|
||||
* in drawing functions. A graphical surface can be either a graphical frame buffer or an image, even in Flash. To draw in a
|
||||
* graphical surface, first attach a canvas to it as a definition describing the structure of the area. Likewise, if you want
|
||||
* to draw an image to the surface, first create a canvas for the image with its parameters. The parameters are a pointer to
|
||||
* the image data, the image dimensions, and the format. The drawing area can be a graphic area with a depth of 1, 2, 4, 8 bits
|
||||
* or with attributes. In the case of drawing an image to a canvas, the source and target canvas must have the same format.
|
||||
* the image data, the image dimensions, and the format. The drawing area can be a graphic area with a depth of 1, 2, 4, 8 bits
|
||||
* or with attributes. In the case of drawing an image to a canvas, the source and target canvas must have the same format.
|
||||
* In the case of transformation matrices, only an 8-bit graphic format can be drawn.
|
||||
* @note In PicoVGA, a default canvas @link Canvas @endlink is available. A graphic frame buffer is automatically attached to it when
|
||||
* @note In PicoVGA, a default canvas @link Canvas @endlink is available. A graphic frame buffer is automatically attached to it when
|
||||
* initialized with the Video() function. Otherwise, it can be used arbitrarily in the program.
|
||||
* @{
|
||||
*/
|
||||
@@ -48,7 +48,7 @@ typedef struct {
|
||||
} sCanvas;
|
||||
|
||||
/**
|
||||
* @brief Draw rectangle
|
||||
* @brief Draw rectangle
|
||||
* @param canvas Canvas
|
||||
* @param x Horizontal position
|
||||
* @param y Veritical position
|
||||
@@ -102,7 +102,7 @@ void DrawLine(sCanvas* canvas, int x1, int y1, int x2, int y2, u8 col);
|
||||
* @param y0 Veritical center coordinate
|
||||
* @param r Radius
|
||||
* @param col Color (with CANVAS_ATTRIB8 format: bit 0..3 = draw color, bit 4 = draw color is background color)
|
||||
* @param mask Mask. Specifies, using bits 0 to 7, which eighths of the circle are drawn.
|
||||
* @param mask Mask. Specifies, using bits 0 to 7, which eighths of the circle are drawn.
|
||||
* <pre>
|
||||
* . B2|B1 .
|
||||
* B3 . | . B0
|
||||
@@ -120,7 +120,7 @@ void DrawFillCircle(sCanvas* canvas, int x0, int y0, int r, u8 col, u8 mask=0xff
|
||||
* @param y0 Veritical center coordinate
|
||||
* @param r Radius
|
||||
* @param col Color (with CANVAS_ATTRIB8 format: bit 0..3 = draw color, bit 4 = draw color is background color)
|
||||
* @param mask Mask. Specifies, using bits 0 to 7, which eighths of the circle are drawn.
|
||||
* @param mask Mask. Specifies, using bits 0 to 7, which eighths of the circle are drawn.
|
||||
* <pre>
|
||||
* . B2|B1 .
|
||||
* B3 . | . B0
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
// convert image from 16-color to 8x8 attribute format
|
||||
void Attr8Conv(u8* dst, u8* attr, const u8* src, int w, int h, const u8* pal)
|
||||
{
|
||||
int x, y, i, j, bestnum, best2num;
|
||||
int x, y, i, bestnum, best2num;
|
||||
int hist[16];
|
||||
u8 b, b2, b3, best, best2, bestcol, best2col;
|
||||
const u8 *s;
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include "pico/stdlib.h"
|
||||
#include "pico/printf.h"
|
||||
#include "pico/multicore.h"
|
||||
#include "hardware/clocks.h"
|
||||
#include "picovga.h"
|
||||
|
||||
|
||||
@@ -85,7 +86,7 @@ const sVideo VideoPAL = {
|
||||
.hfront= 1.65000f, // H front porch (after image, before HSYNC) in [us]
|
||||
.hsync= 4.70000f, // H sync pulse in [us]
|
||||
.hback= 5.70000f, // H back porch (after HSYNC, before image) in [us]
|
||||
.hfull= 47.36000f, // H full visible in [us] (formally should be 51.95 us)
|
||||
.hfull= 47.36000f, // H full visible in [us] (formally should be 51.95 us)
|
||||
|
||||
// vertical (vertical frequency 50 Hz)
|
||||
.vtot=625, // total scanlines (both subframes)
|
||||
@@ -123,7 +124,7 @@ const sVideo VideoPALp = {
|
||||
.hfront= 1.65000f, // H front porch (after image, before HSYNC) in [us]
|
||||
.hsync= 4.70000f, // H sync pulse in [us]
|
||||
.hback= 5.70000f, // H back porch (after HSYNC, before image) in [us]
|
||||
.hfull= 47.36000f, // H full visible in [us] (formally should be 51.95 us)
|
||||
.hfull= 47.36000f, // H full visible in [us] (formally should be 51.95 us)
|
||||
|
||||
// vertical (vertical frequency 50 Hz)
|
||||
.vtot=312, // total scanlines (both subframes)
|
||||
@@ -544,11 +545,11 @@ void VgaCfg(const sVgaCfg* cfg, sVmode* vmode)
|
||||
// recalculate frequency if not locked
|
||||
if (!cfg->lockfreq)
|
||||
{
|
||||
int freq2 = (int)(cpp*wfull*1000/hfull + 0.5f) + 200;
|
||||
u32 freq2 = (u32)(cpp*wfull*1000/hfull + 0.5f) + 200;
|
||||
if (freq2 < freq)
|
||||
{
|
||||
cpp++;
|
||||
freq2 = (int)(cpp*wfull*1000/hfull + 0.5f) + 200;
|
||||
freq2 = (u32)(cpp*wfull*1000/hfull + 0.5f) + 200;
|
||||
}
|
||||
if (freq2 >= freq) freq = freq2;
|
||||
if (freq > cfg->fmax) freq = cfg->fmax;
|
||||
@@ -697,8 +698,8 @@ void VgaCfg(const sVgaCfg* cfg, sVmode* vmode)
|
||||
if (v->inter)
|
||||
{
|
||||
// interlaced
|
||||
vmode->vfirst1 = (vmode->vsync1 + vmode->vpost1)/2 + vmode->vback1 + 1;
|
||||
vmode->vfirst2 = vmode->vfirst1 + vmode->vact1 + vmode->vfront1 +
|
||||
vmode->vfirst1 = (vmode->vsync1 + vmode->vpost1)/2 + vmode->vback1 + 1;
|
||||
vmode->vfirst2 = vmode->vfirst1 + vmode->vact1 + vmode->vfront1 +
|
||||
(vmode->vpre1 + vmode->vsync2 + vmode->vpost2)/2 + vmode->vback2;
|
||||
}
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user