|
commit dd75da6351c3e08618df3fd46a30d06582ae3163
Author: ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>
AuthorDate: Sun Feb 21 21:34:11 2021 +0100
Commit: ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>
CommitDate: Sun Feb 21 21:34:27 2021 +0100
Remove VS compilation warnings about implicit type conversions.
src/Fl_File_Icon2.cxx | 4 ++--
src/Fl_SVG_Image.cxx | 10 +++++-----
src/drivers/SVG/Fl_SVG_File_Surface.cxx | 18 +++++++++---------
3 files changed, 16 insertions(+), 16 deletions(-)
diff --git src/Fl_File_Icon2.cxx src/Fl_File_Icon2.cxx
index ce0b78a..5b63347 100644
--- src/Fl_File_Icon2.cxx
+++ src/Fl_File_Icon2.cxx
@@ -240,7 +240,7 @@ Fl_File_Icon::load_fti(const char *fti) // I - File to read from
else if (strcmp(command, "bgnoutlinepolygon") == 0)
{
add(OUTLINEPOLYGON);
- outline = add(0) - data_;
+ outline = int(add(0) - data_);
add(0);
}
else if (strcmp(command, "endoutlinepolygon") == 0 && outline)
@@ -408,7 +408,7 @@ int Fl_File_Icon::load_image(const char *ifile) // I - File to read from
ptr = img->data();
sscanf(*ptr, "%*d%*d%d%d", &ncolors, &chars_per_color);
- colors = new Fl_Color[1 << (chars_per_color * 8)];
+ colors = new Fl_Color[int(1 << (chars_per_color * 8))];
// Read the colormap...
memset(colors, 0, sizeof(Fl_Color) << (chars_per_color * 8));
diff --git src/Fl_SVG_Image.cxx src/Fl_SVG_Image.cxx
index 8b9f01c..ffdc6d2 100644
--- src/Fl_SVG_Image.cxx
+++ src/Fl_SVG_Image.cxx
@@ -162,8 +162,8 @@ void Fl_SVG_Image::init_(const char *filename, const char *in_filedata, Fl_SVG_I
d(-1);
ld(ERR_FORMAT);
} else {
- w(counted_svg_image_->svg_image->width + 0.5);
- h(counted_svg_image_->svg_image->height + 0.5);
+ w(int(counted_svg_image_->svg_image->width + 0.5));
+ h(int(counted_svg_image_->svg_image->height + 0.5));
}
} else if (copy_source) {
w(copy_source->w());
@@ -184,7 +184,7 @@ void Fl_SVG_Image::rasterize_(int W, int H) {
fy = (double)H / counted_svg_image_->svg_image->height;
}
array = new uchar[W*H*4];
- nsvgRasterizeXY(rasterizer, counted_svg_image_->svg_image, 0, 0, fx, fy, (uchar* )array, W, H, W*4);
+ nsvgRasterizeXY(rasterizer, counted_svg_image_->svg_image, 0, 0, float(fx), float(fy), (uchar* )array, W, H, W*4);
alloc_array = 1;
data((const char * const *)&array, 1);
d(4);
@@ -240,8 +240,8 @@ void Fl_SVG_Image::cache_size_(int &width, int &height) {
// Keep the rasterized image proportional to its source-level width and height
// while maintaining it large enough to allow image tiling.
float f = counted_svg_image_->svg_image->width / counted_svg_image_->svg_image->height;
- if (height * f >= width) width = height * f + 0.5;
- else height = width/f + 0.5;
+ if (height * f >= width) width = int(height * f + 0.5);
+ else height = int(width/f + 0.5);
}
}
diff --git src/drivers/SVG/Fl_SVG_File_Surface.cxx src/drivers/SVG/Fl_SVG_File_Surface.cxx
index 552b1bf..c3aa3ce 100644
--- src/drivers/SVG/Fl_SVG_File_Surface.cxx
+++ src/drivers/SVG/Fl_SVG_File_Surface.cxx
@@ -219,9 +219,9 @@ void Fl_SVG_Graphics_Driver::compute_dasharray(float s, char *dashes) {
} else {
int cap_part = (line_style_ & 0xF00);
bool is_flat = (cap_part == FL_CAP_FLAT || cap_part == 0);
- float dot = (is_flat ? width_/s : width_*0.6/s);
- float gap = (is_flat ? width_/s : width_*1.5/s);
- float big = (is_flat ? 3*width_/s : width_*2.5/s);
+ float dot = (is_flat ? width_/s : width_*0.6f/s);
+ float gap = (is_flat ? width_/s : width_*1.5f/s);
+ float big = (is_flat ? 3*width_/s : width_*2.5f/s);
if (dasharray_) free(dasharray_);
dasharray_ = (char*)malloc(61);
if (dash_part == FL_DOT) sprintf(dasharray_, "%.3f,%.3f", dot, gap);
@@ -309,7 +309,7 @@ Fl_SVG_File_Surface::Fl_SVG_File_Surface(int w, int h, FILE *f, int (*closef)(FI
closef_ = closef;
Fl_Window *win = Fl::first_window();
float s = (win ? Fl::screen_scale(win->screen_num()) : 1);
- int sw = w * s, sh = h * s;
+ int sw = int(w * s), sh = int(h * s);
fprintf(f,
"<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>\n"
"<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\" \n"
@@ -418,7 +418,7 @@ static void user_write_data(png_structp png_ptr, png_bytep data, png_size_t leng
if (length >= 3) {
new_l = write_by_3(data, length, svg_base64_data);
}
- svg_base64_data->lbuf = new_l;
+ svg_base64_data->lbuf = (int)new_l;
if (new_l) {
memcpy(svg_base64_data->buff, data + length - new_l, new_l);
}
@@ -540,7 +540,7 @@ static void term_destination(jpeg_compress_struct *cinfo) {
jpeg_client_data_struct *client_data = (jpeg_client_data_struct*)(cinfo->client_data);
size_t new_l = process_jpeg_chunk(cinfo, client_data->size - cinfo->dest->free_in_buffer);
if (new_l) {
- to_base64(client_data->JPEG_BUFFER, new_l, &client_data->base64_data);
+ to_base64(client_data->JPEG_BUFFER, (int)new_l, &client_data->base64_data);
}
}
@@ -972,13 +972,13 @@ void Fl_SVG_Graphics_Driver::arc_pie(char AorP, int x, int y, int w, int h, doub
a1 = (-a1)/180.0f*M_PI; a2 = (-a2)/180.0f*M_PI;
float cx = x + 0.5f*w /*- 0.5f*/, cy = y + 0.5f*h - 0.5f;
double r = (w!=h ? 0.5 : (w+h)*0.25f-0.5f);
- float stroke_width = width_;
+ float stroke_width = float(width_);
float sx, sy;
if (w != h) {
- sx = w-1; sy = h-1;
+ sx = float(w-1); sy = float(h-1);
stroke_width /= ((sx+sy)/2);
} else {
- sx = sy = 2*r;
+ sx = sy = float(2*r);
stroke_width /= sx;
}
fprintf(out_, "<g transform=\"translate(%f,%f) scale(%f,%f)\">\n", cx, cy, sx, sy);
[ Direct Link to Message ] | |