|
|
@@ -1,7 +1,7 @@ |
|
|
|
// |
|
|
|
// Lol Engine |
|
|
|
// |
|
|
|
// Copyright: (c) 2004-2014 Sam Hocevar <sam@hocevar.net> |
|
|
|
// Copyright: © 2004—2014 Sam Hocevar <sam@hocevar.net> |
|
|
|
// This program is free software; you can redistribute it and/or |
|
|
|
// modify it under the terms of the Do What The Fuck You Want To |
|
|
|
// Public License, Version 2, as published by Sam Hocevar. See |
|
|
@@ -276,15 +276,15 @@ void Image::SetFormat(PixelFormat fmt) |
|
|
|
dest[n] = u8tof32(src[n]); |
|
|
|
} |
|
|
|
/* Other conversions */ |
|
|
|
else if (old_fmt == PixelFormat::RGBA_F32 && fmt == PixelFormat::Y_F32) |
|
|
|
else if (old_fmt == PixelFormat::RGB_F32 && fmt == PixelFormat::Y_F32) |
|
|
|
{ |
|
|
|
vec4 *src = (vec4 *)m_data->m_pixels[(int)old_fmt]->Data(); |
|
|
|
vec3 *src = (vec3 *)m_data->m_pixels[(int)old_fmt]->Data(); |
|
|
|
float *dest = (float *)m_data->m_pixels[(int)fmt]->Data(); |
|
|
|
|
|
|
|
vec3 const coeff(0.299f, 0.587f, 0.114f); |
|
|
|
|
|
|
|
for (int n = 0; n < count; ++n) |
|
|
|
dest[n] = dot(coeff, src[n].rgb); |
|
|
|
dest[n] = dot(coeff, src[n]); |
|
|
|
} |
|
|
|
else if (old_fmt == PixelFormat::Y_F32 && fmt == PixelFormat::Y_8) |
|
|
|
{ |
|
|
@@ -343,7 +343,8 @@ void Image::SetFormat(PixelFormat fmt) |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
ASSERT(false, "Unable to find proper conversion"); |
|
|
|
ASSERT(false, "Unable to find image conversion from %d to %d", |
|
|
|
(int)old_fmt, (int)fmt); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|