void test_renderer(Renderer *renderer, const std::string &type) { cout << "Testing " << type << " Renderer" << endl; // Timer trend("Renderer Tests", true); if (!renderer) { runtest.unresolved("No renderer to test!"); return; } if (renderer > 0) { runtest.pass("Got Renderer"); } else { runtest.fail("Couldn't get Renderer"); } if (!renderer->description().empty()) { if (renderer->description() == type) { runtest.pass("description is correct"); } else { runtest.fail("description is wrong"); } } else { runtest.fail("Couldn't get description!"); } #if 0 if (renderer->getBitsPerPixel()) { runtest.pass("getBitsPerPixel()"); } else { runtest.fail("getBitsPerPixel()"); } #endif image::GnashImage *frame1 = new image::ImageRGBA(10, 12); std::auto_ptr<image::GnashImage> im1(frame1); CachedBitmap *cb = renderer->createCachedBitmap(im1); if (cb) { image::GnashImage &gi = cb->image(); if ((gi.width() == 10) && (gi.height() == 12)) { runtest.pass("createCachedBitmap()"); } else { runtest.fail("createCachedBitmap()"); } } else { runtest.unresolved("createCachedBitmap()"); } #if 0 // FIXME: initTestBuffer() is going away, replaced by the fake // framebuffer code. // Initializes the renderer for off-screen rendering used by the testsuite. if (renderer->initTestBuffer(10, 10)) { runtest.pass("initTestBuffer()"); } else { runtest.fail("initTestBuffer()"); } #endif /// @coords an array of 16-bit signed integer coordinates. Even indices /// (and 0) are x coordinates, while uneven ones are y coordinates. /// @vertex_count the number of x-y coordinates (vertices). /// @color the color to be used to draw the line strip. /// @mat the SWFMatrix to be used to transform the vertices. boost::uint16_t x = 10; boost::uint16_t y = 10; boost::uint16_t h = 10; std::vector<point> box = boost::assign::list_of (point(x, y)) (point(x, y + h)); rgba color(0, 0, 0, 255); SWFMatrix mat; mat.set_scale_rotation(1, 3, 0); Timer tdrawline("drawline"); renderer->drawLine(box, color, mat); tdrawline.stop(); // if (1) { // runtest.pass("drawLine()"); // } else { // runtest.fail("drawLine()"); // } runtest.unresolved(std::string("drawLine() ") + tdrawline.elapsed()); //drawVideoFrame(image::GnashImage* frame, const Transform& xform, const SWFRect* bounds, bool smooth); #if 0 image::GnashImage *frame; const Transform xform; const SWFRect bounds; bool smooth; Timer tdrawvideo("drawVideoFrame"); renderer->drawVideoFrame(frame, xform, bounds, smooth); tdrawvideo.stop(); #endif runtest.untested("drawVideoFrame()"); point *corners = 0; size_t corner_count = 0; rgba fill(0, 0, 0, 255);; rgba outline(0, 0, 0, 255);; bool masked = true; Timer tdrawpoly("drawPoly"); renderer->draw_poly(corners, corner_count, fill, outline, mat, masked); tdrawpoly.stop(); runtest.unresolved(std::string("drawPoly() ") + tdrawpoly.elapsed()); // SWF::ShapeRecord shape; SWFMatrix mat2(0x10000, 0x0, 0x0, 0x10000, 0x0, 0x0); SWFCxForm cxform; //(0x100, 0x100, 0x100, 0x100, 0x0, 0x0, 0x0, 0x0); Transform xform(mat2, cxform); SWF::ShapeRecord shape; // _bounds = {0x80000000, 0x7fffffff, // 0x80000000, 0x80000000, // 0x80000000, 0x80000000}} Timer drawshape("drawShape"); renderer->drawShape(shape, xform); runtest.unresolved("drawShape()"); drawshape.stop(); // SWF::ShapeRecord rec; // rgba color; // SWFMatrix mat; // Timer drawGlyph("drawGlyph"); // renderer->drawGlyph(rec, color, mat); runtest.untested("drawGlyph()"); // drawglyph.stop(); #if 0 boost::shared_ptr<IOChannel> io; FileType ftype; Timer renderi("renderToImage"); renderer->renderToImage(io, ftype); renderi.stop(); #endif runtest.untested("renderToImage()"); CachedBitmap *bitmap = 0; image::GnashImage *frame2 = new image::ImageRGBA(10, 10); std::auto_ptr<image::GnashImage> im(frame2); Timer cbit("createCachedBitmap"); bitmap = renderer->createCachedBitmap(im); cbit.stop(); if (bitmap) { runtest.pass(std::string("createCachedBitmap() ") + cbit.elapsed()); } else { runtest.fail(std::string("createCachedBitmap() ") + cbit.elapsed()); } }