Remove Cairo from AmigaOS frontend.

This commit is contained in:
Chris Young 2014-05-03 16:38:58 +01:00
parent 0c5c7159d8
commit b1f67dab31
10 changed files with 143 additions and 562 deletions

View File

@ -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 This document provides instructions for building the AmigaOS version of
@ -75,9 +75,6 @@
http://www.os4depot.net/share/development/library/misc/libcurl.lha 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 libpng
@ -88,9 +85,6 @@
http://www.os4depot.net/share/development/library/graphics/libpng.lha 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 OpenSSL
--------- ---------
@ -99,11 +93,6 @@
http://www.os4depot.net/share/development/library/misc/libopenssl.lha 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 Libharu
--------- ---------
@ -138,12 +127,3 @@
Experimental Javascript support requires Spidermonkey. The patches to Experimental Javascript support requires Spidermonkey. The patches to
build v1.7 are available from the NetSurf toolchains Git repository. 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.

View File

@ -26,12 +26,6 @@ NETSURF_USE_AMIGA_DATATYPES := YES
# Valid options: YES, NO # Valid options: YES, NO
NETSURF_USE_NSSVG := YES 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+ # Enable NetSurf's use of Spidermonkey 1.80+
# Only here to stop the build complaining; # Only here to stop the build complaining;
# enable NETSURF_USE_MOZJS instead for JavaScript support # enable NETSURF_USE_MOZJS instead for JavaScript support
@ -40,3 +34,4 @@ NETSURF_USE_JS := NO
# Optimisation levels # Optimisation levels
CFLAGS += -O2 -gstabs CFLAGS += -O2 -gstabs

View File

@ -15,7 +15,6 @@ NETSURF_FEATURE_PNG_CFLAGS := -DWITH_PNG
NETSURF_FEATURE_WEBP_CFLAGS := -DWITH_WEBP NETSURF_FEATURE_WEBP_CFLAGS := -DWITH_WEBP
NETSURF_FEATURE_NSSVG_CFLAGS := -DWITH_NS_SVG NETSURF_FEATURE_NSSVG_CFLAGS := -DWITH_NS_SVG
NETSURF_FEATURE_VIDEO_CFLAGS := -DWITH_VIDEO NETSURF_FEATURE_VIDEO_CFLAGS := -DWITH_VIDEO
NETSURF_FEATURE_AMIGA_CAIRO_CFLAGS := -DNS_AMIGA_CAIRO
ifeq ($(HOST),amiga) ifeq ($(HOST),amiga)
$(eval $(call feature_enabled,ROSPRITE,-DWITH_NSSPRITE,-lrosprite,Sprite (librosprite))) $(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,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,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,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_ICON,-DWITH_AMIGA_ICON,,Amiga icon))
$(eval $(call feature_enabled,AMIGA_DATATYPES,-DWITH_AMIGA_DATATYPES,,DataTypes)) $(eval $(call feature_enabled,AMIGA_DATATYPES,-DWITH_AMIGA_DATATYPES,,DataTypes))
CFLAGS += -I /SDK/local/common/include/libpng12 CFLAGS += -I /SDK/local/common/include/libpng12
LDFLAGS += -lcurl -lrtmp -lpthread -ltre -lintl -lauto -lpbl LDFLAGS += -lcurl -lrtmp -lpthread -ltre -lintl -lauto -lpbl
LDFLAGS += -lssl -lcrypto -ldom -lhubbub -lcss -lparserutils -lwapcaplet 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 else
$(eval $(call pkg_config_find_and_add_enabled,ROSPRITE,librosprite,Sprite)) $(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,BMP,libnsbmp,BMP))
$(eval $(call pkg_config_find_and_add_enabled,GIF,libnsgif,GIF)) $(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,PNG,libpng,PNG))
$(eval $(call pkg_config_find_and_add_enabled,NSSVG,libsvgtiny,NSSVG)) $(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,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_ICON,-DWITH_AMIGA_ICON,,Amiga icon))
$(eval $(call feature_enabled,AMIGA_DATATYPES,-DWITH_AMIGA_DATATYPES,,DataTypes)) $(eval $(call feature_enabled,AMIGA_DATATYPES,-DWITH_AMIGA_DATATYPES,,DataTypes))

118
amiga/dist/Install vendored
View File

@ -309,72 +309,9 @@
(set #icon-exists (exists (tackon @default-dest "NetSurf.info"))) (set #icon-exists (exists (tackon @default-dest "NetSurf.info")))
(set osver (getversion)) (set osver (getversion))
(set osver (/ osver 65536)) (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) (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")) (set #user (getenv "user"))
(if (= #user "") (set #user "Default")) (if (= #user "") (set #user "Default"))
@ -415,7 +352,7 @@
) )
) )
(complete 18) (complete 15)
(if (>= osver 53) (if (>= osver 53)
( (
@ -436,7 +373,7 @@
) )
) )
(complete 19) (complete 20)
(set #runfixfonts (set #runfixfonts
(askbool (askbool
@ -449,9 +386,7 @@
) )
) )
(complete 20) (complete 25)
(set #netsurf-name (select #cairo-version #static-filename #cairo-filename))
(working "Installing NetSurf") (working "Installing NetSurf")
@ -460,7 +395,7 @@
(copyfiles (copyfiles
(prompt "Copying NetSurf...") (prompt "Copying NetSurf...")
(help @copyfiles-help) (help @copyfiles-help)
(source #netsurf-name) (source "NetSurf")
(dest @default-dest) (dest @default-dest)
(newname "NetSurf") (newname "NetSurf")
(optional "askuser" "force" "oknodelete") (optional "askuser" "force" "oknodelete")
@ -473,7 +408,7 @@
) )
) )
(complete 30) (complete 40)
(if #searchengines-exist (if #searchengines-exist
(rename (tackon @default-dest "Resources/SearchEngines") (tackon @default-dest "Resources/SearchEngines.backup")) (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/ViewSource.nsrx \"View source\"")
(run "c:filenote Rexx/GetVideo.nsrx \"Get video\"") (run "c:filenote Rexx/GetVideo.nsrx \"Get video\"")
(complete 50)
(copyfiles (copyfiles
(prompt "Copying files") (prompt "Copying files")
(source "") (source "")
@ -494,6 +431,8 @@
; (all) ; (all)
) )
(complete 65)
(copyfiles (copyfiles
(prompt "Copying additional documentation") (prompt "Copying additional documentation")
(source "") (source "")
@ -504,34 +443,7 @@
(optional "nofail") (optional "nofail")
) )
(set #complete 40) (complete 70)
(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)
(if #themeshort (if #themeshort
( (
@ -578,7 +490,7 @@
) )
) )
(complete 95) (complete 75)
(if (= (exists "ENVARC:Sys/def_css.info") 0) (if (= (exists "ENVARC:Sys/def_css.info") 0)
(copyfiles (copyfiles
@ -591,7 +503,7 @@
) )
) )
(complete 96) (complete 80)
(working "Setting MIME types") (working "Setting MIME types")
(p_setmimetype "css" "text/css") (p_setmimetype "css" "text/css")
@ -611,7 +523,7 @@
(p_setmimetype "zip" "application/x-zip") (p_setmimetype "zip" "application/x-zip")
(p_setmimetype "js" "application/javascript") (p_setmimetype "js" "application/javascript")
(complete 97) (complete 85)
(if (>= osver 53) (if (>= osver 53)
(if (= (exists "Rexx:NetSurf") 0) (if (= (exists "Rexx:NetSurf") 0)
@ -659,7 +571,7 @@
) )
) )
(complete 98) (complete 90)
(if (= #addlaunchhandler 1) (if (= #addlaunchhandler 1)
( (
@ -691,7 +603,7 @@
) )
) )
(complete 99) (complete 95)
(working "Running FixFonts") (working "Running FixFonts")

View File

@ -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}kiosk_mode@{ub} No gadgets
@{b}printer_unit@{ub} Specifies which printer.device unit to print to @{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}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}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}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" @{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) @{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} 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}, 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} @{lindent 2}* In @{"Options" link Options}, set font_antialiasing:0@{lindent}

View File

@ -556,11 +556,6 @@ static nserror ami_set_options(struct nsoption_s *defaults)
nsoption_set_bool(core_select_menu, true); 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)) || if((!nsoption_charp(accept_language)) ||
(nsoption_charp(accept_language)[0] == '\0') || (nsoption_charp(accept_language)[0] == '\0') ||
(nsoption_bool(accept_lang_locale) == true)) (nsoption_bool(accept_lang_locale) == true))

View File

@ -788,18 +788,9 @@ static void ami_menu_item_project_about(struct Hook *hook, APTR window, struct I
TDR_TitleString, messages_get("NetSurf"), TDR_TitleString, messages_get("NetSurf"),
TDR_Window, gwin->win, TDR_Window, gwin->win,
TDR_GadgetString, temp2, TDR_GadgetString, temp2,
#ifndef NDEBUG TDR_FormatString,"NetSurf %s\nBuild date %s\n\nhttp://www.netsurf-browser.org",
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_Arg1,netsurf_version, TDR_Arg1,netsurf_version,
#ifdef NS_AMIGA_CAIRO TDR_Arg2,verdate,
TDR_Arg2,"Cairo (OS4.1+) SObjs build",
#else
TDR_Arg2,"graphics.library static build",
#endif
TDR_Arg3,verdate,
TAG_DONE); TAG_DONE);
free(temp2); free(temp2);

View File

@ -77,7 +77,6 @@ NSOPTION_INTEGER(cookies_window_ypos, 0)
NSOPTION_INTEGER(cookies_window_xsize, 0) NSOPTION_INTEGER(cookies_window_xsize, 0)
NSOPTION_INTEGER(cookies_window_ysize, 0) NSOPTION_INTEGER(cookies_window_ysize, 0)
NSOPTION_INTEGER(web_search_width, 0) NSOPTION_INTEGER(web_search_width, 0)
NSOPTION_INTEGER(cairo_renderer, 0)
NSOPTION_BOOL(direct_render, false) NSOPTION_BOOL(direct_render, false)
NSOPTION_BOOL(window_simple_refresh, false) NSOPTION_BOOL(window_simple_refresh, false)
NSOPTION_BOOL(resize_with_contents, false) NSOPTION_BOOL(resize_with_contents, false)

View File

@ -71,11 +71,6 @@ bool palette_mapped = false;
#define M_PI 3.14159265358979323846 #define M_PI 3.14159265358979323846
#endif #endif
#ifdef NS_AMIGA_CAIRO
#include <cairo/cairo.h>
#include <cairo/cairo-amigaos.h>
#endif
#define PATT_DOT 0xAAAA #define PATT_DOT 0xAAAA
#define PATT_DASH 0xCCCC #define PATT_DASH 0xCCCC
#define PATT_LINE 0xFFFF #define PATT_LINE 0xFFFF
@ -102,42 +97,6 @@ const struct plotter_table amiplot = {
.option_knockout = true, .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) void ami_init_layers(struct gui_globals *gg, ULONG width, ULONG height)
{ {
/* init shared bitmaps * /* init shared bitmaps *
@ -148,7 +107,7 @@ void ami_init_layers(struct gui_globals *gg, ULONG width, ULONG height)
struct BitMap *friend = NULL; struct BitMap *friend = NULL;
depth = GetBitMapAttr(scrn->RastPort.BitMap, BMA_DEPTH); depth = GetBitMapAttr(scrn->RastPort.BitMap, BMA_DEPTH);
if((depth < 16) || (nsoption_int(cairo_renderer) == -1)) { if(depth < 16) {
palette_mapped = true; palette_mapped = true;
} else { } else {
palette_mapped = false; 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",""); if((!gg->tmprasbuf) || (!gg->rp->TmpRas)) warn_user("NoMemory","");
InitTmpRas(gg->rp->TmpRas, gg->tmprasbuf, width*height); 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) 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) if(gg->rp)
{ {
DeleteLayer(0,gg->rp->Layer); DeleteLayer(0,gg->rp->Layer);
@ -309,31 +259,11 @@ bool ami_rectangle(int x0, int y0, int x1, int y1, const plot_style_t *style)
#endif #endif
if (style->fill_type != PLOT_OP_TYPE_NONE) { if (style->fill_type != PLOT_OP_TYPE_NONE) {
if((nsoption_int(cairo_renderer) < 2) ||
(palette_mapped == true))
{
ami_plot_setapen(style->fill_colour); ami_plot_setapen(style->fill_colour);
RectFill(glob->rp, x0, y0, x1-1, y1-1); 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
}
}
if (style->stroke_type != PLOT_OP_TYPE_NONE) { 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->PenWidth = style->stroke_width;
glob->rp->PenHeight = style->stroke_width; glob->rp->PenHeight = style->stroke_width;
@ -363,36 +293,7 @@ bool ami_rectangle(int x0, int y0, int x1, int y1, const plot_style_t *style)
glob->rp->PenHeight = 1; glob->rp->PenHeight = 1;
glob->rp->LinePtrn = PATT_LINE; 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
}
}
return true; return true;
} }
@ -402,8 +303,6 @@ bool ami_line(int x0, int y0, int x1, int y1, const plot_style_t *style)
LOG(("[ami_plotter] Entered ami_line()")); LOG(("[ami_plotter] Entered ami_line()"));
#endif #endif
if((nsoption_int(cairo_renderer) < 2) || (palette_mapped == true))
{
glob->rp->PenWidth = style->stroke_width; glob->rp->PenWidth = style->stroke_width;
glob->rp->PenHeight = style->stroke_width; glob->rp->PenHeight = style->stroke_width;
@ -429,41 +328,7 @@ bool ami_line(int x0, int y0, int x1, int y1, const plot_style_t *style)
glob->rp->PenWidth = 1; glob->rp->PenWidth = 1;
glob->rp->PenHeight = 1; glob->rp->PenHeight = 1;
glob->rp->LinePtrn = PATT_LINE; 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);
/* 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; return true;
} }
@ -473,8 +338,6 @@ bool ami_polygon(const int *p, unsigned int n, const plot_style_t *style)
LOG(("[ami_plotter] Entered ami_polygon()")); LOG(("[ami_plotter] Entered ami_polygon()"));
#endif #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);
@ -482,30 +345,14 @@ bool ami_polygon(const int *p, unsigned int n, const plot_style_t *style)
if(AreaMove(glob->rp,p[0],p[1]) == -1) if(AreaMove(glob->rp,p[0],p[1]) == -1)
LOG(("AreaMove: vector list full")); LOG(("AreaMove: vector list full"));
for(int k = 1; k < n; k++) for(int k = 1; k < n; k++) {
{
if(AreaDraw(glob->rp,p[k*2],p[(k*2)+1]) == -1) if(AreaDraw(glob->rp,p[k*2],p[(k*2)+1]) == -1)
LOG(("AreaDraw: vector list full")); LOG(("AreaDraw: vector list full"));
} }
if(AreaEnd(glob->rp) == -1) if(AreaEnd(glob->rp) == -1)
LOG(("AreaEnd: error")); LOG(("AreaEnd: error"));
}
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
}
return true; return true;
} }
@ -534,16 +381,6 @@ bool ami_clip(const struct rect *clip)
if(reg) DisposeRegion(reg); 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; return true;
} }
@ -571,8 +408,6 @@ bool ami_disc(int x, int y, int radius, const plot_style_t *style)
LOG(("[ami_plotter] Entered ami_disc()")); LOG(("[ami_plotter] Entered ami_disc()"));
#endif #endif
if((nsoption_int(cairo_renderer) < 2) || (palette_mapped == true))
{
if (style->fill_type != PLOT_OP_TYPE_NONE) { if (style->fill_type != PLOT_OP_TYPE_NONE) {
ami_plot_setapen(style->fill_colour); ami_plot_setapen(style->fill_colour);
AreaCircle(glob->rp,x,y,radius); AreaCircle(glob->rp,x,y,radius);
@ -583,31 +418,7 @@ bool ami_disc(int x, int y, int radius, const plot_style_t *style)
ami_plot_setapen(style->stroke_colour); ami_plot_setapen(style->stroke_colour);
DrawEllipse(glob->rp,x,y,radius,radius); DrawEllipse(glob->rp,x,y,radius,radius);
} }
}
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
}
return true; 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()")); LOG(("[ami_plotter] Entered ami_arc()"));
#endif #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_plot_setapen(style->fill_colour);
ami_arc_gfxlib(x, y, radius, angle1, angle2); 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
}
return true; return true;
} }
@ -957,75 +753,6 @@ bool ami_path(const float *p, unsigned int n, colour fill, float width,
return false; 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
} else {
if (fill != NS_TRANSPARENT) { if (fill != NS_TRANSPARENT) {
ami_plot_setapen(fill); ami_plot_setapen(fill);
if (c != NS_TRANSPARENT) if (c != NS_TRANSPARENT)
@ -1103,7 +830,6 @@ bool ami_path(const float *p, unsigned int n, colour fill, float width,
} }
if (fill != NS_TRANSPARENT) if (fill != NS_TRANSPARENT)
BNDRYOFF(glob->rp); BNDRYOFF(glob->rp);
}
return true; return true;
} }
@ -1112,3 +838,4 @@ bool ami_plot_screen_is_palettemapped(void)
{ {
return palette_mapped; return palette_mapped;
} }

View File

@ -21,9 +21,6 @@
#include "desktop/plotters.h" #include "desktop/plotters.h"
#include <proto/layers.h> #include <proto/layers.h>
#include <proto/graphics.h> #include <proto/graphics.h>
#ifdef NS_AMIGA_CAIRO
#include <cairo/cairo.h>
#endif
struct gui_globals struct gui_globals
{ {
@ -34,10 +31,6 @@ struct gui_globals
APTR tmprasbuf; APTR tmprasbuf;
struct Rectangle rect; struct Rectangle rect;
struct MinList *shared_pens; struct MinList *shared_pens;
#ifdef NS_AMIGA_CAIRO
cairo_surface_t *surface;
cairo_t *cr;
#endif
}; };
extern const struct plotter_table amiplot; extern const struct plotter_table amiplot;