diff options
| author | Matthias Melcher <github@matthiasm.com> | 2023-01-01 20:05:42 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-01-01 20:05:42 +0100 |
| commit | a63ad76603accc70747a2073c78139299064c43b (patch) | |
| tree | b64302ca02847a73d9c8445c11023cfc34314dff /src/drivers | |
| parent | 23e8d831a868774c014993d52eead0cbe105f218 (diff) | |
FLUID refactor and macOS warnings removed (#623)
P renamed to g_project
class Project renamed to class Fluid_Project
fixes macOS type cast warnings
Diffstat (limited to 'src/drivers')
7 files changed, 27 insertions, 27 deletions
diff --git a/src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.cxx b/src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.cxx index 94e0f0104..e2ccbe969 100644 --- a/src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.cxx +++ b/src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.cxx @@ -355,8 +355,8 @@ int Fl_Cocoa_Screen_Driver::input_widget_handle_key(int key, unsigned mods, unsi void Fl_Cocoa_Screen_Driver::offscreen_size(Fl_Offscreen off, int &width, int &height) { - width = CGBitmapContextGetWidth((CGContextRef)off); - height = CGBitmapContextGetHeight((CGContextRef)off); + width = (int)CGBitmapContextGetWidth((CGContextRef)off); + height = (int)CGBitmapContextGetHeight((CGContextRef)off); } Fl_RGB_Image *Fl_Cocoa_Screen_Driver::read_win_rectangle(int X, int Y, int w, int h, Fl_Window *window, @@ -369,11 +369,11 @@ Fl_RGB_Image *Fl_Cocoa_Screen_Driver::read_win_rectangle(int X, int Y, int w, in CGContextRef src = (CGContextRef)Fl_Surface_Device::surface()->driver()->gc(); // get bitmap context base = (uchar *)CGBitmapContextGetData(src); // get data if(!base) return NULL; - int sw = CGBitmapContextGetWidth(src); - int sh = CGBitmapContextGetHeight(src); + int sw = (int)CGBitmapContextGetWidth(src); + int sh = (int)CGBitmapContextGetHeight(src); if( (sw - X < w) || (sh - Y < h) ) return NULL; - bpr = CGBitmapContextGetBytesPerRow(src); - bpp = CGBitmapContextGetBitsPerPixel(src)/8; + bpr = (int)CGBitmapContextGetBytesPerRow(src); + bpp = (int)CGBitmapContextGetBitsPerPixel(src)/8; Fl_Image_Surface *imgs = (Fl_Image_Surface*)Fl_Surface_Device::surface(); int fltk_w, fltk_h; imgs->printable_rect(&fltk_w, &fltk_h); @@ -400,16 +400,16 @@ Fl_RGB_Image *Fl_Cocoa_Screen_Driver::read_win_rectangle(int X, int Y, int w, in if (!cgimg) { return NULL; } - w = CGImageGetWidth(cgimg); - h = CGImageGetHeight(cgimg); + w = (int)CGImageGetWidth(cgimg); + h = (int)CGImageGetHeight(cgimg); Fl_Image_Surface *surf = new Fl_Image_Surface(w, h); Fl_Surface_Device::push_current(surf); ((Fl_Quartz_Graphics_Driver*)fl_graphics_driver)->draw_CGImage(cgimg, 0, 0, w, h, 0, 0, w, h); CGContextRef gc = (CGContextRef)fl_graphics_driver->gc(); - w = CGBitmapContextGetWidth(gc); - h = CGBitmapContextGetHeight(gc); - bpr = CGBitmapContextGetBytesPerRow(gc); - bpp = CGBitmapContextGetBitsPerPixel(gc)/8; + w = (int)CGBitmapContextGetWidth(gc); + h = (int)CGBitmapContextGetHeight(gc); + bpr = (int)CGBitmapContextGetBytesPerRow(gc); + bpp = (int)CGBitmapContextGetBitsPerPixel(gc)/8; base = (uchar*)CGBitmapContextGetData(gc); p = new uchar[bpr * h]; memcpy(p, base, bpr * h); diff --git a/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.cxx b/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.cxx index 825056e44..22b6af0f8 100644 --- a/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.cxx +++ b/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.cxx @@ -243,7 +243,7 @@ int Fl_Cocoa_Window_Driver::scroll(int src_x, int src_y, int src_w, int src_h, i // the current surface is generally the display, but is an Fl_Image_Surface when scrolling an Fl_Overlay_Window Fl_Quartz_Graphics_Driver *qgd = (Fl_Quartz_Graphics_Driver*)Fl_Surface_Device::surface()->driver(); float s = qgd->scale(); - qgd->draw_CGImage(img, dest_x, dest_y, lround(s*src_w), lround(s*src_h), 0, 0, src_w, src_h); + qgd->draw_CGImage(img, dest_x, dest_y, (int)lround(s*src_w), (int)lround(s*src_h), 0, 0, src_w, src_h); CFRelease(img); return 0; } diff --git a/src/drivers/Darwin/Fl_Darwin_System_Driver.cxx b/src/drivers/Darwin/Fl_Darwin_System_Driver.cxx index 2d1e4d4e4..aa5ccbe0a 100644 --- a/src/drivers/Darwin/Fl_Darwin_System_Driver.cxx +++ b/src/drivers/Darwin/Fl_Darwin_System_Driver.cxx @@ -131,7 +131,7 @@ int Fl_Darwin_System_Driver::filename_list(const char *d, dirent ***list, int dirlen; char *dirloc; // Assume that locale encoding is no less dense than UTF-8 - dirlen = strlen(d); + dirlen = (int)strlen(d); dirloc = (char *)d; # if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_8 int n = scandir(dirloc, list, 0, (int(*)(const struct dirent**,const struct dirent**))sort); @@ -153,7 +153,7 @@ int Fl_Darwin_System_Driver::filename_list(const char *d, dirent ***list, for (i=0; i<n; i++) { int newlen; dirent *de = (*list)[i]; - int len = strlen(de->d_name); + int len = (int)strlen(de->d_name); newlen = len; dirent *newde = (dirent*)malloc(de->d_name - (char*)de + newlen + 2); // Add space for a / and a nul // Conversion to UTF-8 @@ -298,7 +298,7 @@ static int n_buf = 0; const char *Fl_Darwin_System_Driver::latin1_to_local(const char *t, int n) { - if (n==-1) n = strlen(t); + if (n==-1) n = (int)strlen(t); if (n<=n_buf) { n_buf = (n + 257) & 0x7fffff00; if (buf) free(buf); @@ -319,7 +319,7 @@ const char *Fl_Darwin_System_Driver::latin1_to_local(const char *t, int n) const char *Fl_Darwin_System_Driver::local_to_latin1(const char *t, int n) { - if (n==-1) n = strlen(t); + if (n==-1) n = (int)strlen(t); if (n<=n_buf) { n_buf = (n + 257) & 0x7fffff00; if (buf) free(buf); diff --git a/src/drivers/Quartz/Fl_Quartz_Graphics_Driver.cxx b/src/drivers/Quartz/Fl_Quartz_Graphics_Driver.cxx index 552da03f9..d3f3d343a 100644 --- a/src/drivers/Quartz/Fl_Quartz_Graphics_Driver.cxx +++ b/src/drivers/Quartz/Fl_Quartz_Graphics_Driver.cxx @@ -92,8 +92,8 @@ void Fl_Quartz_Graphics_Driver::copy_offscreen(int x, int y, int w, int h, Fl_Of // draw portion srcx,srcy,w,h of osrc to position x,y (top-left) of the graphics driver's surface CGContextRef src = (CGContextRef)osrc; void *data = CGBitmapContextGetData(src); - int sw = CGBitmapContextGetWidth(src); - int sh = CGBitmapContextGetHeight(src); + int sw = (int)CGBitmapContextGetWidth(src); + int sh = (int)CGBitmapContextGetHeight(src); CGImageRef img; #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4 if (fl_mac_os_version >= 100400) img = CGBitmapContextCreateImage(src); // requires 10.4 diff --git a/src/drivers/Quartz/Fl_Quartz_Graphics_Driver_image.cxx b/src/drivers/Quartz/Fl_Quartz_Graphics_Driver_image.cxx index b97cfbba7..87d4d4f32 100644 --- a/src/drivers/Quartz/Fl_Quartz_Graphics_Driver_image.cxx +++ b/src/drivers/Quartz/Fl_Quartz_Graphics_Driver_image.cxx @@ -252,8 +252,8 @@ void Fl_Quartz_Graphics_Driver::cache(Fl_Pixmap *img) { Fl_Surface_Device::pop_current(); CGContextRef src = (CGContextRef)Fl_Graphics_Driver::get_offscreen_and_delete_image_surface(surf); void *cgdata = CGBitmapContextGetData(src); - int sw = CGBitmapContextGetWidth(src); - int sh = CGBitmapContextGetHeight(src); + int sw = (int)CGBitmapContextGetWidth(src); + int sh = (int)CGBitmapContextGetHeight(src); CGImageAlphaInfo alpha = CGBitmapContextGetAlphaInfo(src); CGColorSpaceRef lut = CGColorSpaceCreateDeviceRGB(); CGDataProviderRef src_bytes = CGDataProviderCreateWithData(src, cgdata, sw*sh*4, pmProviderRelease); diff --git a/src/drivers/Quartz/Fl_Quartz_Graphics_Driver_line_style.cxx b/src/drivers/Quartz/Fl_Quartz_Graphics_Driver_line_style.cxx index 8e17f87c5..6a63ae483 100644 --- a/src/drivers/Quartz/Fl_Quartz_Graphics_Driver_line_style.cxx +++ b/src/drivers/Quartz/Fl_Quartz_Graphics_Driver_line_style.cxx @@ -54,7 +54,7 @@ void Fl_Quartz_Graphics_Driver::line_style(int style, int width, char* dashes) { CGFloat *pDst = pattern; while (*d) { *pDst++ = (float)*d++; } quartz_line_pattern = pattern; - quartz_line_pattern_size = d-dashes; + quartz_line_pattern_size = (int)(d-dashes); } else if (style & 0xff) { char dash, dot, gap; // adjust lengths to account for cap: @@ -73,7 +73,7 @@ void Fl_Quartz_Graphics_Driver::line_style(int style, int width, char* dashes) { case FL_DASHDOT: *pDst++ = dash; *pDst++ = gap; *pDst++ = dot; *pDst++ = gap; break; case FL_DASHDOTDOT: *pDst++ = dash; *pDst++ = gap; *pDst++ = dot; *pDst++ = gap; *pDst++ = dot; *pDst++ = gap; break; } - quartz_line_pattern_size = pDst-pattern; + quartz_line_pattern_size = (int)(pDst-pattern); quartz_line_pattern = pattern; } else { quartz_line_pattern = 0; diff --git a/src/drivers/Quartz/Fl_Quartz_Image_Surface_Driver.cxx b/src/drivers/Quartz/Fl_Quartz_Image_Surface_Driver.cxx index 2f1acc5d9..451078484 100644 --- a/src/drivers/Quartz/Fl_Quartz_Image_Surface_Driver.cxx +++ b/src/drivers/Quartz/Fl_Quartz_Image_Surface_Driver.cxx @@ -79,10 +79,10 @@ void Fl_Quartz_Image_Surface_Driver::untranslate() { Fl_RGB_Image* Fl_Quartz_Image_Surface_Driver::image() { CGContextFlush((CGContextRef)offscreen); - int W = CGBitmapContextGetWidth((CGContextRef)offscreen); - int H = CGBitmapContextGetHeight((CGContextRef)offscreen); - int bpr = CGBitmapContextGetBytesPerRow((CGContextRef)offscreen); - int bpp = CGBitmapContextGetBitsPerPixel((CGContextRef)offscreen)/8; + int W = (int)CGBitmapContextGetWidth((CGContextRef)offscreen); + int H = (int)CGBitmapContextGetHeight((CGContextRef)offscreen); + int bpr = (int)CGBitmapContextGetBytesPerRow((CGContextRef)offscreen); + int bpp = (int)CGBitmapContextGetBitsPerPixel((CGContextRef)offscreen)/8; uchar *base = (uchar*)CGBitmapContextGetData((CGContextRef)offscreen); int idx, idy; uchar *pdst, *psrc; |
