Commit 51c3ec98 authored by Laurent Montel's avatar Laurent Montel 😁

Fix check openexr

Build rgb_f16half plugins

svn path=/trunk/koffice/; revision=530362
parent 46f80b0e
......@@ -7,6 +7,7 @@ find_package(KDE4 REQUIRED)
include(KDE4Defaults)
find_package(Perl REQUIRED)
find_package(ZLIB REQUIRED)
macro_optional_find_package(OpenEXR)
if (APPLE)
find_package(Carbon REQUIRED)
......@@ -21,10 +22,8 @@ include (MacroAdditionalCleanFiles)
include (MacroAddFileDependencies)
include (ConfigureChecks.cmake)
macro_optional_find_package(OpenEXR)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h )
#macro_additional_clean_files( ${CMAKE_CURRENT_BINARY_DIR}/config.h )
# for config.h and <toplevel/foo.h> includes (if any?)
......
......@@ -10,7 +10,9 @@ add_subdirectory( cmyk_u16 )
add_subdirectory( lms_f32 )
add_subdirectory( wet )
message(STATUS "${CMAKE_CURRENT_SOURCE_DIR}: skipped subdir $(HALF_SUBDIRS)")
if(OPENEXR_FOUND)
add_subdirectory( rgb_f16half )
endif(OPENEXR_FOUND)
......
kde4_header()
message(STATUS "${CMAKE_CURRENT_SOURCE_DIR}: skipped subdir $(TESTSDIR)")
include_directories( ${OPENEXR_INCLUDE_DIR})
########### next target ###############
......@@ -12,7 +12,7 @@ kde4_automoc(${krita_rgb_f16half_LIB_SRCS})
kde4_add_library(krita_rgb_f16half SHARED ${krita_rgb_f16half_LIB_SRCS})
target_link_libraries(krita_rgb_f16half ${KDE4_KDECORE_LIBS} kritacolor )
target_link_libraries(krita_rgb_f16half ${KDE4_KDECORE_LIBS} kritacolor ${OPENEXR_LIBRARIES})
set_target_properties(krita_rgb_f16half PROPERTIES VERSION 1.0.0 SOVERSION 1 )
install_targets(${LIB_INSTALL_DIR} krita_rgb_f16half )
......@@ -28,7 +28,7 @@ kde4_add_plugin(krita_rgb_f16half_plugin ${krita_rgb_f16half_plugin_PART_SRCS})
kde4_install_libtool_file( ${PLUGIN_INSTALL_DIR} krita_rgb_f16half_plugin )
target_link_libraries(krita_rgb_f16half_plugin ${KDE4_KDECORE_LIBS} krita_rgb_f16half kritacolor )
target_link_libraries(krita_rgb_f16half_plugin ${KDE4_KDECORE_LIBS} krita_rgb_f16half kritacolor ${OPENEXR_LIBRARIES})
install_targets(${LIB_INSTALL_DIR}/kde4 krita_rgb_f16half_plugin )
......
......@@ -72,9 +72,9 @@ void KisRgbF16HalfColorSpace::setPixel(quint8 *dst, half red, half green, half b
{
Pixel *dstPixel = reinterpret_cast<Pixel *>(dst);
dstPixel->Qt::red = Qt::red;
dstPixel->Qt::green = Qt::green;
dstPixel->Qt::blue = Qt::blue;
dstPixel->red = red;
dstPixel->green = green;
dstPixel->blue = blue;
dstPixel->alpha = alpha;
}
......@@ -82,9 +82,9 @@ void KisRgbF16HalfColorSpace::getPixel(const quint8 *src, half *red, half *green
{
const Pixel *srcPixel = reinterpret_cast<const Pixel *>(src);
*Qt::red = srcPixel->Qt::red;
*Qt::green = srcPixel->Qt::green;
*Qt::blue = srcPixel->Qt::blue;
*red = srcPixel->red;
*green = srcPixel->green;
*blue = srcPixel->blue;
*alpha = srcPixel->alpha;
}
......@@ -92,18 +92,18 @@ void KisRgbF16HalfColorSpace::fromQColor(const QColor& c, quint8 *dstU8, KisProf
{
Pixel *dst = reinterpret_cast<Pixel *>(dstU8);
dst->Qt::red = UINT8_TO_HALF(c.Qt::red());
dst->Qt::green = UINT8_TO_HALF(c.Qt::green());
dst->Qt::blue = UINT8_TO_HALF(c.Qt::blue());
dst->red = UINT8_TO_HALF(c.red());
dst->green = UINT8_TO_HALF(c.green());
dst->blue = UINT8_TO_HALF(c.blue());
}
void KisRgbF16HalfColorSpace::fromQColor(const QColor& c, quint8 opacity, quint8 *dstU8, KisProfile *)
{
Pixel *dst = reinterpret_cast<Pixel *>(dstU8);
dst->Qt::red = UINT8_TO_HALF(c.Qt::red());
dst->Qt::green = UINT8_TO_HALF(c.Qt::green());
dst->Qt::blue = UINT8_TO_HALF(c.Qt::blue());
dst->red = UINT8_TO_HALF(c.red());
dst->green = UINT8_TO_HALF(c.green());
dst->blue = UINT8_TO_HALF(c.blue());
dst->alpha = UINT8_TO_HALF(opacity);
}
......@@ -111,14 +111,14 @@ void KisRgbF16HalfColorSpace::toQColor(const quint8 *srcU8, QColor *c, KisProfil
{
const Pixel *src = reinterpret_cast<const Pixel *>(srcU8);
c->setRgb(HALF_TO_UINT8(src->Qt::red), HALF_TO_UINT8(src->Qt::green), HALF_TO_UINT8(src->Qt::blue));
c->setRgb(HALF_TO_UINT8(src->red), HALF_TO_UINT8(src->green), HALF_TO_UINT8(src->blue));
}
void KisRgbF16HalfColorSpace::toQColor(const quint8 *srcU8, QColor *c, quint8 *opacity, KisProfile *)
{
const Pixel *src = reinterpret_cast<const Pixel *>(srcU8);
c->setRgb(HALF_TO_UINT8(src->Qt::red), HALF_TO_UINT8(src->Qt::green), HALF_TO_UINT8(src->Qt::blue));
c->setRgb(HALF_TO_UINT8(src->red), HALF_TO_UINT8(src->green), HALF_TO_UINT8(src->blue));
*opacity = HALF_TO_UINT8(src->alpha);
}
......@@ -127,9 +127,9 @@ quint8 KisRgbF16HalfColorSpace::difference(const quint8 *src1U8, const quint8 *s
const Pixel *src1 = reinterpret_cast<const Pixel *>(src1U8);
const Pixel *src2 = reinterpret_cast<const Pixel *>(src2U8);
return HALF_TO_UINT8(qMax(QABS(src2->Qt::red - src1->Qt::red),
qMax(QABS(src2->Qt::green - src1->Qt::green),
QABS(src2->Qt::blue - src1->Qt::blue))));
return HALF_TO_UINT8(qMax(QABS(src2->red - src1->red),
qMax(QABS(src2->green - src1->green),
QABS(src2->blue - src1->blue))));
}
void KisRgbF16HalfColorSpace::mixColors(const quint8 **colors, const quint8 *weights, quint32 nColors, quint8 *dst) const
......@@ -143,9 +143,9 @@ void KisRgbF16HalfColorSpace::mixColors(const quint8 **colors, const quint8 *wei
half alpha = pixel->alpha;
half alphaTimesWeight = alpha * UINT8_TO_HALF(*weights);
totalRed += pixel->Qt::red * alphaTimesWeight;
totalGreen += pixel->Qt::green * alphaTimesWeight;
totalBlue += pixel->Qt::blue * alphaTimesWeight;
totalRed += pixel->red * alphaTimesWeight;
totalGreen += pixel->green * alphaTimesWeight;
totalBlue += pixel->blue * alphaTimesWeight;
newAlpha += alphaTimesWeight;
weights++;
......@@ -164,9 +164,9 @@ void KisRgbF16HalfColorSpace::mixColors(const quint8 **colors, const quint8 *wei
totalBlue = totalBlue / newAlpha;
}
dstPixel->Qt::red = totalRed;
dstPixel->Qt::green = totalGreen;
dstPixel->Qt::blue = totalBlue;
dstPixel->red = totalRed;
dstPixel->green = totalGreen;
dstPixel->blue = totalBlue;
}
void KisRgbF16HalfColorSpace::convolveColors(quint8** colors, qint32 * kernelValues, KisChannelInfo::enumChannelFlags channelFlags, quint8 *dst, qint32 factor, qint32 offset, qint32 nColors) const
......@@ -180,9 +180,9 @@ void KisRgbF16HalfColorSpace::convolveColors(quint8** colors, qint32 * kernelVal
half weight = *kernelValues;
if (weight != 0) {
totalRed += pixel->Qt::red * UINT8_TO_HALF(weight);
totalGreen += pixel->Qt::green * UINT8_TO_HALF(weight);
totalBlue += pixel->Qt::blue * UINT8_TO_HALF(weight);
totalRed += pixel->red * UINT8_TO_HALF(weight);
totalGreen += pixel->green * UINT8_TO_HALF(weight);
totalBlue += pixel->blue * UINT8_TO_HALF(weight);
totalAlpha += pixel->alpha * UINT8_TO_HALF(weight);
}
colors++;
......@@ -192,9 +192,9 @@ void KisRgbF16HalfColorSpace::convolveColors(quint8** colors, qint32 * kernelVal
Pixel * p = reinterpret_cast< Pixel *>( dst );
if (channelFlags & KisChannelInfo::FLAG_COLOR) {
p->Qt::red = CLAMP( ( totalRed / factor) + offset, 0, HALF_MAX);
p->Qt::green = CLAMP( ( totalGreen / factor) + offset, 0, HALF_MAX);
p->Qt::blue = CLAMP( ( totalBlue / factor) + offset, 0, HALF_MAX);
p->red = CLAMP( ( totalRed / factor) + offset, 0, HALF_MAX);
p->green = CLAMP( ( totalGreen / factor) + offset, 0, HALF_MAX);
p->blue = CLAMP( ( totalBlue / factor) + offset, 0, HALF_MAX);
}
if (channelFlags & KisChannelInfo::FLAG_ALPHA) {
p->alpha = CLAMP((totalAlpha/ factor) + offset, 0, HALF_MAX);
......@@ -209,9 +209,9 @@ void KisRgbF16HalfColorSpace::invertColor(quint8 * src, qint32 nPixels)
while (nPixels--)
{
Pixel * p = reinterpret_cast< Pixel *>( src );
p->Qt::red = 1.0 - p->Qt::red;
p->Qt::green = 1.0 - p->Qt::green;
p->Qt::blue = 1.0 - p->Qt::blue;
p->red = 1.0 - p->red;
p->green = 1.0 - p->green;
p->blue = 1.0 - p->blue;
src += psize;
}
......@@ -222,7 +222,7 @@ quint8 KisRgbF16HalfColorSpace::intensity8(const quint8 * src) const
{
const Pixel * p = reinterpret_cast<const Pixel *>( src );
return HALF_TO_UINT8((p->Qt::red * 0.30 + p->Qt::green * 0.59 + p->Qt::blue * 0.11) + 0.5);
return HALF_TO_UINT8((p->red * 0.30 + p->green * 0.59 + p->blue * 0.11) + 0.5);
}
......
......@@ -36,8 +36,9 @@ K_EXPORT_COMPONENT_FACTORY( krita_rgb_f16half_plugin, RGBF16HalfPluginFactory( "
RGBF16HalfPlugin::RGBF16HalfPlugin(QObject *parent, const char *name, const QStringList &)
: KParts::Plugin(parent, name)
: KParts::Plugin(parent)
{
setObjectName(name);
setInstance(RGBF16HalfPluginFactory::instance());
if ( parent->inherits("KisColorSpaceFactoryRegistry") )
......
......@@ -7,6 +7,14 @@ message(STATUS "${CMAKE_CURRENT_SOURCE_DIR}: skipped subdir $(TESTSDIR)")
########### next target ###############
set(FILE_OPENEXR_SOURCES)
set(LINK_OPENEXR_LIB)
if(OPENEXR_FOUND)
set(FILE_OPENEXR_SOURCES kis_f16half_base_colorspace.cc)
include_directories(${OPENEXR_INCLUDE_DIR})
set(LINK_OPENEXR_LIB ${OPENEXR_LIBRARIES})
endif(OPENEXR_FOUND)
set(kritacolor_LIB_SRCS
kis_color.cc
......@@ -22,7 +30,7 @@ set(kritacolor_LIB_SRCS
kis_u8_base_colorspace.cc
kis_u16_base_colorspace.cc
kis_f32_base_colorspace.cc
${FILE_OPENEXR_SOURCES}
${CMAKE_CURRENT_SOURCE_DIR}/colorspaces/kis_alpha_colorspace.cc
${CMAKE_CURRENT_SOURCE_DIR}/colorspaces/kis_alpha_colorspace.h
${CMAKE_CURRENT_SOURCE_DIR}/colorspaces/kis_lab_colorspace.cc
......@@ -37,7 +45,7 @@ kde4_add_dcop_skels(kritacolor_LIB_SRCS kis_colorspace_iface.h )
kde4_add_library(kritacolor SHARED ${kritacolor_LIB_SRCS})
target_link_libraries(kritacolor ${KDE4_KDECORE_LIBS} ${KDE4_KPARTS_LIBS} ${LCMS_LIBRARIES})
target_link_libraries(kritacolor ${KDE4_KDECORE_LIBS} ${KDE4_KPARTS_LIBS} ${LCMS_LIBRARIES} ${LINK_OPENEXR_LIB})
set_target_properties(kritacolor PROPERTIES VERSION 1.0.0 SOVERSION 1 )
install_targets(${LIB_INSTALL_DIR} kritacolor )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment