X-Git-Url: http://git.lukelau.me/?p=opengl.git;a=blobdiff_plain;f=image.cpp;h=1565b859142df1d3897932c4790026ab77a71825;hp=13174c08ae88dec5c6e5a44552dc681389e3a959;hb=9e43c799021b7bcca324b988aae44e98b05d10b4;hpb=a03f2bc751bbd7f91cbc2f52d2f0f6e753d6f776 diff --git a/image.cpp b/image.cpp index 13174c0..1565b85 100644 --- a/image.cpp +++ b/image.cpp @@ -6,18 +6,6 @@ Image::Image(const std::string &path) { CFURLRef url = CFURLCreateWithFileSystemPath(NULL, str, kCFURLPOSIXPathStyle, false); CGImageSourceRef source = CGImageSourceCreateWithURL(url, NULL); CGImageRef ref = CGImageSourceCreateImageAtIndex(source, 0, NULL); - /* auto provider = CGDataProviderCreateWithFilename(path.c_str()); */ - /* std::ifstream file(path); */ - /* long magic; */ - /* file.read((char*)&magic, 8); */ - /* file.close(); */ - - /* CGImageRef ref; */ - - /* if (magic == 0x0a1a0a0d474e5089) // png magic number */ - /* ref = CGImageCreateWithPNGDataProvider(provider, nullptr, false, kCGRenderingIntentDefault); */ - /* else */ - /* ref = CGImageCreateWithJPEGDataProvider(provider, nullptr, false, kCGRenderingIntentDefault); */ _width = CGImageGetWidth(ref), _height = CGImageGetHeight(ref); info = CGImageGetBitmapInfo(ref); @@ -36,6 +24,7 @@ unsigned char *Image::data() const { GLfloat Image::width() const { return _width; } GLfloat Image::height() const { return _height; } +// TODO: Properly implement this for both internal format + format GLuint Image::format() const { if (CGColorSpaceGetModel(colorSpace) == kCGColorSpaceModelMonochrome) { return GL_DEPTH_COMPONENT;