From aa3fc46df54bf3f6591c8b127b93001a80c03118 Mon Sep 17 00:00:00 2001 From: Sven Weidauer Date: Fri, 28 Jan 2011 08:54:55 +0000 Subject: Implemented resolution independence fot the TreeView and HistoryView and moved the coordinate transform function to their own header. svn path=/trunk/netsurf/; revision=11513 --- cocoa/plotter.h | 70 ++------------------------------------------------------- 1 file changed, 2 insertions(+), 68 deletions(-) (limited to 'cocoa/plotter.h') diff --git a/cocoa/plotter.h b/cocoa/plotter.h index e756a26f6..fbcbc4615 100644 --- a/cocoa/plotter.h +++ b/cocoa/plotter.h @@ -21,78 +21,12 @@ #import #import "desktop/plot_style.h" +#import "cocoa/coordinates.h" NSColor *cocoa_convert_colour( colour clr ); void cocoa_update_scale_factor( void ); -extern CGFloat cocoa_scale_factor; - -static inline CGFloat cocoa_px_to_pt( int location ) __attribute__((always_inline,pure)); -static inline CGFloat cocoa_px_to_pt_f( CGFloat location ) __attribute__((always_inline,pure)); -static inline int cocoa_pt_to_px( CGFloat location ) __attribute__((always_inline,pure)); -static inline NSPoint cocoa_point( int x, int y ) __attribute__((always_inline,pure)); -static inline NSSize cocoa_size( int w, int h ) __attribute__((always_inline,pure)); -static inline NSSize cocoa_scaled_size( float scale, int w, int h ) __attribute__((always_inline,pure)); -static inline NSRect cocoa_rect( int x0, int y0, int x1, int y1 ) __attribute__((always_inline,pure)); -static inline NSRect cocoa_rect_wh( int x, int y, int w, int h ) __attribute__((always_inline,pure)); -static inline NSRect cocoa_scaled_rect_wh( float scale, int x, int y, int w, int h ) __attribute__((always_inline,pure)); - -static inline CGFloat cocoa_px_to_pt( int location ) -{ - return ((CGFloat)location) * cocoa_scale_factor; -} - -static inline CGFloat cocoa_px_to_pt_f( CGFloat location ) -{ - return floor( location ) * cocoa_scale_factor; -} - -static inline int cocoa_pt_to_px( CGFloat location ) -{ - return location / cocoa_scale_factor; -} - -static inline NSPoint cocoa_point( int x, int y ) -{ - return NSMakePoint( cocoa_px_to_pt( x ), cocoa_px_to_pt( y ) ); -} - -static inline NSSize cocoa_size( int w, int h ) -{ - return NSMakeSize( cocoa_px_to_pt( w ), cocoa_px_to_pt( h ) ); -} - -static inline NSSize cocoa_scaled_size( float scale, int w, int h ) -{ - return NSMakeSize( cocoa_px_to_pt_f( scale * w ), cocoa_px_to_pt_f( scale * h ) ); -} - -static inline NSRect cocoa_rect( int x0, int y0, int x1, int y1 ) -{ - const NSRect result = { - .origin = cocoa_point( x0, y0 ), - .size = cocoa_size( x1 - x0, y1 - y0 ) - }; - return result; -} - -static inline NSRect cocoa_rect_wh( int x, int y, int w, int h ) -{ - const NSRect result = { - .origin = cocoa_point( x, y ), - .size = cocoa_size( w, h ) - }; - return result; -} - -static inline NSRect cocoa_scaled_rect_wh( float scale, int x, int y, int w, int h ) -{ - const NSRect result = { - .origin = NSMakePoint( cocoa_px_to_pt_f( scale * x ), cocoa_px_to_pt_f( scale * y ) ), - .size = cocoa_scaled_size( scale, w, h ) - }; - return result; -} +void cocoa_set_clip( NSRect rect ); #endif -- cgit v1.2.3