Permalink
Browse files

Build fixes for clang

  • Loading branch information...
1 parent 400fbd6 commit f71491786ac2d22ef16f9f5ed31de0f6666c6600 @osg-training-guest osg-training-guest committed Oct 21, 2013
@@ -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<CGFloat>(the_width), static_cast<CGFloat>(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 @@ class ReaderWriterImageIO : public osgDB::ReaderWriter
CFRelease(cg_image_ref);
if (!osg_image)
return ReadResult::INSUFFICIENT_MEMORY_TO_LOAD;
-
+
return osg_image;
}
@@ -171,7 +171,7 @@ bool ConvertImageFormat(unsigned int vtfFormat, int& internalFormat,
supported = true;
// Decode the format
- switch (vtfFormat)
+ switch (static_cast<int>(vtfFormat))
{
case VTF_FORMAT_DEFAULT:
supported = false;
@@ -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;
}

0 comments on commit f714917

Please sign in to comment.