From e62ce17ac9726d6c169d5378db6027b2d8a16fcc Mon Sep 17 00:00:00 2001 From: Derek Sollenberger Date: Mon, 30 Nov 2009 11:52:06 -0500 Subject: [PATCH] Refactoring the logging interface to remove dependence on NPP. --- .../jni/animation/AnimationPlugin.cpp | 2 +- .../BrowserPlugin/jni/audio/AudioPlugin.cpp | 24 +++---- .../jni/background/BackgroundPlugin.cpp | 68 +++++++++---------- samples/BrowserPlugin/jni/form/FormPlugin.cpp | 10 +-- samples/BrowserPlugin/jni/main.cpp | 30 ++++---- .../BrowserPlugin/jni/paint/PaintPlugin.cpp | 8 +-- .../BrowserPlugin/jni/video/VideoPlugin.cpp | 16 ++--- 7 files changed, 79 insertions(+), 79 deletions(-) diff --git a/samples/BrowserPlugin/jni/animation/AnimationPlugin.cpp b/samples/BrowserPlugin/jni/animation/AnimationPlugin.cpp index b6175c161..72a11c978 100644 --- a/samples/BrowserPlugin/jni/animation/AnimationPlugin.cpp +++ b/samples/BrowserPlugin/jni/animation/AnimationPlugin.cpp @@ -85,7 +85,7 @@ BallAnimation::BallAnimation(NPP inst) : SubPlugin(inst) { ANPEventFlags flags = kTouch_ANPEventFlag; NPError err = browser->setvalue(inst, kAcceptEvents_ANPSetValue, &flags); if (err != NPERR_NO_ERROR) { - gLogI.log(inst, kError_ANPLogType, "Error selecting input events."); + gLogI.log(kError_ANPLogType, "Error selecting input events."); } } diff --git a/samples/BrowserPlugin/jni/audio/AudioPlugin.cpp b/samples/BrowserPlugin/jni/audio/AudioPlugin.cpp index 58d340cb3..9731f19b9 100644 --- a/samples/BrowserPlugin/jni/audio/AudioPlugin.cpp +++ b/samples/BrowserPlugin/jni/audio/AudioPlugin.cpp @@ -99,7 +99,7 @@ AudioPlugin::AudioPlugin(NPP inst) : SubPlugin(inst) { // open a file stream FILE* f = fopen(path, "r"); - gLogI.log(inst, kDebug_ANPLogType, "--- path %s FILE %p", path, f); + gLogI.log(kDebug_ANPLogType, "--- path %s FILE %p", path, f); // setup our private audio struct's default values m_soundPlay = new SoundPlay; @@ -123,13 +123,13 @@ AudioPlugin::AudioPlugin(NPP inst) : SubPlugin(inst) { struct stat fileStatus; if(fileDescriptor <= 0) { - gLogI.log(inst, kError_ANPLogType, "fopen error"); + gLogI.log(kError_ANPLogType, "fopen error"); } else if (fstat(fileDescriptor, &fileStatus) != 0) { - gLogI.log(inst, kDebug_ANPLogType, "File Size: %d", fileStatus.st_size); + gLogI.log(kDebug_ANPLogType, "File Size: %d", fileStatus.st_size); m_soundPlay->fileSize = fileStatus.st_size; } else { - gLogI.log(inst, kError_ANPLogType, "fstat error"); + gLogI.log(kError_ANPLogType, "fstat error"); } // configure the UI elements @@ -169,7 +169,7 @@ AudioPlugin::AudioPlugin(NPP inst) : SubPlugin(inst) { ANPEventFlags flags = kTouch_ANPEventFlag; NPError err = browser->setvalue(inst, kAcceptEvents_ANPSetValue, &flags); if (err != NPERR_NO_ERROR) { - gLogI.log(inst, kError_ANPLogType, "Error selecting input events."); + gLogI.log(kError_ANPLogType, "Error selecting input events."); } } @@ -203,10 +203,10 @@ void AudioPlugin::drawPlugin(const ANPBitmap& bitmap, const ANPRectI& clip) { } void AudioPlugin::draw(ANPCanvas* canvas) { - NPP instance = this->inst(); - PluginObject *obj = (PluginObject*) instance->pdata; - gLogI.log(instance, kError_ANPLogType, "Drawing"); + PluginObject *obj = (PluginObject*) this->inst()->pdata; + + gLogI.log(kError_ANPLogType, "Drawing"); const float trackHeight = 30; const float buttonWidth = 60; @@ -332,7 +332,7 @@ void AudioPlugin::handleTouch(int x, int y) { // if the track is null then return if (NULL == m_soundPlay->track) { - gLogI.log(instance, kError_ANPLogType, "---- %p unable to create track", + gLogI.log(kError_ANPLogType, "---- %p unable to create track", instance); return; } @@ -344,7 +344,7 @@ void AudioPlugin::handleTouch(int x, int y) { if (currentRect == &m_playRect) { - gLogI.log(instance, kDebug_ANPLogType, "---- %p starting track (%d)", + gLogI.log(kDebug_ANPLogType, "---- %p starting track (%d)", m_soundPlay->track, gSoundI.isStopped(m_soundPlay->track)); if (gSoundI.isStopped(m_soundPlay->track)) { @@ -353,7 +353,7 @@ void AudioPlugin::handleTouch(int x, int y) { } else if (currentRect == &m_pauseRect) { - gLogI.log(instance, kDebug_ANPLogType, "---- %p pausing track (%d)", + gLogI.log(kDebug_ANPLogType, "---- %p pausing track (%d)", m_soundPlay->track, gSoundI.isStopped(m_soundPlay->track)); if (!gSoundI.isStopped(m_soundPlay->track)) { @@ -362,7 +362,7 @@ void AudioPlugin::handleTouch(int x, int y) { } else if (currentRect == &m_stopRect) { - gLogI.log(instance, kDebug_ANPLogType, "---- %p stopping track (%d)", + gLogI.log(kDebug_ANPLogType, "---- %p stopping track (%d)", m_soundPlay->track, gSoundI.isStopped(m_soundPlay->track)); if (!gSoundI.isStopped(m_soundPlay->track)) { diff --git a/samples/BrowserPlugin/jni/background/BackgroundPlugin.cpp b/samples/BrowserPlugin/jni/background/BackgroundPlugin.cpp index 0f90291ef..69e485419 100644 --- a/samples/BrowserPlugin/jni/background/BackgroundPlugin.cpp +++ b/samples/BrowserPlugin/jni/background/BackgroundPlugin.cpp @@ -111,7 +111,7 @@ void BackgroundPlugin::drawPlugin(int surfaceWidth, int surfaceHeight) { // check to make sure the zoom level is uniform if (zoomFactorW + .01 < zoomFactorH && zoomFactorW - .01 > zoomFactorH) - gLogI.log(inst(), kError_ANPLogType, " ------ %p zoom is out of sync (%f,%f)", + gLogI.log(kError_ANPLogType, " ------ %p zoom is out of sync (%f,%f)", inst(), zoomFactorW, zoomFactorH); // scale the variables based on the zoom level @@ -123,7 +123,7 @@ void BackgroundPlugin::drawPlugin(int surfaceWidth, int surfaceHeight) { JNIEnv* env = NULL; if (!m_surface || gVM->GetEnv((void**) &env, JNI_VERSION_1_4) != JNI_OK || !gSurfaceI.lock(env, m_surface, &bitmap, NULL)) { - gLogI.log(inst(), kError_ANPLogType, " ------ %p unable to lock the plugin", inst()); + gLogI.log(kError_ANPLogType, " ------ %p unable to lock the plugin", inst()); return; } @@ -156,19 +156,19 @@ void BackgroundPlugin::drawPlugin(int surfaceWidth, int surfaceHeight) { int16 BackgroundPlugin::handleEvent(const ANPEvent* evt) { switch (evt->eventType) { case kDraw_ANPEventType: - gLogI.log(inst(), kError_ANPLogType, " ------ %p the plugin did not request draw events", inst()); + gLogI.log(kError_ANPLogType, " ------ %p the plugin did not request draw events", inst()); break; case kLifecycle_ANPEventType: if (evt->data.lifecycle.action == kOnLoad_ANPLifecycleAction) { - gLogI.log(inst(), kDebug_ANPLogType, " ------ %p the plugin received an onLoad event", inst()); + gLogI.log(kDebug_ANPLogType, " ------ %p the plugin received an onLoad event", inst()); return 1; } break; case kTouch_ANPEventType: - gLogI.log(inst(), kError_ANPLogType, " ------ %p the plugin did not request touch events", inst()); + gLogI.log(kError_ANPLogType, " ------ %p the plugin did not request touch events", inst()); break; case kKey_ANPEventType: - gLogI.log(inst(), kError_ANPLogType, " ------ %p the plugin did not request key events", inst()); + gLogI.log(kError_ANPLogType, " ------ %p the plugin did not request key events", inst()); break; default: break; @@ -185,9 +185,9 @@ void BackgroundPlugin::test_logging() { NPP instance = this->inst(); //LOG_ERROR(instance, " ------ %p Testing Log Error", instance); - gLogI.log(instance, kError_ANPLogType, " ------ %p Testing Log Error", instance); - gLogI.log(instance, kWarning_ANPLogType, " ------ %p Testing Log Warning", instance); - gLogI.log(instance, kDebug_ANPLogType, " ------ %p Testing Log Debug", instance); + gLogI.log(kError_ANPLogType, " ------ %p Testing Log Error", instance); + gLogI.log(kWarning_ANPLogType, " ------ %p Testing Log Warning", instance); + gLogI.log(kDebug_ANPLogType, " ------ %p Testing Log Debug", instance); } /////////////////////////////////////////////////////////////////////////////// @@ -225,13 +225,13 @@ void BackgroundPlugin::test_timers() { } static void timer_oneshot(NPP instance, uint32 timerID) { - gLogI.log(instance, kDebug_ANPLogType, "-------- oneshot timer\n"); + gLogI.log(kDebug_ANPLogType, "-------- oneshot timer\n"); } static void timer_repeat(NPP instance, uint32 timerID) { BackgroundPlugin *obj = ((BackgroundPlugin*) ((PluginObject*) instance->pdata)->activePlugin); - gLogI.log(instance, kDebug_ANPLogType, "-------- repeat timer %d\n", + gLogI.log(kDebug_ANPLogType, "-------- repeat timer %d\n", obj->mTimerRepeatCount); if (--obj->mTimerRepeatCount == 0) { browser->unscheduletimer(instance, timerID); @@ -239,7 +239,7 @@ static void timer_repeat(NPP instance, uint32 timerID) { } static void timer_neverfires(NPP instance, uint32 timerID) { - gLogI.log(instance, kError_ANPLogType, "-------- timer_neverfires!!!\n"); + gLogI.log(kError_ANPLogType, "-------- timer_neverfires!!!\n"); } static void timer_latency(NPP instance, uint32 timerID) { @@ -256,7 +256,7 @@ static void timer_latency(NPP instance, uint32 timerID) { obj->mPrevTime = now; - gLogI.log(instance, kDebug_ANPLogType, + gLogI.log(kDebug_ANPLogType, "-------- latency test: [%3d] interval %d expected %d, total %d expected %d, drift %d avg %d\n", obj->mTimerLatencyCurrentCount, interval, TIMER_INTERVAL, dur, expectedDur, drift, avgDrift); @@ -291,7 +291,7 @@ static void test_formats(NPP instance) { ANPPixelPacking packing; for (size_t i = 0; i < ARRAY_COUNT(gRecs); i++) { if (gBitmapI.getPixelPacking(gRecs[i].fFormat, &packing)) { - gLogI.log(instance, kDebug_ANPLogType, + gLogI.log(kDebug_ANPLogType, "pixel format [%d] %s has packing ARGB [%d %d] [%d %d] [%d %d] [%d %d]\n", gRecs[i].fFormat, gRecs[i].fName, packing.AShift, packing.ABits, @@ -299,7 +299,7 @@ static void test_formats(NPP instance) { packing.GShift, packing.GBits, packing.BShift, packing.BBits); } else { - gLogI.log(instance, kDebug_ANPLogType, + gLogI.log(kDebug_ANPLogType, "pixel format [%d] %s has no packing\n", gRecs[i].fFormat, gRecs[i].fName); } @@ -312,18 +312,18 @@ void BackgroundPlugin::test_bitmap_transparency(const ANPEvent* evt) { // check default & set transparent if (!mFinishedStageOne) { - gLogI.log(instance, kDebug_ANPLogType, "BEGIN: testing bitmap transparency"); + gLogI.log(kDebug_ANPLogType, "BEGIN: testing bitmap transparency"); //check to make sure it is not transparent if (evt->data.draw.data.bitmap.format == kRGBA_8888_ANPBitmapFormat) { - gLogI.log(instance, kError_ANPLogType, "bitmap default format is transparent"); + gLogI.log(kError_ANPLogType, "bitmap default format is transparent"); } //make it transparent (any non-null value will set it to true) bool value = true; NPError err = browser->setvalue(instance, NPPVpluginTransparentBool, &value); if (err != NPERR_NO_ERROR) { - gLogI.log(instance, kError_ANPLogType, "Error setting transparency."); + gLogI.log(kError_ANPLogType, "Error setting transparency."); } mFinishedStageOne = true; @@ -334,13 +334,13 @@ void BackgroundPlugin::test_bitmap_transparency(const ANPEvent* evt) { //check to make sure it is transparent if (evt->data.draw.data.bitmap.format != kRGBA_8888_ANPBitmapFormat) { - gLogI.log(instance, kError_ANPLogType, "bitmap did not change to transparent format"); + gLogI.log(kError_ANPLogType, "bitmap did not change to transparent format"); } //make it opaque NPError err = browser->setvalue(instance, NPPVpluginTransparentBool, NULL); if (err != NPERR_NO_ERROR) { - gLogI.log(instance, kError_ANPLogType, "Error setting transparency."); + gLogI.log(kError_ANPLogType, "Error setting transparency."); } mFinishedStageTwo = true; @@ -350,10 +350,10 @@ void BackgroundPlugin::test_bitmap_transparency(const ANPEvent* evt) { //check to make sure it is not transparent if (evt->data.draw.data.bitmap.format == kRGBA_8888_ANPBitmapFormat) { - gLogI.log(instance, kError_ANPLogType, "bitmap default format is transparent"); + gLogI.log(kError_ANPLogType, "bitmap default format is transparent"); } - gLogI.log(instance, kDebug_ANPLogType, "END: testing bitmap transparency"); + gLogI.log(kDebug_ANPLogType, "END: testing bitmap transparency"); mFinishedStageThree = true; } @@ -366,14 +366,14 @@ void BackgroundPlugin::test_bitmap_transparency(const ANPEvent* evt) { void BackgroundPlugin::test_domAccess() { NPP instance = this->inst(); - gLogI.log(instance, kDebug_ANPLogType, " ------ %p Testing DOM Access", instance); + gLogI.log(kDebug_ANPLogType, " ------ %p Testing DOM Access", instance); // Get the plugin's DOM object NPObject* windowObject = NULL; browser->getvalue(instance, NPNVWindowNPObject, &windowObject); if (!windowObject) - gLogI.log(instance, kError_ANPLogType, " ------ %p Unable to retrieve DOM Window", instance); + gLogI.log(kError_ANPLogType, " ------ %p Unable to retrieve DOM Window", instance); // Retrieve a property from the plugin's DOM object NPIdentifier topIdentifier = browser->getstringidentifier("top"); @@ -381,7 +381,7 @@ void BackgroundPlugin::test_domAccess() { browser->getproperty(instance, windowObject, topIdentifier, &topObjectVariant); if (topObjectVariant.type != NPVariantType_Object) - gLogI.log(instance, kError_ANPLogType, " ------ %p Invalid Variant type for DOM Property: %d,%d", instance, topObjectVariant.type, NPVariantType_Object); + gLogI.log(kError_ANPLogType, " ------ %p Invalid Variant type for DOM Property: %d,%d", instance, topObjectVariant.type, NPVariantType_Object); } @@ -393,14 +393,14 @@ void BackgroundPlugin::test_domAccess() { void BackgroundPlugin::test_javascript() { NPP instance = this->inst(); - gLogI.log(instance, kDebug_ANPLogType, " ------ %p Testing JavaScript Access", instance); + gLogI.log(kDebug_ANPLogType, " ------ %p Testing JavaScript Access", instance); // Get the plugin's DOM object NPObject* windowObject = NULL; browser->getvalue(instance, NPNVWindowNPObject, &windowObject); if (!windowObject) - gLogI.log(instance, kError_ANPLogType, " ------ %p Unable to retrieve DOM Window", instance); + gLogI.log(kError_ANPLogType, " ------ %p Unable to retrieve DOM Window", instance); // create a string (JS code) that is stored in memory allocated by the browser const char* jsString = "1200 + 34"; @@ -411,13 +411,13 @@ void BackgroundPlugin::test_javascript() { NPString script = { (char*)stringMem, strlen(jsString) }; NPVariant scriptVariant; if (!browser->evaluate(instance, windowObject, &script, &scriptVariant)) - gLogI.log(instance, kError_ANPLogType, " ------ %p Unable to eval the JS.", instance); + gLogI.log(kError_ANPLogType, " ------ %p Unable to eval the JS.", instance); if (scriptVariant.type == NPVariantType_Int32) { if (scriptVariant.value.intValue != 1234) - gLogI.log(instance, kError_ANPLogType, " ------ %p Invalid Value for JS Return: %d,1234", instance, scriptVariant.value.intValue); + gLogI.log(kError_ANPLogType, " ------ %p Invalid Value for JS Return: %d,1234", instance, scriptVariant.value.intValue); } else { - gLogI.log(instance, kError_ANPLogType, " ------ %p Invalid Variant type for JS Return: %d,%d", instance, scriptVariant.type, NPVariantType_Int32); + gLogI.log(kError_ANPLogType, " ------ %p Invalid Variant type for JS Return: %d,%d", instance, scriptVariant.type, NPVariantType_Int32); } // free the memory allocated within the browser @@ -432,7 +432,7 @@ void BackgroundPlugin::test_loadJavaClass() { JNIEnv* env = NULL; if (gVM->GetEnv((void**) &env, JNI_VERSION_1_4) != JNI_OK) { - gLogI.log(inst(), kError_ANPLogType, " ---- LoadJavaTest: failed to get env"); + gLogI.log(kError_ANPLogType, " ---- LoadJavaTest: failed to get env"); return; } @@ -440,7 +440,7 @@ void BackgroundPlugin::test_loadJavaClass() { jclass backgroundClass = gSystemI.loadJavaClass(inst(), className); if(!backgroundClass) { - gLogI.log(inst(), kError_ANPLogType, " ---- LoadJavaTest: failed to load class"); + gLogI.log(kError_ANPLogType, " ---- LoadJavaTest: failed to load class"); return; } @@ -449,13 +449,13 @@ void BackgroundPlugin::test_loadJavaClass() { jobject backgroundObject = env->NewObject(backgroundClass, constructor); if(!backgroundObject) { - gLogI.log(inst(), kError_ANPLogType, " ---- LoadJavaTest: failed to construct object"); + gLogI.log(kError_ANPLogType, " ---- LoadJavaTest: failed to construct object"); return; } jint result = env->CallIntMethod(backgroundObject, addMethod, 2, 2); if (result != 4) { - gLogI.log(inst(), kError_ANPLogType, " ---- LoadJavaTest: invalid result (%d != 4)", result); + gLogI.log(kError_ANPLogType, " ---- LoadJavaTest: invalid result (%d != 4)", result); } } diff --git a/samples/BrowserPlugin/jni/form/FormPlugin.cpp b/samples/BrowserPlugin/jni/form/FormPlugin.cpp index a92d447a2..5a536d9af 100644 --- a/samples/BrowserPlugin/jni/form/FormPlugin.cpp +++ b/samples/BrowserPlugin/jni/form/FormPlugin.cpp @@ -100,7 +100,7 @@ FormPlugin::FormPlugin(NPP inst) : SubPlugin(inst) { ANPEventFlags flags = kKey_ANPEventFlag; NPError err = browser->setvalue(inst, kAcceptEvents_ANPSetValue, &flags); if (err != NPERR_NO_ERROR) { - gLogI.log(inst, kError_ANPLogType, "Error selecting input events."); + gLogI.log(kError_ANPLogType, "Error selecting input events."); } } @@ -215,7 +215,7 @@ int16 FormPlugin::handleEvent(const ANPEvent* evt) { case kLifecycle_ANPEventType: if (evt->data.lifecycle.action == kLoseFocus_ANPLifecycleAction) { - gLogI.log(instance, kDebug_ANPLogType, "----%p Loosing Focus", instance); + gLogI.log(kDebug_ANPLogType, "----%p Loosing Focus", instance); if (m_activeInput) { // hide the keyboard @@ -230,7 +230,7 @@ int16 FormPlugin::handleEvent(const ANPEvent* evt) { return 1; } else if (evt->data.lifecycle.action == kGainFocus_ANPLifecycleAction) { - gLogI.log(instance, kDebug_ANPLogType, "----%p Gaining Focus", instance); + gLogI.log(kDebug_ANPLogType, "----%p Gaining Focus", instance); m_hasFocus = true; inval(instance); return 1; @@ -300,7 +300,7 @@ void FormPlugin::switchActiveInput(TextInput* newInput) { bool FormPlugin::handleNavigation(ANPKeyCode keyCode) { NPP instance = this->inst(); - gLogI.log(instance, kDebug_ANPLogType, "----%p Recvd Nav Key %d", instance, keyCode); + gLogI.log(kDebug_ANPLogType, "----%p Recvd Nav Key %d", instance, keyCode); if (!m_activeInput) { gWindowI.showKeyboard(instance, true); @@ -350,7 +350,7 @@ void FormPlugin::handleTextInput(TextInput* input, ANPKeyCode keyCode, int32_t u input->text[input->charPtr] = static_cast(unichar); input->charPtr++; - gLogI.log(instance, kDebug_ANPLogType, "----%p Text: %c", instance, unichar); + gLogI.log(kDebug_ANPLogType, "----%p Text: %c", instance, unichar); } void FormPlugin::scrollIntoView(TextInput* input) { diff --git a/samples/BrowserPlugin/jni/main.cpp b/samples/BrowserPlugin/jni/main.cpp index af7a58961..5bbb648c3 100644 --- a/samples/BrowserPlugin/jni/main.cpp +++ b/samples/BrowserPlugin/jni/main.cpp @@ -173,7 +173,7 @@ NPError NPP_New(NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc, else if (!strcmp(argv[i], "Surface")) { model = kSurface_ANPDrawingModel; } - gLogI.log(instance, kDebug_ANPLogType, "------ %p DrawingModel is %d", instance, model); + gLogI.log(kDebug_ANPLogType, "------ %p DrawingModel is %d", instance, model); break; } } @@ -183,15 +183,15 @@ NPError NPP_New(NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc, NPError err = browser->setvalue(instance, kRequestDrawingModel_ANPSetValue, reinterpret_cast(model)); if (err) { - gLogI.log(instance, kError_ANPLogType, "request model %d err %d", model, err); + gLogI.log(kError_ANPLogType, "request model %d err %d", model, err); return err; } const char* path = gSystemI.getApplicationDataDirectory(); if (path) { - gLogI.log(instance, kDebug_ANPLogType, "Application data dir is %s", path); + gLogI.log(kDebug_ANPLogType, "Application data dir is %s", path); } else { - gLogI.log(instance, kError_ANPLogType, "Can't find Application data dir"); + gLogI.log(kError_ANPLogType, "Can't find Application data dir"); } // select the pluginType @@ -221,21 +221,21 @@ NPError NPP_New(NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc, obj->pluginType = kVideo_PluginType; obj->activePlugin = new VideoPlugin(instance); } - gLogI.log(instance, kDebug_ANPLogType, "------ %p PluginType is %d", instance, obj->pluginType); + gLogI.log(kDebug_ANPLogType, "------ %p PluginType is %d", instance, obj->pluginType); break; } } // if no pluginType is specified then default to Animation if (!obj->pluginType) { - gLogI.log(instance, kError_ANPLogType, "------ %p No PluginType attribute was found", instance); + gLogI.log(kError_ANPLogType, "------ %p No PluginType attribute was found", instance); obj->pluginType = kAnimation_PluginType; obj->activePlugin = new BallAnimation(instance); } // check to ensure the pluginType supports the model if (!obj->activePlugin->supportsDrawingModel(model)) { - gLogI.log(instance, kError_ANPLogType, "------ %p Unsupported DrawingModel (%d)", instance, model); + gLogI.log(kError_ANPLogType, "------ %p Unsupported DrawingModel (%d)", instance, model); return NPERR_GENERIC_ERROR; } @@ -307,7 +307,7 @@ int16 NPP_HandleEvent(NPP instance, void* event) static ANPBitmapFormat currentFormat = -1; if (evt->data.draw.data.bitmap.format != currentFormat) { currentFormat = evt->data.draw.data.bitmap.format; - gLogI.log(instance, kDebug_ANPLogType, "---- %p Draw (bitmap)" + gLogI.log(kDebug_ANPLogType, "---- %p Draw (bitmap)" " clip=%d,%d,%d,%d format=%d", instance, evt->data.draw.clip.left, evt->data.draw.clip.top, @@ -319,7 +319,7 @@ int16 NPP_HandleEvent(NPP instance, void* event) break; case kKey_ANPEventType: - gLogI.log(instance, kDebug_ANPLogType, "---- %p Key action=%d" + gLogI.log(kDebug_ANPLogType, "---- %p Key action=%d" " code=%d vcode=%d unichar=%d repeat=%d mods=%x", instance, evt->data.key.action, evt->data.key.nativeCode, @@ -330,37 +330,37 @@ int16 NPP_HandleEvent(NPP instance, void* event) break; case kLifecycle_ANPEventType: - gLogI.log(instance, kDebug_ANPLogType, "---- %p Lifecycle action=%d", + gLogI.log(kDebug_ANPLogType, "---- %p Lifecycle action=%d", instance, evt->data.lifecycle.action); break; case kTouch_ANPEventType: - gLogI.log(instance, kDebug_ANPLogType, "---- %p Touch action=%d [%d %d]", + gLogI.log(kDebug_ANPLogType, "---- %p Touch action=%d [%d %d]", instance, evt->data.touch.action, evt->data.touch.x, evt->data.touch.y); break; case kMouse_ANPEventType: - gLogI.log(instance, kDebug_ANPLogType, "---- %p Mouse action=%d [%d %d]", + gLogI.log(kDebug_ANPLogType, "---- %p Mouse action=%d [%d %d]", instance, evt->data.mouse.action, evt->data.mouse.x, evt->data.mouse.y); break; case kVisibleRect_ANPEventType: - gLogI.log(instance, kDebug_ANPLogType, "---- %p VisibleRect [%d %d %d %d]", + gLogI.log(kDebug_ANPLogType, "---- %p VisibleRect [%d %d %d %d]", instance, evt->data.visibleRect.rect.left, evt->data.visibleRect.rect.top, evt->data.visibleRect.rect.right, evt->data.visibleRect.rect.bottom); break; default: - gLogI.log(instance, kError_ANPLogType, "---- %p Unknown Event [%d]", + gLogI.log(kError_ANPLogType, "---- %p Unknown Event [%d]", instance, evt->eventType); break; } #endif if(!obj->activePlugin) { - gLogI.log(instance, kError_ANPLogType, "the active plugin is null."); + gLogI.log(kError_ANPLogType, "the active plugin is null."); return 0; // unknown or unhandled event } else { diff --git a/samples/BrowserPlugin/jni/paint/PaintPlugin.cpp b/samples/BrowserPlugin/jni/paint/PaintPlugin.cpp index 11f00fee1..80f05e4b8 100644 --- a/samples/BrowserPlugin/jni/paint/PaintPlugin.cpp +++ b/samples/BrowserPlugin/jni/paint/PaintPlugin.cpp @@ -56,7 +56,7 @@ PaintPlugin::PaintPlugin(NPP inst) : SurfaceSubPlugin(inst) { // initialize the path m_touchPath = gPathI.newPath(); if(!m_touchPath) - gLogI.log(inst, kError_ANPLogType, "----%p Unable to create the touch path", inst); + gLogI.log(kError_ANPLogType, "----%p Unable to create the touch path", inst); // initialize the paint colors m_paintSurface = gPaintI.newPaint(); @@ -77,7 +77,7 @@ PaintPlugin::PaintPlugin(NPP inst) : SurfaceSubPlugin(inst) { ANPEventFlags flags = kTouch_ANPEventFlag; NPError err = browser->setvalue(inst, kAcceptEvents_ANPSetValue, &flags); if (err != NPERR_NO_ERROR) { - gLogI.log(inst, kError_ANPLogType, "Error selecting input events."); + gLogI.log(kError_ANPLogType, "Error selecting input events."); } } @@ -227,7 +227,7 @@ void PaintPlugin::surfaceChanged(int format, int width, int height) { const int pH = obj->window->height; // compare to the plugin's surface dimensions if (pW != width || pH != height) - gLogI.log(inst(), kError_ANPLogType, + gLogI.log(kError_ANPLogType, "----%p Invalid Surface Dimensions (%d,%d):(%d,%d)", inst(), pW, pH, width, height); } @@ -275,7 +275,7 @@ int16 PaintPlugin::handleEvent(const ANPEvent* evt) { case kMouse_ANPEventType: { if (m_isTouchActive) - gLogI.log(inst(), kError_ANPLogType, "----%p Received unintended mouse event", inst()); + gLogI.log(kError_ANPLogType, "----%p Received unintended mouse event", inst()); if (kDown_ANPMouseAction == evt->data.mouse.action) { ANPRectF* rect = validTouch(evt->data.mouse.x, evt->data.mouse.y); diff --git a/samples/BrowserPlugin/jni/video/VideoPlugin.cpp b/samples/BrowserPlugin/jni/video/VideoPlugin.cpp index 2609af67c..2227a1187 100644 --- a/samples/BrowserPlugin/jni/video/VideoPlugin.cpp +++ b/samples/BrowserPlugin/jni/video/VideoPlugin.cpp @@ -39,7 +39,7 @@ extern ANPLogInterfaceV0 gLogI; extern ANPPaintInterfaceV0 gPaintI; extern ANPSurfaceInterfaceV0 gSurfaceI; extern ANPTypefaceInterfaceV0 gTypefaceI; -extern ANPWindowInterfaceV0 gWindowI; +extern ANPWindowInterfaceV0 gWindowI; /////////////////////////////////////////////////////////////////////////////// @@ -52,7 +52,7 @@ VideoPlugin::VideoPlugin(NPP inst) : SurfaceSubPlugin(inst) { ANPEventFlags flags = kTouch_ANPEventFlag; NPError err = browser->setvalue(inst, kAcceptEvents_ANPSetValue, &flags); if (err != NPERR_NO_ERROR) { - gLogI.log(inst, kError_ANPLogType, "Error selecting input events."); + gLogI.log(kError_ANPLogType, "Error selecting input events."); } } @@ -74,7 +74,7 @@ void VideoPlugin::surfaceCreated(jobject surface) { } void VideoPlugin::surfaceChanged(int format, int width, int height) { - gLogI.log(inst(), kDebug_ANPLogType, "----%p SurfaceChanged Event: %d", + gLogI.log(kDebug_ANPLogType, "----%p SurfaceChanged Event: %d", inst(), format); drawPlugin(); } @@ -93,7 +93,7 @@ void VideoPlugin::drawPlugin() { JNIEnv* env = NULL; if (!m_surface || gVM->GetEnv((void**) &env, JNI_VERSION_1_4) != JNI_OK || !gSurfaceI.lock(env, m_surface, &bitmap, NULL)) { - gLogI.log(inst(), kError_ANPLogType, "----%p Unable to Lock Surface", inst()); + gLogI.log(kError_ANPLogType, "----%p Unable to Lock Surface", inst()); return; } @@ -106,7 +106,7 @@ void VideoPlugin::drawPlugin() { // compare DOM dimensions to the plugin's surface dimensions if (pW != bitmap.width || pH != bitmap.height) - gLogI.log(inst(), kError_ANPLogType, + gLogI.log(kError_ANPLogType, "----%p Invalid Surface Dimensions (%d,%d):(%d,%d)", inst(), pW, pH, bitmap.width, bitmap.height); @@ -141,16 +141,16 @@ void VideoPlugin::drawPlugin() { int16 VideoPlugin::handleEvent(const ANPEvent* evt) { switch (evt->eventType) { case kDraw_ANPEventType: - gLogI.log(inst(), kError_ANPLogType, " ------ %p the plugin did not request draw events", inst()); + gLogI.log(kError_ANPLogType, " ------ %p the plugin did not request draw events", inst()); break; case kTouch_ANPEventType: if (kDown_ANPTouchAction == evt->data.touch.action) { - gLogI.log(inst(), kDebug_ANPLogType, " ------ %p requesting fullscreen mode", inst()); + gLogI.log(kDebug_ANPLogType, " ------ %p requesting fullscreen mode", inst()); gWindowI.requestFullScreen(inst()); } return 1; case kKey_ANPEventType: - gLogI.log(inst(), kError_ANPLogType, " ------ %p the plugin did not request key events", inst()); + gLogI.log(kError_ANPLogType, " ------ %p the plugin did not request key events", inst()); break; default: break;