[macruby-changes] [3081] MacRuby/trunk/lib/hotcocoa/graphics/image.rb

source_changes at macosforge.org source_changes at macosforge.org
Mon Dec 7 18:20:33 PST 2009


Revision: 3081
          http://trac.macosforge.org/projects/ruby/changeset/3081
Author:   mattaimonetti at gmail.com
Date:     2009-12-07 18:20:31 -0800 (Mon, 07 Dec 2009)
Log Message:
-----------
HotCocoa Graphics optimizations provided by Alan Skipp

Modified Paths:
--------------
    MacRuby/trunk/lib/hotcocoa/graphics/image.rb

Property Changed:
----------------
    MacRuby/trunk/lib/hotcocoa/graphics/image.rb

Modified: MacRuby/trunk/lib/hotcocoa/graphics/image.rb
===================================================================
--- MacRuby/trunk/lib/hotcocoa/graphics/image.rb	2009-12-07 03:32:54 UTC (rev 3080)
+++ MacRuby/trunk/lib/hotcocoa/graphics/image.rb	2009-12-08 02:20:31 UTC (rev 3081)
@@ -58,11 +58,10 @@
         @path = img
         File.exists?(@path) or raise "ERROR: file not found: #{@path}"
 
-        nsimage = NSImage.alloc.initWithContentsOfFile(img)
-        nsdata = nsimage.TIFFRepresentation
-        @nsbitmapimage = NSBitmapImageRep.imageRepWithData(nsdata)
-        # cgimagesource = CGImageSourceCreateWithData(nsdata) # argh, doesn't work
-        @ciimage = CIImage.alloc.initWithBitmapImageRep(@nsbitmapimage)
+        image_source = CGImageSourceCreateWithURL(NSURL.fileURLWithPath(@path), nil)
+        @cgimage = CGImageSourceCreateImageAtIndex(image_source, 0, nil)
+        @ciimage = CIImage.imageWithCGImage(@cgimage)
+        
       when Canvas
         puts "Image.new with canvas" if @verbose
         @path = 'canvas'
@@ -80,7 +79,7 @@
   
     # reload the bitmap image
     def reset
-      @ciimage = CIImage.alloc.initWithBitmapImageRep(@nsbitmapimage)
+      @ciimage = CIImage.imageWithCGImage(@cgimage)
       self
     end
   


Property changes on: MacRuby/trunk/lib/hotcocoa/graphics/image.rb
___________________________________________________________________
Deleted: svn:executable
   - *
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20091207/697f4ee8/attachment.html>


More information about the macruby-changes mailing list