amigaos4 #1

Open
walkero wants to merge 4 commits from amigaos4 into master
4 changed files with 455 additions and 69 deletions
Showing only changes of commit 9ae0d23561 - Show all commits

0
.gitignore vendored Normal file
View File

View File

@ -366,24 +366,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
# #

389
Makefile.AmigaOS-newlib Normal file
View File

@ -0,0 +1,389 @@
#
# 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.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
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)
-@Delete *>NIL: FORCE QUIET ALL lib 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
$(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,20 +34,17 @@
#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;
@ -76,7 +75,7 @@ namespace agg
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;
@ -154,12 +153,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 +172,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 +208,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,8 +236,8 @@ namespace agg
bool supported = false; bool supported = false;
RGBFTYPE ftype = static_cast<RGBFTYPE>(IP96->p96GetBitMapAttr( RGBFTYPE ftype = static_cast<RGBFTYPE>(IGraphics->GetBitMapAttr(
src_bitmap, P96BMA_RGBFORMAT)); src_bitmap, BMA_PIXELFORMAT));
switch ( ftype ) switch ( ftype )
{ {
@ -251,20 +250,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 +276,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 +306,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 +333,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 +371,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,7 +485,7 @@ 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));
} }
//------------------------------------------------------------------------ //------------------------------------------------------------------------
@ -538,9 +551,9 @@ namespace agg
return false; return false;
} }
RGBFTYPE ftype = static_cast<RGBFTYPE>(IP96->p96GetBitMapAttr( RGBFTYPE ftype = static_cast<RGBFTYPE>(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 RGBFB_A8R8G8B8:
@ -668,7 +681,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 +912,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 +924,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 +942,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);