NETSURF_USE_DRAW should apply to the Draw content handler only.

Introduce NETSURF_USE_DRAW_EXPORT to toggle draw export support.
Fix up a bunch of stuff related to this.
Fix warnings caused by disabling the Sprite renderer.

svn path=/trunk/netsurf/; revision=7899
This commit is contained in:
John Mark Bell 2009-06-20 19:38:56 +00:00
parent 397e2cc0a9
commit 6dd385591d
8 changed files with 28 additions and 5 deletions

View File

@ -260,10 +260,11 @@ ifeq ($(TARGET),riscos)
endif
$(eval $(call feature_enabled,NSSVG,-DWITH_NS_SVG,-lsvgtiny,SVG rendering))
$(eval $(call feature_enabled,DRAW,-DWITH_DRAW,-lpencil,Drawfile export))
$(eval $(call feature_enabled,DRAW,-DWITH_DRAW,,RISC OS Draw rendering))
$(eval $(call feature_enabled,SPRITE,-DWITH_SPRITE,,RISC OS sprite rendering))
$(eval $(call feature_enabled,ARTWORKS,-DWITH_ARTWORKS,,ArtWorks rendering))
$(eval $(call feature_enabled,PLUGINS,-DWITH_PLUGIN,,Plugin protocol support))
$(eval $(call feature_enabled,DRAW_EXPORT,-DWITH_DRAW_EXPORT,-lpencil,Drawfile export))
ifeq ($(HOST),riscos)
$(eval $(call feature_enabled,BMP,-DWITH_BMP,-lnsbmp,NetSurf BMP decoder))
$(eval $(call feature_enabled,GIF,-DWITH_GIF,-lnsgif,NetSurf GIF decoder))

View File

@ -85,7 +85,7 @@ ifeq ($(TARGET),riscos)
# Valid options: YES, NO
NETSURF_USE_NSSVG := YES
# Enable NetSurf's use of pencil for Drawfile export
# Enable NetSurf's support for displaying RISC OS Draw files
# Valid options: YES, NO
NETSURF_USE_DRAW := YES
@ -101,6 +101,10 @@ ifeq ($(TARGET),riscos)
# Valid options: YES, NO
NETSURF_USE_PLUGINS := NO
# Enable NetSurf's use of pencil for Drawfile export
# Valid options: YES, NO
NETSURF_USE_DRAW_EXPORT := YES
# Optimisation levels
CFLAGS += -O2 -Wuninitialized

View File

@ -181,7 +181,9 @@ void ro_gui_menu_init(void)
{ "Page.Save", BROWSER_SAVE, &dialog_saveas },
{ "Page.SaveComp", BROWSER_SAVE_COMPLETE, &dialog_saveas },
{ "Page.Export", NO_ACTION, 0 },
#ifdef WITH_DRAW_EXPORT
{ "Page.Export.Draw", BROWSER_EXPORT_DRAW, &dialog_saveas },
#endif
#ifdef WITH_PDF_EXPORT
{ "Page.Export.PDF", BROWSER_EXPORT_PDF, &dialog_saveas },
#endif
@ -200,7 +202,9 @@ void ro_gui_menu_init(void)
{ "Object.Object.ObjSave", BROWSER_OBJECT_SAVE, &dialog_saveas },
{ "Object.Object.Export", BROWSER_OBJECT_EXPORT, 0 },
{ "Object.Object.Export.Sprite", BROWSER_OBJECT_EXPORT_SPRITE, &dialog_saveas },
#ifdef WITH_DRAW_EXPORT
{ "Object.Object.Export.ObjDraw", BROWSER_OBJECT_EXPORT_DRAW, &dialog_saveas },
#endif
{ "Object.Object.SaveURL", NO_ACTION, 0 },
{ "Object.Object.SaveURL.URI", BROWSER_OBJECT_SAVE_URL_URI, &dialog_saveas },
{ "Object.Object.SaveURL.URL", BROWSER_OBJECT_SAVE_URL_URL, &dialog_saveas },

View File

@ -833,8 +833,10 @@ bool ro_gui_save_content(struct content *c, char *path, bool force_overwrite)
}
switch (gui_save_current_type) {
#ifdef WITH_DRAW_EXPORT
case GUI_SAVE_DRAW:
return save_as_draw(c, path);
#endif
#ifdef WITH_PDF_EXPORT
case GUI_SAVE_PDF:
return save_as_pdf(c, path);

View File

@ -22,6 +22,8 @@
* Export a content as a DrawFile (implementation).
*/
#ifdef WITH_DRAW_EXPORT
#include <assert.h>
#include <limits.h>
#include "oslib/draw.h"
@ -460,3 +462,5 @@ bool ro_save_draw_error(pencil_code code)
return false;
}
#endif

View File

@ -19,9 +19,13 @@
#ifndef _NETSURF_RISCOS_SAVE_DRAW_H_
#define _NETSURF_RISCOS_SAVE_DRAW_H_
#ifdef WITH_DRAW_EXPORT
#include <stdbool.h>
struct content;
bool save_as_draw(struct content *c, const char *path);
#endif
#endif

View File

@ -139,7 +139,8 @@ bool sprite_redraw(struct content *c, int x, int y,
byte sprite_bpp(const osspriteop_header *s)
{
/* bit 31 indicates the presence of a full alpha channel rather than a binary mask */
/* bit 31 indicates the presence of a full alpha channel
* rather than a binary mask */
int type = ((unsigned)s->mode >> osspriteop_TYPE_SHIFT) & 15;
byte bpp = 0;
@ -148,8 +149,10 @@ byte sprite_bpp(const osspriteop_header *s)
{
bits psr;
int val;
if (!xos_read_mode_variable(s->mode, os_MODEVAR_LOG2_BPP, &val, &psr) &&
!(psr & _C)) bpp = 1 << val;
if (!xos_read_mode_variable(s->mode,
os_MODEVAR_LOG2_BPP, &val, &psr) &&
!(psr & _C))
bpp = 1 << val;
}
break;
case osspriteop_TYPE1BPP: bpp = 1; break;

View File

@ -61,6 +61,7 @@
#include "riscos/options.h"
#include "riscos/oslib_pre7.h"
#include "riscos/save.h"
#include "riscos/sprite.h"
#include "riscos/theme.h"
#include "riscos/thumbnail.h"
#include "riscos/url_complete.h"