Mercurial > hg > orthanc-stone
changeset 42:81e2651dca17
sync
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 14 Apr 2017 12:03:25 +0200 |
parents | ed07f4bbf1a8 |
children | e4acd5f331f3 |
files | Framework/Viewport/CairoSurface.cpp Resources/Orthanc/Core/HttpClient.cpp Resources/Orthanc/Core/Images/ImageProcessing.cpp Resources/Orthanc/Core/Logging.cpp |
diffstat | 4 files changed, 36 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/Framework/Viewport/CairoSurface.cpp Wed Mar 22 15:57:24 2017 +0100 +++ b/Framework/Viewport/CairoSurface.cpp Fri Apr 14 12:03:25 2017 +0200 @@ -77,8 +77,11 @@ CairoSurface::CairoSurface(Orthanc::ImageAccessor& accessor) { + printf("Enter\n"); + if (accessor.GetFormat() != Orthanc::PixelFormat_BGRA32) { + printf("Error 1\n"); throw Orthanc::OrthancException(Orthanc::ErrorCode_IncompatibleImageFormat); } @@ -91,16 +94,20 @@ (reinterpret_cast<unsigned char*>(buffer_), CAIRO_FORMAT_RGB24, width_, height_, pitch_); if (!surface_) { + printf("Error 2\n"); // Should never occur throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError); } if (cairo_surface_status(surface_) != CAIRO_STATUS_SUCCESS) { + printf("Error 3\n"); LOG(ERROR) << "Bad pitch for a Cairo surface"; cairo_surface_destroy(surface_); throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError); } + + printf("Success\n"); }
--- a/Resources/Orthanc/Core/HttpClient.cpp Wed Mar 22 15:57:24 2017 +0100 +++ b/Resources/Orthanc/Core/HttpClient.cpp Fri Apr 14 12:03:25 2017 +0200 @@ -823,10 +823,12 @@ void HttpClient::FinalizeOpenSsl() { - #if ORTHANC_ENABLE_SSL == 1 +#if ORTHANC_ENABLE_SSL == 1 // Finalize OpenSSL // https://wiki.openssl.org/index.php/Library_Initialization#Cleanup +#ifdef FIPS_mode_set FIPS_mode_set(0); +#endif ENGINE_cleanup(); CONF_modules_unload(1); EVP_cleanup();
--- a/Resources/Orthanc/Core/Images/ImageProcessing.cpp Wed Mar 22 15:57:24 2017 +0100 +++ b/Resources/Orthanc/Core/Images/ImageProcessing.cpp Fri Apr 14 12:03:25 2017 +0200 @@ -458,6 +458,26 @@ return; } + if (target.GetFormat() == PixelFormat_RGB24 && + source.GetFormat() == PixelFormat_BGRA32) + { + for (unsigned int y = 0; y < source.GetHeight(); y++) + { + const uint8_t* p = reinterpret_cast<const uint8_t*>(source.GetConstRow(y)); + uint8_t* q = reinterpret_cast<uint8_t*>(target.GetRow(y)); + for (unsigned int x = 0; x < source.GetWidth(); x++) + { + q[0] = p[2]; + q[1] = p[1]; + q[2] = p[0]; + p += 4; + q += 3; + } + } + + return; + } + if (target.GetFormat() == PixelFormat_RGBA32 && source.GetFormat() == PixelFormat_RGB24) {
--- a/Resources/Orthanc/Core/Logging.cpp Wed Mar 22 15:57:24 2017 +0100 +++ b/Resources/Orthanc/Core/Logging.cpp Fri Apr 14 12:03:25 2017 +0200 @@ -91,7 +91,7 @@ void Initialize(OrthancPluginContext* context) { - context_ = context_; + context_ = context; } InternalLogger::InternalLogger(const char* level, @@ -117,6 +117,11 @@ { OrthancPluginLogInfo(context_, message_.c_str()); } + else + { + std::string s = "Unknown log level (" + level_ + ") for message: " + message_; + OrthancPluginLogError(context_, s.c_str()); + } } }