2008-12-12 Anders Carlsson <andersca@apple.com>
authorandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 13 Dec 2008 00:00:27 +0000 (00:00 +0000)
committerandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 13 Dec 2008 00:00:27 +0000 (00:00 +0000)
        Reviewed by Darin Adler.

        There's no need to hold on to the QCComposition. Also, toggle between a gold and silver compass
        when a mouse button is pressed.

        * NetscapeCoreAnimationPlugin/Composition.qtz:
        * NetscapeCoreAnimationPlugin/main.m:
        (NPP_Destroy):
        (handleMouseClick):
        (NPP_GetValue):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@39256 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebKitExamplePlugins/ChangeLog
WebKitExamplePlugins/NetscapeCoreAnimationPlugin/Composition.qtz
WebKitExamplePlugins/NetscapeCoreAnimationPlugin/main.m

index 98dad4e..db2e810 100644 (file)
@@ -1,5 +1,18 @@
 2008-12-12  Anders Carlsson  <andersca@apple.com>
 
+        Reviewed by Darin Adler.
+
+        There's no need to hold on to the QCComposition. Also, toggle between a gold and silver compass 
+        when a mouse button is pressed.
+        
+        * NetscapeCoreAnimationPlugin/Composition.qtz:
+        * NetscapeCoreAnimationPlugin/main.m:
+        (NPP_Destroy):
+        (handleMouseClick):
+        (NPP_GetValue):
+
+2008-12-12  Anders Carlsson  <andersca@apple.com>
+
         Revert some accidentally committed changes.
         
         * NetscapeCocoaPlugin/NetscapeCocoaPlugin.xcodeproj/project.pbxproj:
index 731376a..53c0843 100644 (file)
Binary files a/WebKitExamplePlugins/NetscapeCoreAnimationPlugin/Composition.qtz and b/WebKitExamplePlugins/NetscapeCoreAnimationPlugin/Composition.qtz differ
index b620ba5..1f9e96b 100644 (file)
@@ -49,9 +49,8 @@ typedef struct PluginObject
     
     NPWindow window;
     
-    QCComposition *composition;
-    CALayer *layer;
-    
+    QCCompositionLayer *layer;
+    bool gold;
 } PluginObject;
 
 NPError NPP_New(NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc, char* argn[], char* argv[], NPSavedData* saved);
@@ -145,7 +144,6 @@ NPError NPP_Destroy(NPP instance, NPSavedData** save)
     // Free per-instance storage
     PluginObject *obj = instance->pdata;
 
-    [obj->composition release];
     [obj->layer release];
     
     free(obj);
@@ -194,6 +192,9 @@ void NPP_Print(NPP instance, NPPrint* platformPrint)
 
 static void handleMouseClick(PluginObject *obj, NPCocoaEvent *event)
 {
+    obj->gold = !obj->gold;
+    
+    [obj->layer setValue:[NSNumber numberWithBool:obj->gold] forInputKey:@"gold"];
 }
 
 int16 NPP_HandleEvent(NPP instance, void* event)
@@ -224,9 +225,9 @@ NPError NPP_GetValue(NPP instance, NPPVariable variable, void *value)
         case NPPVpluginCoreAnimationLayer:
             if (!obj->layer) {
                 NSString *path = [[NSBundle bundleWithIdentifier:@"com.apple.netscapecoreanimationplugin"] pathForResource:@"Composition" ofType:@"qtz"];
-                
-                obj->composition = [[QCComposition compositionWithFile:path] retain];
-                obj->layer = [[QCCompositionLayer compositionLayerWithComposition:obj->composition] retain];
+
+                QCComposition *composition = [QCComposition compositionWithFile:path];
+                obj->layer = [[QCCompositionLayer compositionLayerWithComposition:composition] retain];
             }
             
             // Make sure to return a retained layer