From be2d80abcac0d88bb2a2be2551f895fbf5e05e43 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Mon, 21 Oct 2013 09:56:57 +0000 Subject: [PATCH] Build fixes for clang --- src/osgPlugins/imageio/ReaderWriterImageIO.cpp | 14 +++++++------- src/osgPlugins/vtf/ReaderWriterVTF.cpp | 2 +- src/osgPlugins/x/directx.cpp | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/osgPlugins/imageio/ReaderWriterImageIO.cpp b/src/osgPlugins/imageio/ReaderWriterImageIO.cpp index 395adcfdb..aea340d4f 100644 --- a/src/osgPlugins/imageio/ReaderWriterImageIO.cpp +++ b/src/osgPlugins/imageio/ReaderWriterImageIO.cpp @@ -262,7 +262,7 @@ osg::Image* CreateOSGImageFromCGImage(CGImageRef image_ref) size_t the_width = CGImageGetWidth(image_ref); size_t the_height = CGImageGetHeight(image_ref); - CGRect the_rect = {{0, 0}, {the_width, the_height}}; + CGRect the_rect = {{0.0f, 0.0f}, {static_cast(the_width), static_cast(the_height)}}; size_t bits_per_pixel = CGImageGetBitsPerPixel(image_ref); size_t bytes_per_row = CGImageGetBytesPerRow(image_ref); @@ -374,7 +374,7 @@ osg::Image* CreateOSGImageFromCGImage(CGImageRef image_ref) } } - + // Sets up a context to be drawn to with image_data as the area to be drawn to CGContextRef bitmap_context = CGBitmapContextCreate( @@ -386,26 +386,26 @@ osg::Image* CreateOSGImageFromCGImage(CGImageRef image_ref) color_space, bitmap_info ); - + CGContextTranslateCTM(bitmap_context, 0, the_height); CGContextScaleCTM(bitmap_context, 1.0, -1.0); // Draws the image into the context's image_data CGContextDrawImage(bitmap_context, the_rect, image_ref); CGContextRelease(bitmap_context); - + if (!image_data) return NULL; // alpha is premultiplied with rgba, undo it - + vImage_Buffer vb; vb.data = image_data; vb.height = the_height; vb.width = the_width; vb.rowBytes = the_width * 4; vImageUnpremultiplyData_RGBA8888(&vb, &vb, 0); - + // changing it to GL_UNSIGNED_BYTE seems working, but I'm not sure if this is a right way. // data_type = GL_UNSIGNED_BYTE; @@ -1163,7 +1163,7 @@ public: CFRelease(cg_image_ref); if (!osg_image) return ReadResult::INSUFFICIENT_MEMORY_TO_LOAD; - + return osg_image; } diff --git a/src/osgPlugins/vtf/ReaderWriterVTF.cpp b/src/osgPlugins/vtf/ReaderWriterVTF.cpp index 3aad54efc..01d792624 100644 --- a/src/osgPlugins/vtf/ReaderWriterVTF.cpp +++ b/src/osgPlugins/vtf/ReaderWriterVTF.cpp @@ -171,7 +171,7 @@ bool ConvertImageFormat(unsigned int vtfFormat, int& internalFormat, supported = true; // Decode the format - switch (vtfFormat) + switch (static_cast(vtfFormat)) { case VTF_FORMAT_DEFAULT: supported = false; diff --git a/src/osgPlugins/x/directx.cpp b/src/osgPlugins/x/directx.cpp index 7397f656b..da7954a82 100644 --- a/src/osgPlugins/x/directx.cpp +++ b/src/osgPlugins/x/directx.cpp @@ -63,7 +63,7 @@ bool Object::load(std::istream& fin) { // read header char buf[256]; - if (fin.getline(buf, sizeof(buf)) == 0) { + if (!fin.getline(buf, sizeof(buf))) { OSG_WARN << "Failed to read DirectX header\n"; return false; }