vtkm_rendering now uses vtkm/thirdparty/lodepng

Previously it used a version of the decode routines from lodepng
inside the decode functionality.
This commit is contained in:
Robert Maynard 2019-06-18 15:19:05 -04:00
parent 8153246381
commit 23aeff054e
5 changed files with 36 additions and 1028 deletions

@ -71,6 +71,7 @@ vtkm_declare_headers(
#-----------------------------------------------------------------------------
#first add all the components vtkm that are shared between control and exec
add_subdirectory(thirdparty/diy)
add_subdirectory(thirdparty/lodepng)
if(VTKm_ENABLE_LOGGING)
add_subdirectory(thirdparty/loguru)
endif()

@ -195,8 +195,8 @@ elseif(VTKm_ENABLE_EGL_CONTEXT)
endif()
#-----------------------------------------------------------------------------
target_link_libraries(vtkm_rendering PUBLIC vtkm_filter)
target_link_libraries(vtkm_rendering PUBLIC vtkm_filter
PRIVATE vtkm_lodepng)
if(UNIX AND NOT APPLE)
target_link_libraries(vtkm_rendering PRIVATE rt)
endif()

@ -526,7 +526,7 @@ bool Canvas::LoadFont() const
const std::vector<unsigned char>& rawPNG = Internals->Font.GetRawImageData();
std::vector<unsigned char> rgba;
unsigned long textureWidth, textureHeight;
int error = DecodePNG(rgba, textureWidth, textureHeight, &rawPNG[0], rawPNG.size());
auto error = DecodePNG(rgba, textureWidth, textureHeight, &rawPNG[0], rawPNG.size());
if (error != 0)
{
return false;

File diff suppressed because it is too large Load Diff

@ -10,6 +10,7 @@
#ifndef vtk_m_rendering_DecodePNG_h
#define vtk_m_rendering_DecodePNG_h
#include <vtkm/Types.h>
#include <vtkm/rendering/vtkm_rendering_export.h>
#include <vector>
@ -19,13 +20,17 @@ namespace vtkm
namespace rendering
{
/// Decodes a PNG file buffer in memory, into a raw pixel buffer
/// Output is RGBA 32-bit (8 bit per channel) color format
/// no matter what color type the original PNG image had. This gives predictable,
/// usable data from any random input PNG.
///
VTKM_RENDERING_EXPORT
int DecodePNG(std::vector<unsigned char>& out_image,
unsigned long& image_width,
unsigned long& image_height,
const unsigned char* in_png,
std::size_t in_size,
bool convert_to_rgba32 = true);
vtkm::UInt32 DecodePNG(std::vector<unsigned char>& out_image,
unsigned long& image_width,
unsigned long& image_height,
const unsigned char* in_png,
std::size_t in_size);
}
} // vtkm::rendering