Commit 8faf0923 authored by Sven Langkamp's avatar Sven Langkamp

added checks for vc and fallback if not found

parent 8ee02989
......@@ -12,8 +12,18 @@ if(MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /bigobj")
endif(MSVC)
include (OptimizeForArchitecture)
OptimizeForArchitecture()
macro_optional_find_package(Vc)
macro_bool_to_01(Vc_FOUND HAVE_VC)
configure_file(config-vc.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-vc.h )
if(HAVE_VC)
message(STATUS "Vc found!")
SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${Vc_CMAKE_MODULES_DIR}")
include (OptimizeForArchitecture)
OptimizeForArchitecture()
endif(HAVE_VC)
include(CheckFunctionExists)
......@@ -45,8 +55,6 @@ macro_log_feature(OIIO_FOUND "OIIO" "The OpenImageIO Lbirary" "https://sites.goo
macro_bool_to_01(OIIO_FOUND HAVE_OIIO)
configure_file(config-oiio.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-oiio.h )
find_package(Vc REQUIRED)
if(UNIX)
set(CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES};m")
endif(UNIX)
......
/* config-vc.h. Generated by cmake from config-glew.h.cmake */
/* Define if you have GLEW, the OpenGL Extension Wrangler Library */
#cmakedefine HAVE_VC 1
......@@ -232,7 +232,7 @@ set(kritaimage_LIB_SRCS
kde4_add_library(kritaimage SHARED ${kritaimage_LIB_SRCS})
target_link_libraries(kritaimage ${KDE4_KPARTS_LIBS} komain pigmentcms ${KDE4_THREADWEAVER_LIBRARIES} ${Vc_LIBRARIES})
target_link_libraries(kritaimage ${KDE4_KPARTS_LIBS} komain pigmentcms ${KDE4_THREADWEAVER_LIBRARIES})
target_link_libraries(kritaimage LINK_INTERFACE_LIBRARIES pigmentcms komain ${KDE4_KPARTS_LIBS} )
if(OPENEXR_FOUND)
......@@ -243,6 +243,9 @@ if(FFTW3_FOUND)
target_link_libraries(kritaimage ${FFTW3_LIBRARIES})
endif(FFTW3_FOUND)
if(HAVE_VC)
target_link_libraries(kritaimage ${Vc_LIBRARIES})
endif(HAVE_VC)
set_target_properties(kritaimage PROPERTIES
VERSION ${GENERIC_CALLIGRA_LIB_VERSION} SOVERSION ${GENERIC_CALLIGRA_LIB_SOVERSION}
......
/*
* Copyright (c) 2004,2007-2009 Cyrille Berger <cberger@cberger.net>
* Copyright (c) 2010 Lukáš Tvrdý <lukast.dev@gmail.com>
* Copyright (c) 2012 Sven Langkamp <sven.langkamp@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......@@ -18,8 +19,12 @@
*/
#include <cmath>
#include "config-vc.h"
#ifdef HAVE_VC
#include <Vc/Vc>
#include <Vc/IO>
#endif
#include <QDomDocument>
......@@ -27,9 +32,11 @@
#include "kis_circle_mask_generator.h"
#include "kis_base_mask_generator.h"
#ifdef HAVE_VC
inline Vc::float_v normeSIMD(Vc::float_v a, Vc::float_v b) {
return a*a + b*b;
}
#endif
struct KisCircleMaskGenerator::Private {
double xcoef, ycoef;
......@@ -119,6 +126,7 @@ quint8 KisCircleMaskGenerator::valueAt(qreal x, qreal y) const
void KisCircleMaskGenerator::processRowFast(float* buffer, int width, float y, float cosa, float sina,
float centerX, float centerY, float invScaleX, float invScaleY)
{
#ifdef HAVE_VC
float y_ = (y - centerY) * invScaleY;
float sinay_ = sina * y_;
float cosay_ = cosa * y_;
......@@ -172,6 +180,7 @@ void KisCircleMaskGenerator::processRowFast(float* buffer, int width, float y, f
bufferPointer += Vc::float_v::Size;
}
#endif
}
......
......@@ -26,7 +26,12 @@ set(kritalibbrush_LIB_SRCS
kde4_add_library(kritalibbrush SHARED ${kritalibbrush_LIB_SRCS} )
target_link_libraries(kritalibbrush kritaui ${Vc_LIBRARIES})
target_link_libraries(kritalibbrush kritaui)
if(HAVE_VC)
target_link_libraries(kritalibbrush ${Vc_LIBRARIES})
endif(HAVE_VC)
target_link_libraries(kritalibbrush LINK_INTERFACE_LIBRARIES kritaui)
set_target_properties(kritalibbrush PROPERTIES
......
/*
* Copyright (c) 2004,2007-2009 Cyrille Berger <cberger@cberger.net>
* Copyright (c) 2010 Lukáš Tvrdý <lukast.dev@gmail.com>
* Copyright (c) 2012 Sven Langkamp <sven.langkamp@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......@@ -44,8 +45,11 @@ inline double drand48() {
#include "kis_mask_generator.h"
#include "kis_boundary.h"
#include "config-vc.h"
#ifdef HAVE_VC
#include <Vc/Vc>
#include <Vc/IO>
#endif
// 3x3 supersampling
#define SUPERSAMPLING 3
......@@ -77,11 +81,16 @@ struct MaskProcessor
}
void process(QRect& rect){
#ifdef HAVE_VC
if (m_shape->shouldVectorize()) {
processParallel(rect);
} else {
processScalar(rect);
}
#else
processScalar(rect);
#endif
}
void processScalar(QRect& rect){
......@@ -130,6 +139,7 @@ struct MaskProcessor
}//endfor y
}
#ifdef HAVE_VC
void processParallel(QRect& rect){
qreal random = 1.0;
quint8* dabPointer = m_device->data() + rect.y() * rect.width() * m_pixelSize;
......@@ -182,6 +192,7 @@ struct MaskProcessor
}//endfor y
Vc::free(buffer);
}
#endif
KisFixedPaintDeviceSP m_device;
const KoColorSpace* m_cs;
......
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