]> git.tdb.fi Git - libs/gui.git/blobdiff - source/graphics/quartz/quartzloader.cpp
Add some state checking to ImageLoader
[libs/gui.git] / source / graphics / quartz / quartzloader.cpp
index 1fc93ad2b3d36252a1e487e40ac82ad04d80c676..472e066f49665a64356cf1c50d93fba878589487 100644 (file)
@@ -1,7 +1,5 @@
 #include <algorithm>
-#include <CoreGraphics/CGColorSpace.h>
-#include <CoreGraphics/CGImage.h>
-#include <ImageIO/CGImageSource.h>
+#include <ApplicationServices/ApplicationServices.h>
 // Avoid messing up sigc++ headers
 #undef nil
 #include "quartzloader.h"
@@ -57,8 +55,6 @@ struct QuartzLoader::Private
 };
 
 
-ImageLoader::Register<QuartzLoader> QuartzLoader::reg;
-
 QuartzLoader::QuartzLoader(IO::Seekable &io):
        priv(new Private)
 {
@@ -85,7 +81,7 @@ bool QuartzLoader::detect(const string &sig)
        return status==kCGImageStatusIncomplete || status==kCGImageStatusReadingHeader;
 }
 
-void QuartzLoader::load(Image::Data &data)
+void QuartzLoader::load_(Image::Data &data)
 {
        CGImageRef image = CGImageSourceCreateImageAtIndex(priv->source, 0, 0);
        if(!image)
@@ -116,10 +112,10 @@ void QuartzLoader::load(Image::Data &data)
 
                CGDataProviderRef dp = CGImageGetDataProvider(image);
                CFDataRef image_data = CGDataProviderCopyData(dp);
-               data.data = new char[data.height*data.stride];
+               data.pixels = new char[data.height*data.stride];
                unsigned offset = (alpha==kCGImageAlphaNoneSkipFirst);
                CFRange range = CFRangeMake(offset, CFDataGetLength(image_data)-offset);
-               CFDataGetBytes(image_data, range, reinterpret_cast<UInt8 *>(data.data));
+               CFDataGetBytes(image_data, range, reinterpret_cast<UInt8 *>(data.pixels));
                CFRelease(image_data);
 
                CFRelease(image);