diff --git a/Docs/BUILDING-AmigaOS b/Docs/BUILDING-AmigaOS index 3239e88c8..3f05b9caf 100644 --- a/Docs/BUILDING-AmigaOS +++ b/Docs/BUILDING-AmigaOS @@ -1,5 +1,5 @@ -------------------------------------------------------------------------------- - Build Instructions for AmigaOS NetSurf 29 March 2014 + Build Instructions for AmigaOS NetSurf 02 May 2014 -------------------------------------------------------------------------------- This document provides instructions for building the AmigaOS version of @@ -75,9 +75,6 @@ http://www.os4depot.net/share/development/library/misc/libcurl.lha - To use the shared object when compiling with Cairo support, a link must be made: - - 1> makelink sdk:local/newlib/lib/libcurl.so sobjs:libcurl.so.8 soft libpng @@ -88,9 +85,6 @@ http://www.os4depot.net/share/development/library/graphics/libpng.lha - If building with Cairo, NetSurf MUST be linked against the version of - libpng.so included with OS4. - OpenSSL --------- @@ -99,11 +93,6 @@ http://www.os4depot.net/share/development/library/misc/libopenssl.lha - To use the shared object when compiling with Cairo support, a link must be made: - - 1> makelink sdk:local/newlib/lib/libssl.so sobjs:libssl.so.1.0.0 soft - 1> makelink sdk:local/newlib/lib/libcrypto.so sobjs:libcrypto.so.1.0.0 soft - Libharu --------- @@ -138,12 +127,3 @@ Experimental Javascript support requires Spidermonkey. The patches to build v1.7 are available from the NetSurf toolchains Git repository. - - General requirements ----------------------- - - Please note that building with Cairo (option NETSURF_AMIGA_USE_CAIRO) will - link NetSurf against shared objects, and require the OS4.1 SDK to build and - AmigaOS 4.1 to run. There is no longer any advantage in building against - Cairo beyond anti-aliasing, and this option may be removed in the future. - diff --git a/amiga/Makefile.defaults b/amiga/Makefile.defaults index 43b42b22c..2134e8373 100644 --- a/amiga/Makefile.defaults +++ b/amiga/Makefile.defaults @@ -26,12 +26,6 @@ NETSURF_USE_AMIGA_DATATYPES := YES # Valid options: YES, NO NETSURF_USE_NSSVG := YES -# Enable NetSurf's use of libcairo for some plotter functions -# This will also link NetSurf with shared objects, and -# requires AmigaOS 4.1 or higher to run the resulting executable -# Valid options: YES, NO, AUTO -NETSURF_USE_AMIGA_CAIRO := AUTO - # Enable NetSurf's use of Spidermonkey 1.80+ # Only here to stop the build complaining; # enable NETSURF_USE_MOZJS instead for JavaScript support @@ -40,3 +34,4 @@ NETSURF_USE_JS := NO # Optimisation levels CFLAGS += -O2 -gstabs + diff --git a/amiga/Makefile.target b/amiga/Makefile.target index b54fa1e2c..c90027465 100644 --- a/amiga/Makefile.target +++ b/amiga/Makefile.target @@ -15,7 +15,6 @@ NETSURF_FEATURE_PNG_CFLAGS := -DWITH_PNG NETSURF_FEATURE_WEBP_CFLAGS := -DWITH_WEBP NETSURF_FEATURE_NSSVG_CFLAGS := -DWITH_NS_SVG NETSURF_FEATURE_VIDEO_CFLAGS := -DWITH_VIDEO -NETSURF_FEATURE_AMIGA_CAIRO_CFLAGS := -DNS_AMIGA_CAIRO ifeq ($(HOST),amiga) $(eval $(call feature_enabled,ROSPRITE,-DWITH_NSSPRITE,-lrosprite,Sprite (librosprite))) @@ -27,25 +26,18 @@ ifeq ($(HOST),amiga) $(eval $(call feature_enabled,VIDEO,-DWITH_VIDEO -I /SDK/local/newlib/include/glib-2.0,-lgstreamer-0.10 -lglib-2.0 -lgobject-2.0 -lgmodule-2.0 -lgthread-2.0 -lintl -lffi,Video (libgstreamer))) $(eval $(call feature_enabled,JS,-DXP_UNIX -DWITH_JS -DJS_VERSION=185,-lstdc++ -lmozjs185,JavaScript)) $(eval $(call feature_enabled,MOZJS,-DXP_AMIGA -DWITH_MOZJS -DJS_VERSION=170 -DJSVERSION_LATEST=170 -DJSOPTION_JIT=0 -DJSCLASS_GLOBAL_FLAGS=0,-ljs -lfdlibm,JavaScript)) - $(eval $(call feature_enabled,AMIGA_CAIRO,-DNS_AMIGA_CAIRO,,Cairo)) $(eval $(call feature_enabled,AMIGA_ICON,-DWITH_AMIGA_ICON,,Amiga icon)) $(eval $(call feature_enabled,AMIGA_DATATYPES,-DWITH_AMIGA_DATATYPES,,DataTypes)) CFLAGS += -I /SDK/local/common/include/libpng12 LDFLAGS += -lcurl -lrtmp -lpthread -ltre -lintl -lauto -lpbl LDFLAGS += -lssl -lcrypto -ldom -lhubbub -lcss -lparserutils -lwapcaplet - - ifeq ($(NETSURF_USE_AMIGA_CAIRO),YES) - CFLAGS += -I /SDK/local/common/include/cairo - LDFLAGS += -use-dynld -ldl -lcairo -lpixman-1 -lfreetype -lfontconfig -lpng -lexpat - endif else $(eval $(call pkg_config_find_and_add_enabled,ROSPRITE,librosprite,Sprite)) $(eval $(call pkg_config_find_and_add_enabled,BMP,libnsbmp,BMP)) $(eval $(call pkg_config_find_and_add_enabled,GIF,libnsgif,GIF)) $(eval $(call pkg_config_find_and_add_enabled,PNG,libpng,PNG)) $(eval $(call pkg_config_find_and_add_enabled,NSSVG,libsvgtiny,NSSVG)) - $(eval $(call pkg_config_find_and_add_enabled,AMIGA_CAIRO,cairo,Cairo)) $(eval $(call feature_enabled,MOZJS,-DXP_AMIGA -DWITH_MOZJS -DJS_VERSION=170 -DJSVERSION_LATEST=170 -DJSOPTION_JIT=0 -DJSCLASS_GLOBAL_FLAGS=0,-ljs,JavaScript)) $(eval $(call feature_enabled,AMIGA_ICON,-DWITH_AMIGA_ICON,,Amiga icon)) $(eval $(call feature_enabled,AMIGA_DATATYPES,-DWITH_AMIGA_DATATYPES,,DataTypes)) diff --git a/amiga/dist/Install b/amiga/dist/Install index 61defec03..a80404ec6 100755 --- a/amiga/dist/Install +++ b/amiga/dist/Install @@ -309,72 +309,9 @@ (set #icon-exists (exists (tackon @default-dest "NetSurf.info"))) (set osver (getversion)) (set osver (/ osver 65536)) -(set #versions-available 0) - -(set #static-filename "NetSurf") -(set #cairo-filename "NetSurf") - -(if (exists "NetSurf") - ( - (if (exists "SObjs") - ( - (if (>= osver 53) - ( - (set #cairo-name "Shared objects/part-Cairo") - (set #versions-available (+ #versions-available 1)) - (set #cairo-version 1) - ) - ;else - ( - (set #cairo-version 0) - (set #cairo-name "") - ) - ) - ) - ;else - ( - ; assume static if sobjs is not present - (set #static-name "Static/graphics.library") - (set #versions-available (+ #versions-available 1)) - (set #cairo-version 0) - (set #static-filename "NetSurf") - ) - ) - ) - ; else - ( - (set #cairo-version 0) - (set #cairo-name "") - ) -) - -(transcript "Versions avaiable for install: " #versions-available " " #static-name " " #cairo-name) - -(if (= #versions-available 0) - ( - (abort "Did not find any compatible versions of NetSurf to install!\n\n" - "NetSurf requires AmigaOS 4.1 or higher.") - ) -) (complete 10) -(if (AND (> @user-level 0) (> #versions-available 1)) - ( - (set #cairo-version - (askchoice - (prompt "Which version of NetSurf would you like to install?") - (help "The Cairo version has anti-aliasing of graphical elements.\n\n" - @askchoice-help) - (choices #static-name #cairo-name) - (default #cairo-version) - ) - ) - ) -) - -(complete 15) - (set #user (getenv "user")) (if (= #user "") (set #user "Default")) @@ -415,7 +352,7 @@ ) ) -(complete 18) +(complete 15) (if (>= osver 53) ( @@ -436,7 +373,7 @@ ) ) -(complete 19) +(complete 20) (set #runfixfonts (askbool @@ -449,9 +386,7 @@ ) ) -(complete 20) - -(set #netsurf-name (select #cairo-version #static-filename #cairo-filename)) +(complete 25) (working "Installing NetSurf") @@ -460,7 +395,7 @@ (copyfiles (prompt "Copying NetSurf...") (help @copyfiles-help) - (source #netsurf-name) + (source "NetSurf") (dest @default-dest) (newname "NetSurf") (optional "askuser" "force" "oknodelete") @@ -473,7 +408,7 @@ ) ) -(complete 30) +(complete 40) (if #searchengines-exist (rename (tackon @default-dest "Resources/SearchEngines") (tackon @default-dest "Resources/SearchEngines.backup")) @@ -483,6 +418,8 @@ (run "c:filenote Rexx/ViewSource.nsrx \"View source\"") (run "c:filenote Rexx/GetVideo.nsrx \"Get video\"") +(complete 50) + (copyfiles (prompt "Copying files") (source "") @@ -494,6 +431,8 @@ ; (all) ) +(complete 65) + (copyfiles (prompt "Copying additional documentation") (source "") @@ -504,34 +443,7 @@ (optional "nofail") ) -(set #complete 40) -(working "Copying Libraries") - -(if (exists "Libs") - ( - (foreach "Libs" "#?" - (complete #complete) - (p_copylib @each-name) - (set #complete (+ #complete 2)) - ) - ) -) - -(set #complete 60) - -(if (= #cairo-version 1) - ( - (working "Copying Shared Objects") - - (foreach "SObjs" "#?" - (complete #complete) - (p_copysobj @each-name) - (set #complete (+ #complete 1)) - ) - ) -) - -(complete 90) +(complete 70) (if #themeshort ( @@ -578,7 +490,7 @@ ) ) -(complete 95) +(complete 75) (if (= (exists "ENVARC:Sys/def_css.info") 0) (copyfiles @@ -591,7 +503,7 @@ ) ) -(complete 96) +(complete 80) (working "Setting MIME types") (p_setmimetype "css" "text/css") @@ -611,7 +523,7 @@ (p_setmimetype "zip" "application/x-zip") (p_setmimetype "js" "application/javascript") -(complete 97) +(complete 85) (if (>= osver 53) (if (= (exists "Rexx:NetSurf") 0) @@ -659,7 +571,7 @@ ) ) -(complete 98) +(complete 90) (if (= #addlaunchhandler 1) ( @@ -691,7 +603,7 @@ ) ) -(complete 99) +(complete 95) (working "Running FixFonts") diff --git a/amiga/dist/NetSurf.guide b/amiga/dist/NetSurf.guide index 5aaf60aa3..f01ee849b 100755 --- a/amiga/dist/NetSurf.guide +++ b/amiga/dist/NetSurf.guide @@ -121,7 +121,6 @@ There are a couple of Amiga-specific options which can only be changed directly @{b}kiosk_mode@{ub} No gadgets @{b}printer_unit@{ub} Specifies which printer.device unit to print to @{b}drag_save_icons@{ub} Enables displaying Workbench-style transparent icons under the pointer when performing drag saves (ctrl-drag of objects available if NetSurf is running on the Workbench screen) and text selection drags. If set to 0 the pointer style will change instead. OS 4.0 users may want to set this to 0 as icons will appear opaque and obscure the drop position. -@{b}cairo_renderer@{ub} Set rendering engine. -1 = palette-mapped (set automatically when required), 0 = graphics.library (default), 1 = Cairo/graphics.library mixed, 2 = Full Cairo. @{b}monitor_aspect_x@{ub}/@{b}monitor_aspect_y@{ub} Correct aspect ratio for displays (default of 0 means "assume square pixels"). @{b}screen_compositing@{ub} Use compositing on NetSurf's own screen. 0=disable, 1=enable, 2=default (NB: This is indirectly modified by changing the "simple refresh" option in the GUI) @{b}resize_with_contents@{ub} Set to 1 to respect GUI prefs' "resize with contents" option. Default is to use old-style "resize on release" @@ -372,8 +371,6 @@ There are a number of options which can be changed that will affect the speed of @{b}Cache native versions@{ub} to @{b}Scaled@{ub} (or preferably @{b}All@{ub}, but this will use more graphics mem, and scaling images is a bigger performance hit) Deselect @{b}Higher quality scaling@{ub}, this will be very slow if not done in hardware.@{lindent} -@{lindent 2}* In @{"Options" link Options}, set cairo_renderer:1@{lindent} - @{lindent 2}* In @{"Options" link Options}, increase redraw_tile_size_x/y (increasing this value uses more graphics mem)@{lindent} @{lindent 2}* In @{"Options" link Options}, set font_antialiasing:0@{lindent} diff --git a/amiga/gui.c b/amiga/gui.c index ed966769a..47a7fbea9 100644 --- a/amiga/gui.c +++ b/amiga/gui.c @@ -556,11 +556,6 @@ static nserror ami_set_options(struct nsoption_s *defaults) nsoption_set_bool(core_select_menu, true); - #ifndef NS_AMIGA_CAIRO - /* Ensure we get some output when Cairo not available */ - nsoption_set_int(cairo_renderer, 0); - #endif - if((!nsoption_charp(accept_language)) || (nsoption_charp(accept_language)[0] == '\0') || (nsoption_bool(accept_lang_locale) == true)) diff --git a/amiga/menu.c b/amiga/menu.c index b2e233415..43c8c188b 100644 --- a/amiga/menu.c +++ b/amiga/menu.c @@ -788,18 +788,9 @@ static void ami_menu_item_project_about(struct Hook *hook, APTR window, struct I TDR_TitleString, messages_get("NetSurf"), TDR_Window, gwin->win, TDR_GadgetString, temp2, -#ifndef NDEBUG - TDR_FormatString,"NetSurf %s\n%s\nBuild date %s\n\nhttp://www.netsurf-browser.org", -#else - TDR_FormatString,"NetSurf %s\n%s\n\nhttp://www.netsurf-browser.org", -#endif + TDR_FormatString,"NetSurf %s\nBuild date %s\n\nhttp://www.netsurf-browser.org", TDR_Arg1,netsurf_version, -#ifdef NS_AMIGA_CAIRO - TDR_Arg2,"Cairo (OS4.1+) SObjs build", -#else - TDR_Arg2,"graphics.library static build", -#endif - TDR_Arg3,verdate, + TDR_Arg2,verdate, TAG_DONE); free(temp2); diff --git a/amiga/options.h b/amiga/options.h index f595cd240..e383dcf9a 100644 --- a/amiga/options.h +++ b/amiga/options.h @@ -77,7 +77,6 @@ NSOPTION_INTEGER(cookies_window_ypos, 0) NSOPTION_INTEGER(cookies_window_xsize, 0) NSOPTION_INTEGER(cookies_window_ysize, 0) NSOPTION_INTEGER(web_search_width, 0) -NSOPTION_INTEGER(cairo_renderer, 0) NSOPTION_BOOL(direct_render, false) NSOPTION_BOOL(window_simple_refresh, false) NSOPTION_BOOL(resize_with_contents, false) diff --git a/amiga/plotters.c b/amiga/plotters.c index de9075552..cb7ccac78 100755 --- a/amiga/plotters.c +++ b/amiga/plotters.c @@ -71,11 +71,6 @@ bool palette_mapped = false; #define M_PI 3.14159265358979323846 #endif -#ifdef NS_AMIGA_CAIRO -#include -#include -#endif - #define PATT_DOT 0xAAAA #define PATT_DASH 0xCCCC #define PATT_LINE 0xFFFF @@ -102,42 +97,6 @@ const struct plotter_table amiplot = { .option_knockout = true, }; - -#ifdef NS_AMIGA_CAIRO -void ami_cairo_set_colour(cairo_t *cr,colour c) -{ - int r, g, b; - - r = c & 0xff; - g = (c & 0xff00) >> 8; - b = (c & 0xff0000) >> 16; - - cairo_set_source_rgba(glob->cr, r / 255.0, - g / 255.0, b / 255.0, 1.0); -} - -void ami_cairo_set_solid(cairo_t *cr) -{ - double dashes = 0; - - cairo_set_dash(glob->cr, &dashes, 0, 0); -} - -void ami_cairo_set_dotted(cairo_t *cr) -{ - double cdashes = 1; - - cairo_set_dash(glob->cr, &cdashes, 1, 0); -} - -void ami_cairo_set_dashed(cairo_t *cr) -{ - double cdashes = 3; - - cairo_set_dash(glob->cr, &cdashes, 1, 0); -} -#endif - void ami_init_layers(struct gui_globals *gg, ULONG width, ULONG height) { /* init shared bitmaps * @@ -148,7 +107,7 @@ void ami_init_layers(struct gui_globals *gg, ULONG width, ULONG height) struct BitMap *friend = NULL; depth = GetBitMapAttr(scrn->RastPort.BitMap, BMA_DEPTH); - if((depth < 16) || (nsoption_int(cairo_renderer) == -1)) { + if(depth < 16) { palette_mapped = true; } else { palette_mapped = false; @@ -195,19 +154,10 @@ void ami_init_layers(struct gui_globals *gg, ULONG width, ULONG height) if((!gg->tmprasbuf) || (!gg->rp->TmpRas)) warn_user("NoMemory",""); InitTmpRas(gg->rp->TmpRas, gg->tmprasbuf, width*height); - -#ifdef NS_AMIGA_CAIRO - gg->surface = cairo_amigaos_surface_create(gg->rp->BitMap); - gg->cr = cairo_create(gg->surface); -#endif } void ami_free_layers(struct gui_globals *gg) { -#ifdef NS_AMIGA_CAIRO - cairo_destroy(gg->cr); - cairo_surface_destroy(gg->surface); -#endif if(gg->rp) { DeleteLayer(0,gg->rp->Layer); @@ -309,90 +259,41 @@ bool ami_rectangle(int x0, int y0, int x1, int y1, const plot_style_t *style) #endif if (style->fill_type != PLOT_OP_TYPE_NONE) { - - if((nsoption_int(cairo_renderer) < 2) || - (palette_mapped == true)) - { - ami_plot_setapen(style->fill_colour); - RectFill(glob->rp, x0, y0, x1-1, y1-1); - } - else - { -#ifdef NS_AMIGA_CAIRO - ami_cairo_set_colour(glob->cr, style->fill_colour); - ami_cairo_set_solid(glob->cr); - - cairo_set_line_width(glob->cr, 0); - cairo_rectangle(glob->cr, x0, y0, x1 - x0, y1 - y0); - cairo_fill(glob->cr); - cairo_stroke(glob->cr); -#endif - } + ami_plot_setapen(style->fill_colour); + RectFill(glob->rp, x0, y0, x1-1, y1-1); } if (style->stroke_type != PLOT_OP_TYPE_NONE) { - if((nsoption_int(cairo_renderer) < 2) || - (palette_mapped == true)) - { - glob->rp->PenWidth = style->stroke_width; - glob->rp->PenHeight = style->stroke_width; + glob->rp->PenWidth = style->stroke_width; + glob->rp->PenHeight = style->stroke_width; - switch (style->stroke_type) { - case PLOT_OP_TYPE_SOLID: /**< Solid colour */ - default: - glob->rp->LinePtrn = PATT_LINE; - break; + switch (style->stroke_type) { + case PLOT_OP_TYPE_SOLID: /**< Solid colour */ + default: + glob->rp->LinePtrn = PATT_LINE; + break; - case PLOT_OP_TYPE_DOT: /**< Dotted plot */ - glob->rp->LinePtrn = PATT_DOT; - break; + case PLOT_OP_TYPE_DOT: /**< Dotted plot */ + glob->rp->LinePtrn = PATT_DOT; + break; - case PLOT_OP_TYPE_DASH: /**< dashed plot */ - glob->rp->LinePtrn = PATT_DASH; - break; - } + case PLOT_OP_TYPE_DASH: /**< dashed plot */ + glob->rp->LinePtrn = PATT_DASH; + break; + } - ami_plot_setapen(style->stroke_colour); - Move(glob->rp, x0,y0); - Draw(glob->rp, x1, y0); - Draw(glob->rp, x1, y1); - Draw(glob->rp, x0, y1); - Draw(glob->rp, x0, y0); + ami_plot_setapen(style->stroke_colour); + Move(glob->rp, x0,y0); + Draw(glob->rp, x1, y0); + Draw(glob->rp, x1, y1); + Draw(glob->rp, x0, y1); + Draw(glob->rp, x0, y0); - glob->rp->PenWidth = 1; - glob->rp->PenHeight = 1; - glob->rp->LinePtrn = PATT_LINE; - } - else - { -#ifdef NS_AMIGA_CAIRO - ami_cairo_set_colour(glob->cr, style->stroke_colour); - - switch (style->stroke_type) { - case PLOT_OP_TYPE_SOLID: /**< Solid colour */ - default: - ami_cairo_set_solid(glob->cr); - break; - - case PLOT_OP_TYPE_DOT: /**< Doted plot */ - ami_cairo_set_dotted(glob->cr); - break; - - case PLOT_OP_TYPE_DASH: /**< dashed plot */ - ami_cairo_set_dashed(glob->cr); - break; - } - - if (style->stroke_width == 0) - cairo_set_line_width(glob->cr, 1); - else - cairo_set_line_width(glob->cr, style->stroke_width); - - cairo_rectangle(glob->cr, x0, y0, x1 - x0, y1 - y0); - cairo_stroke(glob->cr); -#endif - } + glob->rp->PenWidth = 1; + glob->rp->PenHeight = 1; + glob->rp->LinePtrn = PATT_LINE; } + return true; } @@ -402,12 +303,10 @@ bool ami_line(int x0, int y0, int x1, int y1, const plot_style_t *style) LOG(("[ami_plotter] Entered ami_line()")); #endif - if((nsoption_int(cairo_renderer) < 2) || (palette_mapped == true)) - { - glob->rp->PenWidth = style->stroke_width; - glob->rp->PenHeight = style->stroke_width; + glob->rp->PenWidth = style->stroke_width; + glob->rp->PenHeight = style->stroke_width; - switch (style->stroke_type) { + switch (style->stroke_type) { case PLOT_OP_TYPE_SOLID: /**< Solid colour */ default: glob->rp->LinePtrn = PATT_LINE; @@ -420,50 +319,16 @@ bool ami_line(int x0, int y0, int x1, int y1, const plot_style_t *style) case PLOT_OP_TYPE_DASH: /**< dashed plot */ glob->rp->LinePtrn = PATT_DASH; break; - } - - ami_plot_setapen(style->stroke_colour); - Move(glob->rp,x0,y0); - Draw(glob->rp,x1,y1); - - glob->rp->PenWidth = 1; - glob->rp->PenHeight = 1; - glob->rp->LinePtrn = PATT_LINE; } - else - { -#ifdef NS_AMIGA_CAIRO - ami_cairo_set_colour(glob->cr, style->stroke_colour); - switch (style->stroke_type) { - case PLOT_OP_TYPE_SOLID: /**< Solid colour */ - default: - ami_cairo_set_solid(glob->cr); - break; + ami_plot_setapen(style->stroke_colour); + Move(glob->rp,x0,y0); + Draw(glob->rp,x1,y1); - case PLOT_OP_TYPE_DOT: /**< Doted plot */ - ami_cairo_set_dotted(glob->cr); - break; + glob->rp->PenWidth = 1; + glob->rp->PenHeight = 1; + glob->rp->LinePtrn = PATT_LINE; - case PLOT_OP_TYPE_DASH: /**< dashed plot */ - ami_cairo_set_dashed(glob->cr); - break; - } - - if (style->stroke_width == 0) - cairo_set_line_width(glob->cr, 1); - else - cairo_set_line_width(glob->cr, style->stroke_width); - - /* core expects horizontal and vertical lines to be on pixels, not - * between pixels */ - cairo_move_to(glob->cr, (x0 == x1) ? x0 + 0.5 : x0, - (y0 == y1) ? y0 + 0.5 : y0); - cairo_line_to(glob->cr, (x0 == x1) ? x1 + 0.5 : x1, - (y0 == y1) ? y1 + 0.5 : y1); - cairo_stroke(glob->cr); -#endif - } return true; } @@ -473,39 +338,21 @@ bool ami_polygon(const int *p, unsigned int n, const plot_style_t *style) LOG(("[ami_plotter] Entered ami_polygon()")); #endif - if((nsoption_int(cairo_renderer) < 1) || (palette_mapped == true)) - { - ULONG cx,cy; + ULONG cx,cy; - ami_plot_setapen(style->fill_colour); + ami_plot_setapen(style->fill_colour); - if(AreaMove(glob->rp,p[0],p[1]) == -1) - LOG(("AreaMove: vector list full")); + if(AreaMove(glob->rp,p[0],p[1]) == -1) + LOG(("AreaMove: vector list full")); - for(int k = 1; k < n; k++) - { - if(AreaDraw(glob->rp,p[k*2],p[(k*2)+1]) == -1) - LOG(("AreaDraw: vector list full")); - } - - if(AreaEnd(glob->rp) == -1) - LOG(("AreaEnd: error")); + for(int k = 1; k < n; k++) { + if(AreaDraw(glob->rp,p[k*2],p[(k*2)+1]) == -1) + LOG(("AreaDraw: vector list full")); } - else - { -#ifdef NS_AMIGA_CAIRO - ami_cairo_set_colour(glob->cr, style->fill_colour); - ami_cairo_set_solid(glob->cr); - cairo_set_line_width(glob->cr, 0); - cairo_move_to(glob->cr, p[0], p[1]); - for (int k = 1; k != n; k++) { - cairo_line_to(glob->cr, p[k * 2], p[k * 2 + 1]); - } - cairo_fill(glob->cr); - cairo_stroke(glob->cr); -#endif - } + if(AreaEnd(glob->rp) == -1) + LOG(("AreaEnd: error")); + return true; } @@ -534,16 +381,6 @@ bool ami_clip(const struct rect *clip) if(reg) DisposeRegion(reg); } -#ifdef NS_AMIGA_CAIRO - if((nsoption_int(cairo_renderer) == 2) && (palette_mapped == false)) - { - cairo_reset_clip(glob->cr); - cairo_rectangle(glob->cr, clip->x0, clip->y0, - clip->x1 - clip->x0, clip->y1 - clip->y0); - cairo_clip(glob->cr); - } -#endif - return true; } @@ -571,43 +408,17 @@ bool ami_disc(int x, int y, int radius, const plot_style_t *style) LOG(("[ami_plotter] Entered ami_disc()")); #endif - if((nsoption_int(cairo_renderer) < 2) || (palette_mapped == true)) - { - if (style->fill_type != PLOT_OP_TYPE_NONE) { - ami_plot_setapen(style->fill_colour); - AreaCircle(glob->rp,x,y,radius); - AreaEnd(glob->rp); - } - - if (style->stroke_type != PLOT_OP_TYPE_NONE) { - ami_plot_setapen(style->stroke_colour); - DrawEllipse(glob->rp,x,y,radius,radius); - } + if (style->fill_type != PLOT_OP_TYPE_NONE) { + ami_plot_setapen(style->fill_colour); + AreaCircle(glob->rp,x,y,radius); + AreaEnd(glob->rp); } - else - { -#ifdef NS_AMIGA_CAIRO - if (style->fill_type != PLOT_OP_TYPE_NONE) { - ami_cairo_set_colour(glob->cr, style->fill_colour); - ami_cairo_set_solid(glob->cr); - cairo_set_line_width(glob->cr, 0); - - cairo_arc(glob->cr, x, y, radius, 0, M_PI * 2); - cairo_fill(glob->cr); - cairo_stroke(glob->cr); - } - - if (style->stroke_type != PLOT_OP_TYPE_NONE) { - ami_cairo_set_colour(glob->cr, style->stroke_colour); - ami_cairo_set_solid(glob->cr); - - cairo_set_line_width(glob->cr, 1); - cairo_arc(glob->cr, x, y, radius, 0, M_PI * 2); - cairo_stroke(glob->cr); - } -#endif + if (style->stroke_type != PLOT_OP_TYPE_NONE) { + ami_plot_setapen(style->stroke_colour); + DrawEllipse(glob->rp,x,y,radius,radius); } + return true; } @@ -642,25 +453,10 @@ bool ami_arc(int x, int y, int radius, int angle1, int angle2, const plot_style_ LOG(("[ami_plotter] Entered ami_arc()")); #endif - if((nsoption_int(cairo_renderer) <= 0) || (palette_mapped == true)) { - - if (angle2 < angle1) angle2 += 360; + if (angle2 < angle1) angle2 += 360; - ami_plot_setapen(style->fill_colour); - - ami_arc_gfxlib(x, y, radius, angle1, angle2); - } else { -#ifdef NS_AMIGA_CAIRO - ami_cairo_set_colour(glob->cr, style->fill_colour); - ami_cairo_set_solid(glob->cr); - - cairo_set_line_width(glob->cr, 1); - cairo_arc(glob->cr, x, y, radius, - (angle1 + 90) * (M_PI / 180), - (angle2 + 90) * (M_PI / 180)); - cairo_stroke(glob->cr); -#endif - } + ami_plot_setapen(style->fill_colour); + ami_arc_gfxlib(x, y, radius, angle1, angle2); return true; } @@ -957,153 +753,83 @@ bool ami_path(const float *p, unsigned int n, colour fill, float width, return false; } - if((nsoption_int(cairo_renderer) >= 1) && (palette_mapped == false)) - { -#ifdef NS_AMIGA_CAIRO - cairo_matrix_t old_ctm, n_ctm; - - /* Save CTM */ - cairo_get_matrix(glob->cr, &old_ctm); - - /* Set up line style and width */ - cairo_set_line_width(glob->cr, 1); - ami_cairo_set_solid(glob->cr); - - /* Load new CTM */ - n_ctm.xx = transform[0]; - n_ctm.yx = transform[1]; - n_ctm.xy = transform[2]; - n_ctm.yy = transform[3]; - n_ctm.x0 = transform[4]; - n_ctm.y0 = transform[5]; - - cairo_set_matrix(glob->cr, &n_ctm); - - /* Construct path */ - for (i = 0; i < n; ) { - if (p[i] == PLOTTER_PATH_MOVE) { - cairo_move_to(glob->cr, p[i+1], p[i+2]); - i += 3; - } else if (p[i] == PLOTTER_PATH_CLOSE) { - cairo_close_path(glob->cr); - i++; - } else if (p[i] == PLOTTER_PATH_LINE) { - cairo_line_to(glob->cr, p[i+1], p[i+2]); - i += 3; - } else if (p[i] == PLOTTER_PATH_BEZIER) { - cairo_curve_to(glob->cr, p[i+1], p[i+2], - p[i+3], p[i+4], - p[i+5], p[i+6]); - i += 7; - } else { - LOG(("bad path command %f", p[i])); - /* Reset matrix for safety */ - cairo_set_matrix(glob->cr, &old_ctm); - return false; - } - } - - /* Restore original CTM */ - cairo_set_matrix(glob->cr, &old_ctm); - - /* Now draw path */ - if (fill != NS_TRANSPARENT) { - ami_cairo_set_colour(glob->cr,fill); - - if (c != NS_TRANSPARENT) { - /* Fill & Stroke */ - cairo_fill_preserve(glob->cr); - ami_cairo_set_colour(glob->cr,c); - cairo_stroke(glob->cr); - } else { - /* Fill only */ - cairo_fill(glob->cr); - } - } else if (c != NS_TRANSPARENT) { - /* Stroke only */ - ami_cairo_set_colour(glob->cr,c); - cairo_stroke(glob->cr); - } -#endif + if (fill != NS_TRANSPARENT) { + ami_plot_setapen(fill); + if (c != NS_TRANSPARENT) + ami_plot_setopen(c); } else { - if (fill != NS_TRANSPARENT) { - ami_plot_setapen(fill); - if (c != NS_TRANSPARENT) - ami_plot_setopen(c); + if (c != NS_TRANSPARENT) { + ami_plot_setapen(c); } else { - if (c != NS_TRANSPARENT) { - ami_plot_setapen(c); - } else { - return true; /* wholly transparent */ - } + return true; /* wholly transparent */ } + } - /* Construct path */ - for (i = 0; i < n; ) { - if (p[i] == PLOTTER_PATH_MOVE) { + /* Construct path */ + for (i = 0; i < n; ) { + if (p[i] == PLOTTER_PATH_MOVE) { + if (fill != NS_TRANSPARENT) { + if(AreaMove(glob->rp, p[i+1], p[i+2]) == -1) + LOG(("AreaMove: vector list full")); + } else { + Move(glob->rp, p[i+1], p[i+2]); + } + /* Keep track for future Bezier curves/closes etc */ + start_p.x = p[i+1]; + start_p.y = p[i+2]; + cur_p.x = start_p.x; + cur_p.y = start_p.y; + i += 3; + } else if (p[i] == PLOTTER_PATH_CLOSE) { + if (fill != NS_TRANSPARENT) { + if(AreaEnd(glob->rp) == -1) + LOG(("AreaEnd: error")); + } else { + Draw(glob->rp, start_p.x, start_p.y); + } + i++; + } else if (p[i] == PLOTTER_PATH_LINE) { + if (fill != NS_TRANSPARENT) { + if(AreaDraw(glob->rp, p[i+1], p[i+2]) == -1) + LOG(("AreaDraw: vector list full")); + } else { + Draw(glob->rp, p[i+1], p[i+2]); + } + cur_p.x = p[i+1]; + cur_p.y = p[i+2]; + i += 3; + } else if (p[i] == PLOTTER_PATH_BEZIER) { + p_a.x = p[i+1]; + p_a.y = p[i+2]; + p_b.x = p[i+3]; + p_b.y = p[i+4]; + p_c.x = p[i+5]; + p_c.y = p[i+6]; + + for(double t = 0.0; t <= 1.0; t += 0.1) { + ami_bezier(&cur_p, &p_a, &p_b, &p_c, t, &p_r); if (fill != NS_TRANSPARENT) { - if(AreaMove(glob->rp, p[i+1], p[i+2]) == -1) - LOG(("AreaMove: vector list full")); - } else { - Move(glob->rp, p[i+1], p[i+2]); - } - /* Keep track for future Bezier curves/closes etc */ - start_p.x = p[i+1]; - start_p.y = p[i+2]; - cur_p.x = start_p.x; - cur_p.y = start_p.y; - i += 3; - } else if (p[i] == PLOTTER_PATH_CLOSE) { - if (fill != NS_TRANSPARENT) { - if(AreaEnd(glob->rp) == -1) - LOG(("AreaEnd: error")); - } else { - Draw(glob->rp, start_p.x, start_p.y); - } - i++; - } else if (p[i] == PLOTTER_PATH_LINE) { - if (fill != NS_TRANSPARENT) { - if(AreaDraw(glob->rp, p[i+1], p[i+2]) == -1) + if(AreaDraw(glob->rp, p_r.x, p_r.y) == -1) LOG(("AreaDraw: vector list full")); } else { - Draw(glob->rp, p[i+1], p[i+2]); + Draw(glob->rp, p_r.x, p_r.y); } - cur_p.x = p[i+1]; - cur_p.y = p[i+2]; - i += 3; - } else if (p[i] == PLOTTER_PATH_BEZIER) { - p_a.x = p[i+1]; - p_a.y = p[i+2]; - p_b.x = p[i+3]; - p_b.y = p[i+4]; - p_c.x = p[i+5]; - p_c.y = p[i+6]; - - for(double t = 0.0; t <= 1.0; t += 0.1) { - ami_bezier(&cur_p, &p_a, &p_b, &p_c, t, &p_r); - if (fill != NS_TRANSPARENT) { - if(AreaDraw(glob->rp, p_r.x, p_r.y) == -1) - LOG(("AreaDraw: vector list full")); - } else { - Draw(glob->rp, p_r.x, p_r.y); - } - } - cur_p.x = p_c.x; - cur_p.y = p_c.y; - i += 7; - } else { - LOG(("bad path command %f", p[i])); - /* End path for safety if using Area commands */ - if (fill != NS_TRANSPARENT) { - AreaEnd(glob->rp); - BNDRYOFF(glob->rp); - } - return false; } + cur_p.x = p_c.x; + cur_p.y = p_c.y; + i += 7; + } else { + LOG(("bad path command %f", p[i])); + /* End path for safety if using Area commands */ + if (fill != NS_TRANSPARENT) { + AreaEnd(glob->rp); + BNDRYOFF(glob->rp); + } + return false; } - if (fill != NS_TRANSPARENT) - BNDRYOFF(glob->rp); } + if (fill != NS_TRANSPARENT) + BNDRYOFF(glob->rp); return true; } @@ -1112,3 +838,4 @@ bool ami_plot_screen_is_palettemapped(void) { return palette_mapped; } + diff --git a/amiga/plotters.h b/amiga/plotters.h index db767b60a..501698a41 100755 --- a/amiga/plotters.h +++ b/amiga/plotters.h @@ -21,9 +21,6 @@ #include "desktop/plotters.h" #include #include -#ifdef NS_AMIGA_CAIRO -#include -#endif struct gui_globals { @@ -34,10 +31,6 @@ struct gui_globals APTR tmprasbuf; struct Rectangle rect; struct MinList *shared_pens; -#ifdef NS_AMIGA_CAIRO - cairo_surface_t *surface; - cairo_t *cr; -#endif }; extern const struct plotter_table amiplot;