amigaos4 #1

Open
walkero wants to merge 4 commits from amigaos4 into master
4 changed files with 504 additions and 87 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
*.o

View File

@ -4,14 +4,14 @@
CXX = g++ CXX = g++
CXXFLAGS = -mcrt=clib2 -O3 -Iinclude -Igpc -Ifont_freetype CXXFLAGS = -mcrt=clib2 -O3 -Iinclude -Igpc -Ifont_freetype
CXXLIBS = -Llib -lagg CXXLIBS = -Llib -lagg -athread=native
CC = gcc CC = gcc
CFLAGS = -mcrt=clib2 -O3 -Igpc CFLAGS = -mcrt=clib2 -O3 -Igpc
AR = ar AR = ar
ARFLAGS = cr ARFLAGS = cr
STRIP = strip -R.comment STRIP = strip -R.comment
LIBNAME = lib/libagg.a LIBNAME = lib/libagg-clib2.a
SVGNAME = bin/svg_test SVGNAME = bin/svg_test
EXAMPLES =\ EXAMPLES =\
@ -170,7 +170,9 @@ freetype: lib $(FREETYPE_EXAMPLES)
clean: clean:
-@Delete *>NIL: FORCE QUIET examples/#?.o -@Delete *>NIL: FORCE QUIET examples/#?.o
-@Delete *>NIL: FORCE QUIET $(PLATFORM_OBJ) $(FREETYPE_OBJ) $(LIB_OBJ) $(SVG_OBJ) -@Delete *>NIL: FORCE QUIET $(PLATFORM_OBJ) $(FREETYPE_OBJ) $(LIB_OBJ) $(SVG_OBJ)
-@Delete *>NIL: FORCE QUIET ALL lib bin -@copy CLONE ALL bin/#?.cmake#? T:agg_tmp
-@Delete *>NIL: FORCE QUIET ALL bin
-@copy CLONE T:agg_tmp/#? bin
install: lib install: lib
-@Copy CLONE $(LIBNAME) SDK:Local/clib2/lib -@Copy CLONE $(LIBNAME) SDK:Local/clib2/lib
@ -366,24 +368,14 @@ bin/trans_curve2_ft: examples/trans_curve2_ft.o examples/interactive_polygon.o $
# Examples files # Examples files
# #
wget: wget:
wget http://www.antigrain.com/svg/tiger.svg cp examples/art/tiger.svg bin
move tiger.svg bin cp examples/art/agg.bmp bin
wget http://www.antigrain.com/agg.bmp cp examples/art/compositing.bmp bin
move agg.bmp bin cp examples/art/spheres.bmp bin
wget http://www.antigrain.com/compositing.bmp cp examples/art/shapes.txt bin
move compositing.bmp bin cp examples/art/1.sdf bin
wget http://www.antigrain.com/spheres.bmp xadunfile examples/art/line_patterns.bmp.zip bin overwrite
move spheres.bmp bin xadunfile examples/art/timesi.zip bin overwrite
wget http://www.antigrain.com/shapes.txt
move shapes.txt bin
wget http://www.antigrain.com/1.sdf
move 1.sdf bin
wget http://www.antigrain.com/line_patterns.bmp.zip
xadunfile line_patterns.bmp.zip bin overwrite
delete line_patterns.bmp.zip
wget http://www.antigrain.com/timesi.zip
xadunfile timesi.zip bin overwrite
delete timesi.zip
# #
@ -396,3 +388,4 @@ wget:
%.o: %.c %.o: %.c
@MakeDir lib bin force @MakeDir lib bin force
$(CC) -c $(CFLAGS) $< -o $@ $(CC) -c $(CFLAGS) $< -o $@

412
Makefile.AmigaOS-newlib Normal file
View File

@ -0,0 +1,412 @@
#
# Makefile for AmigaOS 4.0
# compile with newlib
#
CXX = g++
CXXFLAGS = -mcrt=newlib -O3 -Iinclude -Igpc -Ifont_freetype
CXXLIBS = -Llib -lagg -athread=native
CC = gcc
CFLAGS = -mcrt=newlib -O3 -Igpc
AR = ar
ARFLAGS = cr
STRIP = strip -R.comment
LIBNAME = lib/libagg-newlib.a
SVGNAME = bin/svg_test
EXAMPLES =\
bin/aa_demo \
bin/aa_test \
bin/alpha_gradient \
bin/alpha_mask \
bin/alpha_mask2 \
bin/alpha_mask3 \
bin/bezier_div \
bin/bspline \
bin/circles \
bin/component_rendering \
bin/compositing \
bin/compositing2 \
bin/conv_contour \
bin/conv_dash_marker \
bin/conv_stroke \
bin/distortions \
bin/flash_rasterizer \
bin/flash_rasterizer2 \
bin/gamma_correction \
bin/gamma_ctrl \
bin/gamma_tuner \
bin/gouraud \
bin/gouraud_mesh \
bin/gpc_test \
bin/gradients \
bin/graph_test \
bin/idea \
bin/image_alpha \
bin/image_filters \
bin/image_filters2 \
bin/image_fltr_graph \
bin/image_perspective \
bin/image_resample \
bin/image_transforms \
bin/image1 \
bin/line_patterns_clip \
bin/line_patterns \
bin/lion \
bin/lion_lens \
bin/lion_outline \
bin/mol_view \
bin/multi_clip \
bin/pattern_fill \
bin/pattern_perspective \
bin/pattern_resample \
bin/perspective \
bin/polymorphic_renderer \
bin/raster_text \
bin/rasterizers \
bin/rasterizers2 \
bin/rounded_rect \
bin/scanline_boolean \
bin/scanline_boolean2 \
bin/simple_blur \
bin/trans_polar
FREETYPE_EXAMPLES=\
bin/freetype_test \
bin/trans_curve1_ft \
bin/trans_curve2_ft
PLATFORM_SRC=\
src/platform/AmigaOS/agg_platform_support.cpp
FREETYPE_SRC=\
font_freetype/agg_font_freetype.cpp
LIB_CXXSRC=\
src/agg_arc.cpp \
src/agg_arrowhead.cpp \
src/agg_bezier_arc.cpp \
src/agg_bspline.cpp \
src/agg_curves.cpp \
src/agg_embedded_raster_fonts.cpp \
src/agg_gsv_text.cpp \
src/agg_image_filters.cpp \
src/agg_line_aa_basics.cpp \
src/agg_line_profile_aa.cpp \
src/agg_rounded_rect.cpp \
src/agg_sqrt_tables.cpp \
src/agg_trans_affine.cpp \
src/agg_trans_double_path.cpp \
src/agg_trans_single_path.cpp \
src/agg_trans_warp_magnifier.cpp \
src/agg_vcgen_bspline.cpp \
src/agg_vcgen_contour.cpp \
src/agg_vcgen_dash.cpp \
src/agg_vcgen_markers_term.cpp \
src/agg_vcgen_smooth_poly1.cpp \
src/agg_vcgen_stroke.cpp \
src/agg_vpgen_clip_polygon.cpp \
src/agg_vpgen_clip_polyline.cpp \
src/agg_vpgen_segmentator.cpp \
src/ctrl/agg_bezier_ctrl.cpp \
src/ctrl/agg_cbox_ctrl.cpp \
src/ctrl/agg_gamma_ctrl.cpp \
src/ctrl/agg_gamma_spline.cpp \
src/ctrl/agg_polygon_ctrl.cpp \
src/ctrl/agg_rbox_ctrl.cpp \
src/ctrl/agg_scale_ctrl.cpp \
src/ctrl/agg_slider_ctrl.cpp \
src/ctrl/agg_spline_ctrl.cpp
LIB_CSRC=\
gpc/gpc.c
SVG_SRC=\
examples/svg_viewer/agg_svg_parser.cpp \
examples/svg_viewer/agg_svg_path_renderer.cpp \
examples/svg_viewer/agg_svg_path_tokenizer.cpp \
examples/svg_viewer/svg_test.cpp \
$(PLATFORM_SRC)
PLATFORM_OBJ = $(PLATFORM_SRC:.cpp=.o)
FREETYPE_OBJ = $(FREETYPE_SRC:.cpp=.o)
LIB_OBJ = $(LIB_CXXSRC:.cpp=.o) $(LIB_CSRC:.c=.o)
SVG_OBJ = $(SVG_SRC:.cpp=.o)
#
# Targets
#
.PHONY : help all lib examples svg freetype clean install wget
help:
@Echo Requirements:
@Echo - AmigaOS 4.0
@Echo - SDK 51.22
@Echo - optional: libexpat.a for SVG viewer
@Echo - optional: libft2.a for FreeType examples
@Echo ""
@Echo Targets:
@Echo all - build AGG library and all tests/examples
@Echo lib - build AGG library only
@Echo examples - build AGG library and examples
@Echo svg - build AGG library and SVG viewer
@Echo freetype - build AGG library and FreeType examples
@Echo clean - clean all build files
@Echo install - build AGG library and install into SDK
@Echo wget - download and install example test files with wget
@Echo release - prepare a release package for SDK
all: lib examples svg freetype
$(STRIP) $(EXAMPLES) $(SVGNAME) $(FREETYPE_EXAMPLES)
lib: $(LIBNAME)
examples: lib $(EXAMPLES)
svg: lib $(SVGNAME)
freetype: lib $(FREETYPE_EXAMPLES)
clean:
-@Delete *>NIL: FORCE QUIET examples/#?.o
-@Delete *>NIL: FORCE QUIET $(PLATFORM_OBJ) $(FREETYPE_OBJ) $(LIB_OBJ) $(SVG_OBJ)
-@copy CLONE ALL bin/#?.cmake#? T:agg_tmp
-@Delete *>NIL: FORCE QUIET ALL bin
-@copy CLONE T:agg_tmp/#? bin
install: lib
-@Copy CLONE $(LIBNAME) SDK:Local/newlib/lib
-@Copy CLONE ALL include/#?.h SDK:Local/common/include/agg
-@Copy CLONE ALL gpc/#?.h SDK:Local/common/include/gpc
release:
-@mkdir -p release/libagg/local/clib2/lib
-@mkdir -p release/libagg/local/newlib/lib
-@mkdir -p release/libagg/local/Documentation/libagg
-@mkdir -p release/libagg/local/common/libagg
-@mkdir -p release/libagg/local/examples/libagg
-@cp AUTHORS release/libagg/local/Documentation/libagg/
-@cp copying release/libagg/local/Documentation/libagg/
-@cp README release/libagg/local/Documentation/libagg/
-@cp lib/libagg-clib2.a release/libagg/local/clib2/lib/libagg.a
-@cp lib/libagg-newlib.a release/libagg/local/newlib/lib/libagg.a
-@cp -r include/* release/libagg/local/common/libagg/
-@cp -r examples/* release/libagg/local/examples/libagg/
-@Delete *>NIL: FORCE QUIET ALL release/libagg/local/examples/libagg/BeOS
-@Delete *>NIL: FORCE QUIET ALL release/libagg/local/examples/libagg/macos#?
-@Delete *>NIL: FORCE QUIET ALL release/libagg/local/examples/libagg/win32#?
-@Delete *>NIL: FORCE QUIET ALL release/libagg/local/examples/libagg/X11
-@lha -aeqr3 a libagg.lha release/
$(LIBNAME): $(LIB_OBJ)
$(AR) $(ARFLAGS) $@ $^
$(SVGNAME): $(SVG_OBJ)
$(CXX) $(CXXFLAGS) $^ -o $@ $(CXXLIBS) -lexpat
#
# Examples binaries
#
bin/aa_test: examples/aa_test.o $(PLATFORM_OBJ)
$(CXX) $(CXXFLAGS) $^ -o $@ $(CXXLIBS)
bin/aa_demo: examples/aa_demo.o $(PLATFORM_OBJ)
$(CXX) $(CXXFLAGS) $^ -o $@ $(CXXLIBS)
bin/alpha_gradient: examples/alpha_gradient.o $(PLATFORM_OBJ)
$(CXX) $(CXXFLAGS) $^ -o $@ $(CXXLIBS)
bin/alpha_mask: examples/alpha_mask.o examples/parse_lion.o $(PLATFORM_OBJ)
$(CXX) $(CXXFLAGS) $^ -o $@ $(CXXLIBS)
bin/alpha_mask2: examples/alpha_mask2.o examples/parse_lion.o $(PLATFORM_OBJ)
$(CXX) $(CXXFLAGS) $^ -o $@ $(CXXLIBS)
bin/alpha_mask3: examples/alpha_mask3.o examples/make_arrows.o examples/make_gb_poly.o $(PLATFORM_OBJ)
$(CXX) $(CXXFLAGS) $^ -o $@ $(CXXLIBS)
bin/bezier_div: examples/bezier_div.o $(PLATFORM_OBJ)
$(CXX) $(CXXFLAGS) $^ -o $@ $(CXXLIBS)
bin/bspline: examples/bspline.o examples/interactive_polygon.o $(PLATFORM_OBJ)
$(CXX) $(CXXFLAGS) $^ -o $@ $(CXXLIBS)
bin/circles: examples/circles.o $(PLATFORM_OBJ)
$(CXX) $(CXXFLAGS) $^ -o $@ $(CXXLIBS)
bin/component_rendering: examples/component_rendering.o $(PLATFORM_OBJ)
$(CXX) $(CXXFLAGS) $^ -o $@ $(CXXLIBS)
bin/compositing: examples/compositing.o $(PLATFORM_OBJ)
$(CXX) $(CXXFLAGS) $^ -o $@ $(CXXLIBS)
bin/compositing2: examples/compositing2.o $(PLATFORM_OBJ)
$(CXX) $(CXXFLAGS) $^ -o $@ $(CXXLIBS)
bin/conv_contour: examples/conv_contour.o $(PLATFORM_OBJ)
$(CXX) $(CXXFLAGS) $^ -o $@ $(CXXLIBS)
bin/conv_dash_marker: examples/conv_dash_marker.o $(PLATFORM_OBJ)
$(CXX) $(CXXFLAGS) $^ -o $@ $(CXXLIBS)
bin/conv_stroke: examples/conv_stroke.o $(PLATFORM_OBJ)
$(CXX) $(CXXFLAGS) $^ -o $@ $(CXXLIBS)
bin/distortions: examples/distortions.o $(PLATFORM_OBJ)
$(CXX) $(CXXFLAGS) $^ -o $@ $(CXXLIBS)
bin/flash_rasterizer: examples/flash_rasterizer.o $(PLATFORM_OBJ)
$(CXX) $(CXXFLAGS) $^ -o $@ $(CXXLIBS)
bin/flash_rasterizer2: examples/flash_rasterizer2.o $(PLATFORM_OBJ)
$(CXX) $(CXXFLAGS) $^ -o $@ $(CXXLIBS)
bin/gamma_correction: examples/gamma_correction.o $(PLATFORM_OBJ)
$(CXX) $(CXXFLAGS) $^ -o $@ $(CXXLIBS)
bin/gamma_ctrl: examples/gamma_ctrl.o $(PLATFORM_OBJ)
$(CXX) $(CXXFLAGS) $^ -o $@ $(CXXLIBS)
bin/gamma_tuner: examples/gamma_tuner.o $(PLATFORM_OBJ)
$(CXX) $(CXXFLAGS) $^ -o $@ $(CXXLIBS)
bin/gouraud: examples/gouraud.o $(PLATFORM_OBJ)
$(CXX) $(CXXFLAGS) $^ -o $@ $(CXXLIBS)
bin/gouraud_mesh: examples/gouraud_mesh.o $(PLATFORM_OBJ)
$(CXX) $(CXXFLAGS) $^ -o $@ $(CXXLIBS)
bin/gpc_test: examples/gpc_test.o examples/make_arrows.o examples/make_gb_poly.o $(PLATFORM_OBJ)
$(CXX) $(CXXFLAGS) $^ -o $@ $(CXXLIBS)
bin/gradients: examples/gradients.o $(PLATFORM_OBJ)
$(CXX) $(CXXFLAGS) $^ -o $@ $(CXXLIBS)
bin/graph_test: examples/graph_test.o $(PLATFORM_OBJ)
$(CXX) $(CXXFLAGS) $^ -o $@ $(CXXLIBS)
bin/idea: examples/idea.o $(PLATFORM_OBJ)
$(CXX) $(CXXFLAGS) $^ -o $@ $(CXXLIBS)
bin/image1: examples/image1.o $(PLATFORM_OBJ)
$(CXX) $(CXXFLAGS) $^ -o $@ $(CXXLIBS)
bin/image_alpha: examples/image_alpha.o $(PLATFORM_OBJ)
$(CXX) $(CXXFLAGS) $^ -o $@ $(CXXLIBS)
bin/image_filters: examples/image_filters.o $(PLATFORM_OBJ)
$(CXX) $(CXXFLAGS) $^ -o $@ $(CXXLIBS)
bin/image_filters2: examples/image_filters2.o $(PLATFORM_OBJ)
$(CXX) $(CXXFLAGS) $^ -o $@ $(CXXLIBS)
bin/image_fltr_graph: examples/image_fltr_graph.o $(PLATFORM_OBJ)
$(CXX) $(CXXFLAGS) $^ -o $@ $(CXXLIBS)
bin/image_perspective: examples/image_perspective.o examples/interactive_polygon.o $(PLATFORM_OBJ)
$(CXX) $(CXXFLAGS) $^ -o $@ $(CXXLIBS)
bin/image_resample: examples/image_resample.o examples/interactive_polygon.o $(PLATFORM_OBJ)
$(CXX) $(CXXFLAGS) $^ -o $@ $(CXXLIBS)
bin/image_transforms: examples/image_transforms.o $(PLATFORM_OBJ)
$(CXX) $(CXXFLAGS) $^ -o $@ $(CXXLIBS)
bin/line_patterns: examples/line_patterns.o $(PLATFORM_OBJ)
$(CXX) $(CXXFLAGS) $^ -o $@ $(CXXLIBS)
bin/line_patterns_clip: examples/line_patterns_clip.o $(PLATFORM_OBJ)
$(CXX) $(CXXFLAGS) $^ -o $@ $(CXXLIBS)
bin/lion: examples/lion.o examples/parse_lion.o $(PLATFORM_OBJ)
$(CXX) $(CXXFLAGS) $^ -o $@ $(CXXLIBS)
bin/lion_lens: examples/lion_lens.o examples/parse_lion.o $(PLATFORM_OBJ)
$(CXX) $(CXXFLAGS) $^ -o $@ $(CXXLIBS)
bin/lion_outline: examples/lion_outline.o examples/parse_lion.o $(PLATFORM_OBJ)
$(CXX) $(CXXFLAGS) $^ -o $@ $(CXXLIBS)
bin/mol_view: examples/mol_view.o $(PLATFORM_OBJ)
$(CXX) $(CXXFLAGS) $^ -o $@ $(CXXLIBS)
bin/multi_clip: examples/multi_clip.o examples/parse_lion.o $(PLATFORM_OBJ)
$(CXX) $(CXXFLAGS) $^ -o $@ $(CXXLIBS)
bin/pattern_fill: examples/pattern_fill.o $(PLATFORM_OBJ)
$(CXX) $(CXXFLAGS) $^ -o $@ $(CXXLIBS)
bin/pattern_perspective: examples/pattern_perspective.o examples/interactive_polygon.o $(PLATFORM_OBJ)
$(CXX) $(CXXFLAGS) $^ -o $@ $(CXXLIBS)
bin/pattern_resample: examples/pattern_resample.o examples/interactive_polygon.o $(PLATFORM_OBJ)
$(CXX) $(CXXFLAGS) $^ -o $@ $(CXXLIBS)
bin/perspective: examples/perspective.o examples/interactive_polygon.o examples/parse_lion.o $(PLATFORM_OBJ)
$(CXX) $(CXXFLAGS) $^ -o $@ $(CXXLIBS)
bin/polymorphic_renderer: examples/polymorphic_renderer.o $(PLATFORM_OBJ)
$(CXX) $(CXXFLAGS) $^ -o $@ $(CXXLIBS)
bin/rasterizers: examples/rasterizers.o $(PLATFORM_OBJ)
$(CXX) $(CXXFLAGS) $^ -o $@ $(CXXLIBS)
bin/rasterizers2: examples/rasterizers2.o $(PLATFORM_OBJ)
$(CXX) $(CXXFLAGS) $^ -o $@ $(CXXLIBS)
bin/raster_text: examples/raster_text.o $(PLATFORM_OBJ)
$(CXX) $(CXXFLAGS) $^ -o $@ $(CXXLIBS)
bin/rounded_rect: examples/rounded_rect.o $(PLATFORM_OBJ)
$(CXX) $(CXXFLAGS) $^ -o $@ $(CXXLIBS)
bin/scanline_boolean: examples/scanline_boolean.o examples/interactive_polygon.o $(PLATFORM_OBJ)
$(CXX) $(CXXFLAGS) $^ -o $@ $(CXXLIBS)
bin/scanline_boolean2: examples/scanline_boolean2.o examples/make_arrows.o examples/make_gb_poly.o $(PLATFORM_OBJ)
$(CXX) $(CXXFLAGS) $^ -o $@ $(CXXLIBS)
bin/simple_blur: examples/simple_blur.o examples/parse_lion.o $(PLATFORM_OBJ)
$(CXX) $(CXXFLAGS) $^ -o $@ $(CXXLIBS)
bin/trans_polar: examples/trans_polar.o $(PLATFORM_OBJ)
$(CXX) $(CXXFLAGS) $^ -o $@ $(CXXLIBS)
bin/freetype_test: examples/freetype_test.o $(FREETYPE_OBJ) $(PLATFORM_OBJ)
$(CXX) $(CXXFLAGS) $^ -o $@ $(CXXLIBS) -lft2
bin/trans_curve1_ft: examples/trans_curve1_ft.o examples/interactive_polygon.o $(FREETYPE_OBJ) $(PLATFORM_OBJ)
$(CXX) $(CXXFLAGS) $^ -o $@ $(CXXLIBS) -lft2
bin/trans_curve2_ft: examples/trans_curve2_ft.o examples/interactive_polygon.o $(FREETYPE_OBJ) $(PLATFORM_OBJ)
$(CXX) $(CXXFLAGS) $^ -o $@ $(CXXLIBS) -lft2
#
# Examples files
#
wget:
cp examples/art/tiger.svg bin
cp examples/art/agg.bmp bin
cp examples/art/compositing.bmp bin
cp examples/art/spheres.bmp bin
cp examples/art/shapes.txt bin
cp examples/art/1.sdf bin
xadunfile examples/art/line_patterns.bmp.zip bin overwrite
xadunfile examples/art/timesi.zip bin overwrite
#
# Pattern Rules
#
%.o: %.cpp
@MakeDir lib bin force
$(CXX) -c $(CXXFLAGS) $< -o $@
%.o: %.c
@MakeDir lib bin force
$(CC) -c $(CFLAGS) $< -o $@

View File

@ -17,6 +17,8 @@
// //
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
#define __USE_OLD_TIMEVAL__
#include "platform/agg_platform_support.h" #include "platform/agg_platform_support.h"
#include "util/agg_color_conv_rgb8.h" #include "util/agg_color_conv_rgb8.h"
@ -32,24 +34,25 @@
#include <proto/graphics.h> #include <proto/graphics.h>
#include <proto/intuition.h> #include <proto/intuition.h>
#include <proto/keymap.h> #include <proto/keymap.h>
#include <proto/Picasso96API.h>
#include <proto/utility.h> #include <proto/utility.h>
Library* DataTypesBase = 0; Library* DataTypesBase = 0;
Library* GraphicsBase = 0; Library* GraphicsBase = 0;
Library* IntuitionBase = 0; Library* IntuitionBase = 0;
Library* KeymapBase = 0; Library* KeymapBase = 0;
Library* P96Base = 0;
DataTypesIFace* IDataTypes = 0; DataTypesIFace* IDataTypes = 0;
GraphicsIFace* IGraphics = 0; GraphicsIFace* IGraphics = 0;
IntuitionIFace* IIntuition = 0; IntuitionIFace* IIntuition = 0;
KeymapIFace* IKeymap = 0; KeymapIFace* IKeymap = 0;
P96IFace* IP96 = 0;
Class* RequesterClass = 0; Class* RequesterClass = 0;
Class* WindowClass = 0; Class* WindowClass = 0;
struct RenderInfo {
APTR Memory;
UWORD BytesPerRow;
};
namespace agg namespace agg
{ {
@ -69,14 +72,14 @@ namespace agg
bool make_bitmap(); bool make_bitmap();
public: public:
platform_support& m_support; platform_support& m_support;
RGBFTYPE m_ftype; enPixelFormat m_ftype;
pix_format_e m_format; pix_format_e m_format;
unsigned m_bpp; unsigned m_bpp;
BitMap* m_bitmap; BitMap* m_bitmap;
bool m_flip_y; bool m_flip_y;
uint16 m_width; uint16 m_width;
uint16 m_height; uint16 m_height;
APTR m_window_obj; Object* m_window_obj;
Window* m_window; Window* m_window;
Hook* m_idcmp_hook; Hook* m_idcmp_hook;
unsigned m_input_flags; unsigned m_input_flags;
@ -90,7 +93,7 @@ namespace agg
platform_specific::platform_specific(platform_support& support, platform_specific::platform_specific(platform_support& support,
pix_format_e format, bool flip_y) : pix_format_e format, bool flip_y) :
m_support(support), m_support(support),
m_ftype(RGBFB_NONE), m_ftype(PIXF_NONE),
m_format(format), m_format(format),
m_bpp(0), m_bpp(0),
m_bitmap(0), m_bitmap(0),
@ -111,35 +114,35 @@ namespace agg
// Not supported. // Not supported.
break; break;
case pix_format_rgb555: case pix_format_rgb555:
m_ftype = RGBFB_R5G5B5; m_ftype = PIXF_R5G5B5;
m_bpp = 15; m_bpp = 15;
break; break;
case pix_format_rgb565: case pix_format_rgb565:
m_ftype = RGBFB_R5G6B5; m_ftype = PIXF_R5G6B5;
m_bpp = 16; m_bpp = 16;
break; break;
case pix_format_rgb24: case pix_format_rgb24:
m_ftype = RGBFB_R8G8B8; m_ftype = PIXF_R8G8B8;
m_bpp = 24; m_bpp = 24;
break; break;
case pix_format_bgr24: case pix_format_bgr24:
m_ftype = RGBFB_B8G8R8; m_ftype = PIXF_B8G8R8;
m_bpp = 24; m_bpp = 24;
break; break;
case pix_format_bgra32: case pix_format_bgra32:
m_ftype = RGBFB_B8G8R8A8; m_ftype = PIXF_B8G8R8A8;
m_bpp = 32; m_bpp = 32;
break; break;
case pix_format_abgr32: case pix_format_abgr32:
m_ftype = RGBFB_A8B8G8R8; m_ftype = PIXF_A8B8G8R8;
m_bpp = 32; m_bpp = 32;
break; break;
case pix_format_argb32: case pix_format_argb32:
m_ftype = RGBFB_A8R8G8B8; m_ftype = PIXF_A8R8G8B8;
m_bpp = 32; m_bpp = 32;
break; break;
case pix_format_rgba32: case pix_format_rgba32:
m_ftype = RGBFB_R8G8B8A8; m_ftype = PIXF_R8G8B8A8;
m_bpp = 32; m_bpp = 32;
break; break;
} }
@ -154,12 +157,12 @@ namespace agg
platform_specific::~platform_specific() platform_specific::~platform_specific()
{ {
IIntuition->DisposeObject(m_window_obj); IIntuition->DisposeObject(m_window_obj);
IP96->p96FreeBitMap(m_bitmap); IGraphics->FreeBitMap(m_bitmap);
for ( unsigned i = 0; i < platform_support::max_images; ++i ) for ( unsigned i = 0; i < platform_support::max_images; ++i )
{ {
IP96->p96FreeBitMap(m_img_bitmaps[i]); IGraphics->FreeBitMap(m_img_bitmaps[i]);
} }
if ( m_idcmp_hook != 0 ) if ( m_idcmp_hook != 0 )
@ -173,7 +176,7 @@ namespace agg
{ {
int16 code = 0; int16 code = 0;
uint32 result = 0; uint32 result = 0;
Object* obj = reinterpret_cast<Object*>(m_window_obj); Object* obj = m_window_obj;
while ( (result = IIntuition->IDoMethod(obj, WM_HANDLEINPUT, while ( (result = IIntuition->IDoMethod(obj, WM_HANDLEINPUT,
&code)) != WMHI_LASTMSG ) &code)) != WMHI_LASTMSG )
@ -209,7 +212,7 @@ namespace agg
{ {
if ( m_img_bitmaps[idx] != 0 ) if ( m_img_bitmaps[idx] != 0 )
{ {
IP96->p96FreeBitMap(m_img_bitmaps[idx]); IGraphics->FreeBitMap(m_img_bitmaps[idx]);
m_img_bitmaps[idx] = 0; m_img_bitmaps[idx] = 0;
} }
@ -237,12 +240,12 @@ namespace agg
bool supported = false; bool supported = false;
RGBFTYPE ftype = static_cast<RGBFTYPE>(IP96->p96GetBitMapAttr( enPixelFormat ftype = static_cast<enPixelFormat>(IGraphics->GetBitMapAttr(
src_bitmap, P96BMA_RGBFORMAT)); src_bitmap, BMA_PIXELFORMAT));
switch ( ftype ) switch ( ftype )
{ {
case RGBFB_R8G8B8: case PIXF_R8G8B8:
supported = true; supported = true;
break; break;
default: default:
@ -251,20 +254,24 @@ namespace agg
} }
if ( supported ) { if ( supported ) {
uint16 width = IP96->p96GetBitMapAttr(src_bitmap, uint32 width = IGraphics->GetBitMapAttr(src_bitmap,
P96BMA_WIDTH); BMA_WIDTH);
uint16 height = IP96->p96GetBitMapAttr(src_bitmap, uint32 height = IGraphics->GetBitMapAttr(src_bitmap,
P96BMA_HEIGHT); BMA_HEIGHT);
m_img_bitmaps[idx] = IGraphics->AllocBitMapTags(width, height, m_bpp,
BMATags_UserPrivate, TRUE,
BMATags_PixelFormat, m_ftype,
TAG_DONE);
m_img_bitmaps[idx] = IP96->p96AllocBitMap(width, height,
m_bpp, BMF_USERPRIVATE, 0, m_ftype);
if ( m_img_bitmaps[idx] != 0 ) if ( m_img_bitmaps[idx] != 0 )
{ {
int8u* buf = reinterpret_cast<int8u*>( int8u* buf = reinterpret_cast<int8u*>(
IP96->p96GetBitMapAttr(m_img_bitmaps[idx], IGraphics->GetBitMapAttr(m_img_bitmaps[idx],
P96BMA_MEMORY)); BMA_BASEADDRESS));
int bpr = IP96->p96GetBitMapAttr(m_img_bitmaps[idx], int bpr = IGraphics->GetBitMapAttr(m_img_bitmaps[idx],
P96BMA_BYTESPERROW); BMA_BYTESPERROW);
int stride = (m_flip_y) ? -bpr : bpr; int stride = (m_flip_y) ? -bpr : bpr;
rbuf->attach(buf, width, height, stride); rbuf->attach(buf, width, height, stride);
@ -273,9 +280,9 @@ namespace agg
if ( m_bpp == 32 ) if ( m_bpp == 32 )
{ {
RenderInfo ri; RenderInfo ri;
int32 lock = IP96->p96LockBitMap(src_bitmap, APTR lock = IGraphics->LockBitMapTags(src_bitmap,
reinterpret_cast<uint8*>(&ri), LBM_BaseAddress, reinterpret_cast<uint8*>(&ri),
sizeof(RenderInfo)); TAG_DONE);
rendering_buffer rbuf_src; rendering_buffer rbuf_src;
rbuf_src.attach( rbuf_src.attach(
@ -303,13 +310,13 @@ namespace agg
break; break;
} }
IP96->p96UnlockBitMap(src_bitmap, lock); IGraphics->UnlockBitMap(lock);
} }
else else
{ {
IGraphics->BltBitMap(src_bitmap, 0, 0, IGraphics->BltBitMap(src_bitmap, 0, 0,
m_img_bitmaps[idx], 0, 0, width, height, m_img_bitmaps[idx], 0, 0, width, height,
ABC|ABNC, 0xFF, 0); MINTERM_ABC|MINTERM_ABNC, 0xFF, 0);
} }
result = true; result = true;
@ -330,19 +337,24 @@ namespace agg
{ {
if ( m_img_bitmaps[idx] != 0 ) if ( m_img_bitmaps[idx] != 0 )
{ {
IP96->p96FreeBitMap(m_img_bitmaps[idx]); IGraphics->FreeBitMap(m_img_bitmaps[idx]);
m_img_bitmaps[idx] = 0; m_img_bitmaps[idx] = 0;
} }
m_img_bitmaps[idx] = IP96->p96AllocBitMap(width, height, m_img_bitmaps[idx] = IGraphics->AllocBitMapTags(width, height, m_bpp,
m_bpp, BMF_USERPRIVATE, m_bitmap, m_ftype); BMATags_UserPrivate, TRUE,
BMATags_Friend, m_bitmap,
BMATags_PixelFormat, m_ftype,
TAG_DONE);
if ( m_img_bitmaps[idx] != 0 ) if ( m_img_bitmaps[idx] != 0 )
{ {
int8u* buf = reinterpret_cast<int8u*>( int8u* buf = reinterpret_cast<int8u*>(
IP96->p96GetBitMapAttr(m_img_bitmaps[idx], IGraphics->GetBitMapAttr(m_img_bitmaps[idx],
P96BMA_MEMORY)); BMA_BASEADDRESS));
int bpr = IP96->p96GetBitMapAttr(m_img_bitmaps[idx], int bpr = IGraphics->GetBitMapAttr(m_img_bitmaps[idx],
P96BMA_BYTESPERROW); BMA_BYTESPERROW);
int stride = (m_flip_y) ? -bpr : bpr; int stride = (m_flip_y) ? -bpr : bpr;
rbuf->attach(buf, width, height, stride); rbuf->attach(buf, width, height, stride);
@ -363,23 +375,28 @@ namespace agg
WA_InnerHeight, &height, WA_InnerHeight, &height,
TAG_END); TAG_END);
BitMap* bm = IP96->p96AllocBitMap(width, height, m_bpp, BitMap* bm = IGraphics->AllocBitMapTags(width, height, m_bpp,
BMF_USERPRIVATE|BMF_CLEAR, 0, m_ftype); BMATags_UserPrivate, TRUE,
BMATags_Clear, TRUE,
BMATags_PixelFormat, m_ftype,
TAG_DONE);
if ( bm == 0 ) if ( bm == 0 )
{ {
return false; return false;
} }
int8u* buf = reinterpret_cast<int8u*>( int8u* buf = reinterpret_cast<int8u*>(
IP96->p96GetBitMapAttr(bm, P96BMA_MEMORY)); IGraphics->GetBitMapAttr(bm, BMA_BASEADDRESS));
int bpr = IP96->p96GetBitMapAttr(bm, P96BMA_BYTESPERROW); int bpr = IGraphics->GetBitMapAttr(bm, BMA_BYTESPERROW);
int stride = (m_flip_y) ? -bpr : bpr; int stride = (m_flip_y) ? -bpr : bpr;
m_support.rbuf_window().attach(buf, width, height, stride); m_support.rbuf_window().attach(buf, width, height, stride);
if ( m_bitmap != 0 ) if ( m_bitmap != 0 )
{ {
IP96->p96FreeBitMap(m_bitmap); IGraphics->FreeBitMap(m_bitmap);
m_bitmap = 0; m_bitmap = 0;
} }
@ -472,14 +489,14 @@ namespace agg
IIntuition->IDoMethodA(reinterpret_cast<Object*>(req), IIntuition->IDoMethodA(reinterpret_cast<Object*>(req),
reinterpret_cast<Msg>(&reqmsg)); reinterpret_cast<Msg>(&reqmsg));
IIntuition->DisposeObject(req); IIntuition->DisposeObject(reinterpret_cast<Object*>(req));
} }
//------------------------------------------------------------------------ //------------------------------------------------------------------------
bool platform_support::init(unsigned width, unsigned height, bool platform_support::init(unsigned width, unsigned height,
unsigned flags) unsigned flags)
{ {
if( m_specific->m_ftype == RGBFB_NONE ) if( m_specific->m_ftype == PIXF_NONE )
{ {
message("Unsupported mode requested."); message("Unsupported mode requested.");
return false; return false;
@ -538,14 +555,14 @@ namespace agg
return false; return false;
} }
RGBFTYPE ftype = static_cast<RGBFTYPE>(IP96->p96GetBitMapAttr( enPixelFormat ftype = static_cast<enPixelFormat>(IGraphics->GetBitMapAttr(
m_specific->m_window->RPort->BitMap, P96BMA_RGBFORMAT)); m_specific->m_window->RPort->BitMap, BMA_PIXELFORMAT));
switch ( ftype ) switch ( ftype )
{ {
case RGBFB_A8R8G8B8: case PIXF_A8R8G8B8:
case RGBFB_B8G8R8A8: case PIXF_B8G8R8A8:
case RGBFB_R5G6B5PC: case PIXF_R5G6B5PC:
break; break;
default: default:
message("Unsupported screen mode.\n"); message("Unsupported screen mode.\n");
@ -668,7 +685,7 @@ namespace agg
IGraphics->BltBitMapRastPort(m_specific->m_bitmap, 0, 0, IGraphics->BltBitMapRastPort(m_specific->m_bitmap, 0, 0,
m_specific->m_window->RPort, m_specific->m_window->BorderLeft, m_specific->m_window->RPort, m_specific->m_window->BorderLeft,
m_specific->m_window->BorderTop, m_specific->m_width, m_specific->m_window->BorderTop, m_specific->m_width,
m_specific->m_height, ABC|ABNC); m_specific->m_height, MINTERM_ABC|MINTERM_ABNC);
} }
//------------------------------------------------------------------------ //------------------------------------------------------------------------
@ -899,10 +916,9 @@ void close_libs();
bool open_libs() bool open_libs()
{ {
DataTypesBase = IExec->OpenLibrary("datatypes.library", 51); DataTypesBase = IExec->OpenLibrary("datatypes.library", 51);
GraphicsBase = IExec->OpenLibrary("graphics.library", 51); GraphicsBase = IExec->OpenLibrary("graphics.library", 54);
IntuitionBase = IExec->OpenLibrary("intuition.library", 51); IntuitionBase = IExec->OpenLibrary("intuition.library", 51);
KeymapBase = IExec->OpenLibrary("keymap.library", 51); KeymapBase = IExec->OpenLibrary("keymap.library", 51);
P96Base = IExec->OpenLibrary("Picasso96API.library", 2);
IDataTypes = reinterpret_cast<DataTypesIFace*>( IDataTypes = reinterpret_cast<DataTypesIFace*>(
IExec->GetInterface(DataTypesBase, "main", 1, 0)); IExec->GetInterface(DataTypesBase, "main", 1, 0));
@ -912,14 +928,11 @@ bool open_libs()
IExec->GetInterface(IntuitionBase, "main", 1, 0)); IExec->GetInterface(IntuitionBase, "main", 1, 0));
IKeymap = reinterpret_cast<KeymapIFace*>( IKeymap = reinterpret_cast<KeymapIFace*>(
IExec->GetInterface(KeymapBase, "main", 1, 0)); IExec->GetInterface(KeymapBase, "main", 1, 0));
IP96 = reinterpret_cast<P96IFace*>(
IExec->GetInterface(P96Base, "main", 1, 0));
if ( IDataTypes == 0 || if ( IDataTypes == 0 ||
IGraphics == 0 || IGraphics == 0 ||
IIntuition == 0 || IIntuition == 0 ||
IKeymap == 0 || IKeymap == 0)
IP96 == 0 )
{ {
close_libs(); close_libs();
return false; return false;
@ -933,13 +946,11 @@ bool open_libs()
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void close_libs() void close_libs()
{ {
IExec->DropInterface(reinterpret_cast<Interface*>(IP96));
IExec->DropInterface(reinterpret_cast<Interface*>(IKeymap)); IExec->DropInterface(reinterpret_cast<Interface*>(IKeymap));
IExec->DropInterface(reinterpret_cast<Interface*>(IIntuition)); IExec->DropInterface(reinterpret_cast<Interface*>(IIntuition));
IExec->DropInterface(reinterpret_cast<Interface*>(IGraphics)); IExec->DropInterface(reinterpret_cast<Interface*>(IGraphics));
IExec->DropInterface(reinterpret_cast<Interface*>(IDataTypes)); IExec->DropInterface(reinterpret_cast<Interface*>(IDataTypes));
IExec->CloseLibrary(P96Base);
IExec->CloseLibrary(KeymapBase); IExec->CloseLibrary(KeymapBase);
IExec->CloseLibrary(IntuitionBase); IExec->CloseLibrary(IntuitionBase);
IExec->CloseLibrary(GraphicsBase); IExec->CloseLibrary(GraphicsBase);