diff options
author | Sven Weidauer <sven.weidauer@gmail.com> | 2011-01-28 08:54:55 +0000 |
---|---|---|
committer | Sven Weidauer <sven.weidauer@gmail.com> | 2011-01-28 08:54:55 +0000 |
commit | aa3fc46df54bf3f6591c8b127b93001a80c03118 (patch) | |
tree | a7578241121b5d79bacb4c5943987bea7545a34c /cocoa/plotter.h | |
parent | a1f1138479a276b78be2866bd6a29ee6eb019fb6 (diff) | |
download | netsurf-aa3fc46df54bf3f6591c8b127b93001a80c03118.tar.gz netsurf-aa3fc46df54bf3f6591c8b127b93001a80c03118.tar.bz2 |
Implemented resolution independence fot the TreeView and HistoryView and moved the coordinate transform function to their own header.
svn path=/trunk/netsurf/; revision=11513
Diffstat (limited to 'cocoa/plotter.h')
-rw-r--r-- | cocoa/plotter.h | 70 |
1 files changed, 2 insertions, 68 deletions
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 <Cocoa/Cocoa.h> #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 |