summaryrefslogtreecommitdiff
path: root/src/drivers/Cocoa
diff options
context:
space:
mode:
authorMatthias Melcher <github@matthiasm.com>2023-01-01 20:05:42 +0100
committerGitHub <noreply@github.com>2023-01-01 20:05:42 +0100
commita63ad76603accc70747a2073c78139299064c43b (patch)
treeb64302ca02847a73d9c8445c11023cfc34314dff /src/drivers/Cocoa
parent23e8d831a868774c014993d52eead0cbe105f218 (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/Cocoa')
-rw-r--r--src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.cxx24
-rw-r--r--src/drivers/Cocoa/Fl_Cocoa_Window_Driver.cxx2
2 files changed, 13 insertions, 13 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;
}