int main(int argc, char **argv) { testInit(argc, argv, 400,400, "ShivaVG: Radial Gradient Test"); testCallback(TEST_CALLBACK_DISPLAY, (CallbackFunc)display); testCallback(TEST_CALLBACK_BUTTON, (CallbackFunc)click); testCallback(TEST_CALLBACK_DRAG, (CallbackFunc)drag); testCallback(TEST_CALLBACK_KEY, (CallbackFunc)key); p = testCreatePath(); center = testCreatePath(); focus = testCreatePath(); radius = testCreatePath(); cx = testWidth()/2; cy = testHeight()/2; fx = cx; fy = cy; r = sqx/2; radialFill = vgCreatePaint(); blackFill = vgCreatePaint(); vgSetParameterfv(blackFill, VG_PAINT_COLOR, 4, black); createSquare(p); createRadial(); testOverlayString("Press H for a list of commands"); testOverlayColor(1,1,1,1); testRun(); return EXIT_SUCCESS; }
int tiger() { int argc; char **argv; //Initial windows(glut) and some gl projection testInit(argc, argv, 320 ,480, "ShivaVG: Tiger SVG Test"); #ifdef USE_GL //callbacks[type] = func testCallback(TEST_CALLBACK_CLEANUP, (CallbackFunc)cleanup); testCallback(TEST_CALLBACK_DISPLAY, (CallbackFunc)display); testCallback(TEST_CALLBACK_KEY, (CallbackFunc)key); testCallback(TEST_CALLBACK_BUTTON, (CallbackFunc)click); testCallback(TEST_CALLBACK_DRAG, (CallbackFunc)drag); #endif //USE_GL time_t stime, etime; double tpp; double fps; loadTiger(); display(0.05); #ifdef USE_GL testOverlayString("Press H for a list of commands"); testRun(); #endif //USE_GL return EXIT_SUCCESS; }
int main(int argc, char **argv) { testInit(argc, argv, 400,400, "ShivaVG: Linear Gradient Test"); testCallback(TEST_CALLBACK_DISPLAY, (CallbackFunc)display); testCallback(TEST_CALLBACK_BUTTON, (CallbackFunc)click); testCallback(TEST_CALLBACK_DRAG, (CallbackFunc)drag); testCallback(TEST_CALLBACK_KEY, (CallbackFunc)key); testCallback(TEST_CALLBACK_RESHAPE, (CallbackFunc)reshape); p = testCreatePath(); org = testCreatePath(); blackFill = vgCreatePaint(); vgSetParameterfv(blackFill, VG_PAINT_COLOR, 4, black); backImage = createImageFromJpeg(IMAGE_DIR"test_img_violin.jpg"); patternImage = createImageFromJpeg(IMAGE_DIR"test_img_shivavg.jpg"); patternFill = vgCreatePaint(); createSquare(p); createOrigin(org); createPattern(); testOverlayString("Press H for a list of commands"); testOverlayColor(1,1,1,1); testRun(); return EXIT_SUCCESS; }
static void cbsNewCallback(CBS cbs, CBSBlock cbsBlock, Size oldSize, Size newSize) { testCallback(cbs, cbsBlock, oldSize, newSize, &CallbackNew); Insist(oldSize < cbs->minSize); Insist(newSize >= cbs->minSize); NNewBlocks++; }
static void cbsDeleteCallback(CBS cbs, CBSBlock cbsBlock, Size oldSize, Size newSize) { testCallback(cbs, cbsBlock, oldSize, newSize, &CallbackDelete); Insist(oldSize >= cbs->minSize); Insist(newSize < cbs->minSize); NDeleteBlocks++; }
int main(int argc, char **argv) { testInit(argc, argv, 500,500, "ShivaVG: VGU Primitives Test"); testCallback(TEST_CALLBACK_DISPLAY, (CallbackFunc)display); createPrimitives(); testRun(); return EXIT_SUCCESS; }
static void cbsShrinkCallback(CBS cbs, CBSBlock cbsBlock, Size oldSize, Size newSize) { testCallback(cbs, cbsBlock, oldSize, newSize, &CallbackShrink); Insist(oldSize >= cbs->minSize); Insist(newSize >= cbs->minSize); Insist(oldSize > newSize); NShrinkBlocks++; }
static bool pluginInvoke(NPObject* header, NPIdentifier name, const NPVariant* args, uint32_t argCount, NPVariant* result) { PluginObject* plugin = reinterpret_cast<PluginObject*>(header); if (name == pluginMethodIdentifiers[ID_TEST_CALLBACK_METHOD]) return testCallback(plugin, args, argCount, result); if (name == pluginMethodIdentifiers[ID_TEST_CALLBACK_METHOD_RETURN]) return testCallbackReturn(plugin, args, argCount, result); if (name == pluginMethodIdentifiers[ID_TEST_GETURL]) return getURL(plugin, args, argCount, result); if (name == pluginMethodIdentifiers[ID_TEST_DOM_ACCESS]) return testDOMAccess(plugin, args, argCount, result); if (name == pluginMethodIdentifiers[ID_TEST_GET_URL_NOTIFY]) return getURLNotify(plugin, args, argCount, result); if (name == pluginMethodIdentifiers[ID_TEST_INVOKE_DEFAULT]) return testInvokeDefault(plugin, args, argCount, result); if (name == pluginMethodIdentifiers[ID_TEST_ENUMERATE]) return testEnumerate(plugin, args, argCount, result); if (name == pluginMethodIdentifiers[ID_DESTROY_STREAM]) return destroyStream(plugin, args, argCount, result); if (name == pluginMethodIdentifiers[ID_TEST_GETINTIDENTIFIER]) return testGetIntIdentifier(plugin, args, argCount, result); if (name == pluginMethodIdentifiers[ID_TEST_EVALUATE]) return testEvaluate(plugin, args, argCount, result); if (name == pluginMethodIdentifiers[ID_TEST_GET_PROPERTY]) return testGetProperty(plugin, args, argCount, result); if (name == pluginMethodIdentifiers[ID_TEST_GET_PROPERTY_RETURN_VALUE]) return testGetPropertyReturnValue(plugin, args, argCount, result); if (name == pluginMethodIdentifiers[ID_TEST_HAS_PROPERTY]) return testHasProperty(plugin, args, argCount, result); if (name == pluginMethodIdentifiers[ID_TEST_HAS_METHOD]) return testHasMethod(plugin, args, argCount, result); if (name == pluginMethodIdentifiers[ID_TEST_IDENTIFIER_TO_STRING]) return testIdentifierToString(plugin, args, argCount, result); if (name == pluginMethodIdentifiers[ID_TEST_IDENTIFIER_TO_INT]) return testIdentifierToInt(plugin, args, argCount, result); if (name == pluginMethodIdentifiers[ID_TEST_PASS_TEST_OBJECT]) return testPassTestObject(plugin, args, argCount, result); if (name == pluginMethodIdentifiers[ID_TEST_POSTURL_FILE]) return testPostURLFile(plugin, args, argCount, result); if (name == pluginMethodIdentifiers[ID_TEST_CONSTRUCT]) return testConstruct(plugin, args, argCount, result); if (name == pluginMethodIdentifiers[ID_TEST_SCRIPT_OBJECT_INVOKE]) return testScriptObjectInvoke(plugin, args, argCount, result); if (name == pluginMethodIdentifiers[ID_TEST_THROW_EXCEPTION_METHOD]) { browser->setexception(header, "plugin object testThrowException SUCCESS"); return true; } if (name == pluginMethodIdentifiers[ID_TEST_FAIL_METHOD]) { NPObject* windowScriptObject; browser->getvalue(plugin->npp, NPNVWindowNPObject, &windowScriptObject); browser->invoke(plugin->npp, windowScriptObject, name, args, argCount, result); return false; } if (name == pluginMethodIdentifiers[ID_TEST_CLONE_OBJECT]) { NPObject* new_object = browser->createobject(plugin->npp, &pluginClass); assert(new_object->referenceCount == 1); OBJECT_TO_NPVARIANT(new_object, *result); return true; } if (name == pluginMethodIdentifiers[ID_TEST_CREATE_TEST_OBJECT]) { NPObject* testObject = browser->createobject(plugin->npp, getTestClass()); assert(testObject->referenceCount == 1); OBJECT_TO_NPVARIANT(testObject, *result); return true; } if (name == pluginMethodIdentifiers[ID_DESTROY_NULL_STREAM]) return destroyNullStream(plugin, args, argCount, result); if (name == pluginMethodIdentifiers[ID_TEST_RELOAD_PLUGINS_NO_PAGES]) { browser->reloadplugins(false); return true; } if (name == pluginMethodIdentifiers[ID_TEST_RELOAD_PLUGINS_AND_PAGES]) { browser->reloadplugins(true); return true; } if (name == pluginMethodIdentifiers[ID_TEST_GET_BROWSER_PROPERTY]) { browser->getproperty(plugin->npp, NPVARIANT_TO_OBJECT(args[0]), stringVariantToIdentifier(args[1]), result); return true; } if (name == pluginMethodIdentifiers[ID_TEST_SET_BROWSER_PROPERTY]) { browser->setproperty(plugin->npp, NPVARIANT_TO_OBJECT(args[0]), stringVariantToIdentifier(args[1]), &args[2]); return true; } if (name == pluginMethodIdentifiers[ID_REMEMBER]) { if (plugin->rememberedObject) browser->releaseobject(plugin->rememberedObject); plugin->rememberedObject = NPVARIANT_TO_OBJECT(args[0]); browser->retainobject(plugin->rememberedObject); VOID_TO_NPVARIANT(*result); return true; } if (name == pluginMethodIdentifiers[ID_GET_REMEMBERED_OBJECT]) { assert(plugin->rememberedObject); browser->retainobject(plugin->rememberedObject); OBJECT_TO_NPVARIANT(plugin->rememberedObject, *result); return true; } if (name == pluginMethodIdentifiers[ID_GET_AND_FORGET_REMEMBERED_OBJECT]) { assert(plugin->rememberedObject); OBJECT_TO_NPVARIANT(plugin->rememberedObject, *result); plugin->rememberedObject = 0; return true; } if (name == pluginMethodIdentifiers[ID_REF_COUNT]) { uint32_t refCount = NPVARIANT_TO_OBJECT(args[0])->referenceCount; INT32_TO_NPVARIANT(refCount, *result); return true; } if (name == pluginMethodIdentifiers[ID_SET_STATUS]) return testSetStatus(plugin, args, argCount, result); if (name == pluginMethodIdentifiers[ID_RESIZE_TO]) return testResizeTo(plugin, args, argCount, result); if (name == pluginMethodIdentifiers[ID_NORMALIZE]) return normalizeOverride(plugin, args, argCount, result); if (name == pluginMethodIdentifiers[ID_INVALIDATE_RECT]) return invalidateRect(plugin, args, argCount, result); if (name == pluginMethodIdentifiers[ID_OBJECTS_ARE_SAME]) return objectsAreSame(plugin, args, argCount, result); return false; }