diff --git a/CHANGELOG b/CHANGELOG index 06e690a55..3ce8ff3a3 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,26 @@ +========================================= +Version 0.1.3 + +- Fixed opacity blending of "Color" mode in RGB and Lab colorspaces +- Fixed opacity blending of "Luminosity" mode in Lab colorspace +- Fixed filling of layer list of clone tool: for clone layers inserted + in layer masks, the parent layer was incorrectly included in the list, + leading to a possible unresolvable circular dependency between + the clone layer and its source. Now the parent layer is not included + anymore in the list of possible clone sources. +- original "visible" flag of layers renamed to "enabled", and added a new "visible" + flag to indicate if a given layer is either directly hidden or indirectly hidden + because some of its parents are hidden. + The "enabled" flag now indicates if the layer is directly hidden. +- Removed fatal assertion on the validity of the output image from layer extra inputs. + Now if the image is invalid a NULL pointer is simply added to the list of extra inputs, + without causing a program crash. Nevertheless, a notification mechanism should be + introduced to inform the user of the abnormal situation. +- Fixed corruption of RAW image metadata at zoom levels below 100% +- Fixed bug in the image preview at program startup +- Fixed several clang compilation warnings + + ========================================= Version 0.1.2 diff --git a/CMakeLists.txt b/CMakeLists.txt index 93af1186e..c579507ca 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -70,6 +70,7 @@ endif() MESSAGE( STATUS "GTKMM3_FOUND: " ${GTKMM3_FOUND} ) +IF(NOT MINGW) #need to put here do setting LOCALE_DIR variable if(USE_NLS) find_package(Gettext) @@ -91,6 +92,8 @@ if(Gettext_FOUND) endif(NOT LOCALE_DIR) endif(Gettext_FOUND) endif(USE_NLS) +ENDIF(NOT MINGW) +MESSAGE( STATUS "Msgfmt_FOUND: " ${Msgfmt_FOUND} ) add_subdirectory(src) diff --git a/VERSION b/VERSION index d917d3e26..b1e80bb24 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.1.2 +0.1.3 diff --git a/src/base/blend_color.hh b/src/base/blend_color.hh index 5a4c3f607..c241d843e 100644 --- a/src/base/blend_color.hh +++ b/src/base/blend_color.hh @@ -55,16 +55,17 @@ class BlendColor: { int pos, ch; double temp_top; - double rgb[3]; + double irgb[3], rgb[3]; public: - void blend(const float& opacity, T* bottom, T* top, T* out, const int& x, int& xomap) + void blend(const float& opacity, T* bottom, T* top, T* out, const int& x, int& /*xomap*/) { // RGB values of the bottom layer - double ired = (double(bottom[x]) + FormatInfo::MIN)/FormatInfo::RANGE; - double igreen = (double(bottom[x+1]) + FormatInfo::MIN)/FormatInfo::RANGE; - double iblue = (double(bottom[x+2]) + FormatInfo::MIN)/FormatInfo::RANGE; + // RGB values of the bottom layer + irgb[0] = (double(bottom[x]) + FormatInfo::MIN)/FormatInfo::RANGE; + irgb[1] = (double(bottom[x+1]) + FormatInfo::MIN)/FormatInfo::RANGE; + irgb[2] = (double(bottom[x+2]) + FormatInfo::MIN)/FormatInfo::RANGE; // Luminance value of the bottom layer - double lumi = PF::luminance( ired, igreen, iblue ); + double lumi = PF::luminance( irgb[0], irgb[1], irgb[2] ); // RGB values of the top layer double ored = (double(top[x]) + FormatInfo::MIN)/FormatInfo::RANGE; @@ -78,7 +79,7 @@ public: pos = x; for( ch=CHMIN; ch<=CHMAX; ch++, pos++ ) { - out[pos] = (T)(( (rgb[ch]*opacity)+(rgb[ch]*(1.0f-opacity)) )*FormatInfo::RANGE - FormatInfo::MIN); + out[pos] = (T)(( (rgb[ch]*opacity)+(irgb[ch]*(1.0f-opacity)) )*FormatInfo::RANGE - FormatInfo::MIN); } } }; @@ -112,13 +113,13 @@ class BlendColor: double temp_top; double rgb[3]; public: - void blend(const float& opacity, T* bottom, T* top, T* out, const int& x, int& xomap) + void blend(const float& opacity, T* bottom, T* top, T* out, const int& x, int& /*xomap*/) { pos = x; for( ch=CHMIN; ch<=0; ch++, pos++ ) out[pos] = bottom[pos]; for( ; ch<=CHMAX; ch++, pos++ ) - out[pos] = top[pos]; + out[pos] = static_cast( opacity*top[pos]+(1.0f-opacity)*bottom[pos] ); } }; diff --git a/src/base/blend_grain_extract.hh b/src/base/blend_grain_extract.hh index b593a2e5d..ca2b82acc 100644 --- a/src/base/blend_grain_extract.hh +++ b/src/base/blend_grain_extract.hh @@ -33,9 +33,8 @@ template { public: - void blend(const float& opacity, T* bottom, T* top, T* out, const int& x, int& xomap) - { - } + void blend(const float& /*opacity*/, T* /*bottom*/, T* /*top*/, + T* /*out*/, const int& /*x*/, int& /*xomap*/) {} }; @@ -47,7 +46,7 @@ class BlendGrainExtract: int ch, pos; typename FormatInfo::PROMOTED ptop; public: - void blend(const float& opacity, T* bottom, T* top, T* out, const int& x, int& xomap) + void blend(const float& opacity, T* bottom, T* top, T* out, const int& x, int& /*xomap*/) { pos = x; for( ch=CHMIN; ch<=CHMAX; ch++, pos++ ) { @@ -68,7 +67,7 @@ class BlendGrainExtract: typename FormatInfo::PROMOTED ptop; float opacity_real; public: - void blend(const float& opacity, T* bottom, T* top, T* out, const int& x, int& xomap) + void blend(const float& opacity, T* bottom, T* top, T* out, const int& x, int& xomap) { opacity_real = opacity*(this->pmap[xomap]+FormatInfo::MIN)/(FormatInfo::RANGE); xomap += 1; diff --git a/src/base/blend_grain_merge.hh b/src/base/blend_grain_merge.hh index d1b34623f..98066b7d0 100644 --- a/src/base/blend_grain_merge.hh +++ b/src/base/blend_grain_merge.hh @@ -33,9 +33,8 @@ template { public: - void blend(const float& opacity, T* bottom, T* top, T* out, const int& x, int& xomap) - { - } + void blend(const float& /*opacity*/, T* /*bottom*/, T* /*top*/, + T* /*out*/, const int& /*x*/, int& /*xomap*/) {} }; @@ -47,7 +46,7 @@ class BlendGrainMerge: int ch, pos; typename FormatInfo::SIGNED ptop; public: - void blend(const float& opacity, T* bottom, T* top, T* out, const int& x, int& xomap) + void blend(const float& opacity, T* bottom, T* top, T* out, const int& x, int& /*xomap*/) { pos = x; for( ch=CHMIN; ch<=CHMAX; ch++, pos++ ) { diff --git a/src/base/blend_hard_light.hh b/src/base/blend_hard_light.hh index 6830b9722..23b62dc5b 100644 --- a/src/base/blend_hard_light.hh +++ b/src/base/blend_hard_light.hh @@ -33,7 +33,8 @@ template { public: - void blend(const float& opacity, T* bottom, T* top, T* out, const int& x, int& xomap) {} + void blend(const float& /*opacity*/, T* /*bottom*/, T* /*top*/, + T* /*out*/, const int& /*x*/, int& /*xomap*/) {} }; diff --git a/src/base/blend_lighten.hh b/src/base/blend_lighten.hh index 43c9730b6..388b1dfcf 100644 --- a/src/base/blend_lighten.hh +++ b/src/base/blend_lighten.hh @@ -33,9 +33,8 @@ template { public: - void blend(const float& opacity, T* bottom, T* top, T* out, const int& x, int& xomap) - { - } + void blend(const float& /*opacity*/, T* /*bottom*/, T* /*top*/, + T* /*out*/, const int& /*x*/, int& /*xomap*/) {} }; @@ -47,7 +46,7 @@ class BlendLighten: int ch, pos; T temp_top; public: - void blend(const float& opacity, T* bottom, T* top, T* out, const int& x, int& xomap) + void blend(const float& opacity, T* bottom, T* top, T* out, const int& x, int& /*xomap*/) { pos = x; for( ch=CHMIN; ch<=CHMAX; ch++, pos++ ) { @@ -94,7 +93,7 @@ class BlendLighten: { T temp_top; public: - void blend(const float& opacity, T* bottom, T* top, T* out, const int& x, int& xomap) + void blend(const float& opacity, T* bottom, T* top, T* out, const int& x, int& /*xomap*/) { if( bottom[x]>top[x] ) temp_top = bottom[x]; else temp_top = top[x]; diff --git a/src/base/blend_luminosity.hh b/src/base/blend_luminosity.hh index 9702f9cb8..294457d12 100644 --- a/src/base/blend_luminosity.hh +++ b/src/base/blend_luminosity.hh @@ -58,7 +58,7 @@ class BlendLuminosity: double irgb[3]; double rgb[3]; public: - void blend(const float& opacity, T* bottom, T* top, T* out, const int& x, int& xomap) + void blend(const float& opacity, T* bottom, T* top, T* out, const int& x, int& /*xomap*/) { // RGB values of the bottom layer irgb[0] = (double(bottom[x]) + FormatInfo::MIN)/FormatInfo::RANGE; @@ -113,11 +113,11 @@ class BlendLuminosity: double temp_top; double rgb[3]; public: - void blend(const float& opacity, T* bottom, T* top, T* out, const int& x, int& xomap) + void blend(const float& opacity, T* bottom, T* top, T* out, const int& x, int& /*xomap*/) { pos = x; for( ch=CHMIN; ch<=0; ch++, pos++ ) - out[pos] = top[pos]; + out[pos] = static_cast( opacity*top[pos]+(1.0f-opacity)*bottom[pos] ); for( ; ch<=CHMAX; ch++, pos++ ) out[pos] = bottom[pos]; } diff --git a/src/base/blend_multiply.hh b/src/base/blend_multiply.hh index 84b174bc6..308606ea8 100644 --- a/src/base/blend_multiply.hh +++ b/src/base/blend_multiply.hh @@ -33,9 +33,8 @@ template { public: - void blend(const float& opacity, T* bottom, T* top, T* out, const int& x, int& xomap) - { - } + void blend(const float& /*opacity*/, T* /*bottom*/, T* /*top*/, + T* /*out*/, const int& /*x*/, int& /*xomap*/) {} }; @@ -47,7 +46,7 @@ class BlendMultiply: int ch, pos; typename FormatInfo::PROMOTED ptop; public: - void blend(const float& opacity, T* bottom, T* top, T* out, const int& x, int& xomap) + void blend(const float& opacity, T* bottom, T* top, T* out, const int& x, int& /*xomap*/) { pos = x; for( ch=CHMIN; ch<=CHMAX; ch++, pos++ ) { @@ -95,7 +94,7 @@ class BlendMultiply: { typename FormatInfo::PROMOTED ptop; public: - void blend(const float& opacity, T* bottom, T* top, T* out, const int& x, int& xomap) + void blend(const float& opacity, T* bottom, T* top, T* out, const int& x, int& /*xomap*/) { ptop = top[x]; ptop *= bottom[x]; diff --git a/src/base/blend_normal.hh b/src/base/blend_normal.hh index 8e93f5ba0..1eb1948ed 100644 --- a/src/base/blend_normal.hh +++ b/src/base/blend_normal.hh @@ -33,7 +33,8 @@ template { public: - void blend(const float& opacity, T* bottom, T* top, T* out, const int& x, int& xomap) {} + void blend(const float& /*opacity*/, T* /*bottom*/, T* /*top*/, + T* /*out*/, const int& /*x*/, int& /*xomap*/) {} }; @@ -45,7 +46,7 @@ class BlendNormal: public BlendBase { public: - void blend(const float& opacity, T* bottom, T* top, T* out, const int& x, int& xomap) + void blend(const float& opacity, T* bottom, T* top, T* out, const int& x, int& /*xomap*/) { out[x] = (T)(opacity*top[x] + (1.0f-opacity)*bottom[x]); } @@ -74,7 +75,7 @@ class BlendNormal: { int ch, pos; public: - void blend(const float& opacity, T* bottom, T* top, T* out, const int& x, int& xomap) + void blend(const float& opacity, T* bottom, T* top, T* out, const int& x, int& /*xomap*/) { pos = x; // The target channel(s) get blended @@ -135,7 +136,7 @@ class BlendNormal: { int ch, pos; public: - void blend(const float& opacity, T* bottom, T* top, T* out, const int& x, int& xomap) + void blend(const float& opacity, T* bottom, T* top, T* out, const int& x, int& /*xomap*/) { pos = x; // The target channel(s) get blended @@ -190,7 +191,7 @@ class BlendNormal: { int ch, pos; public: - void blend(const float& opacity, T* bottom, T* top, T* out, const int& x, int& xomap) + void blend(const float& opacity, T* bottom, T* top, T* out, const int& x, int& /*xomap*/) { pos = x; // The target channel(s) get blended diff --git a/src/base/blend_overlay.hh b/src/base/blend_overlay.hh index df2ebcc8f..b9855f7f9 100644 --- a/src/base/blend_overlay.hh +++ b/src/base/blend_overlay.hh @@ -33,7 +33,8 @@ template { public: - void blend(const float& opacity, T* bottom, T* top, T* out, const int& x, int& xomap) {} + void blend(const float& /*opacity*/, T* /*bottom*/, T* /*top*/, + T* /*out*/, const int& /*x*/, int& /*xomap*/) {} }; @@ -50,7 +51,7 @@ class BlendOverlay: typename FormatInfo::PROMOTED psum; public: BlendOverlay(): BlendBase(), psum(FormatInfo::MAX + FormatInfo::MIN) {} - void blend(const float& opacity, T* bottom, T* top, T* out, const int& x, int& xomap) + void blend(const float& opacity, T* bottom, T* top, T* out, const int& x, int& /*xomap*/) { pos = x; //psum = FormatInfo::MAX + FormatInfo::MIN; diff --git a/src/base/blend_passthrough.hh b/src/base/blend_passthrough.hh index fbd4f1a29..9bb263586 100644 --- a/src/base/blend_passthrough.hh +++ b/src/base/blend_passthrough.hh @@ -34,7 +34,6 @@ class BlendPassthrough: public BlendBase { int ch; public: - void blend(const float& opacity, T* bottom, T* top, T* out, const int& x, int& xomap) - { - } + void blend(const float& /*opacity*/, T* /*bottom*/, T* /*top*/, + T* /*out*/, const int& /*x*/, int& /*xomap*/) {} }; diff --git a/src/base/blend_screen.hh b/src/base/blend_screen.hh index 638759ef0..a9bba4a99 100644 --- a/src/base/blend_screen.hh +++ b/src/base/blend_screen.hh @@ -33,7 +33,8 @@ template { public: - void blend(const float& opacity, T* bottom, T* top, T* out, const int& x, int& xomap) {} + void blend(const float& /*opacity*/, T* /*bottom*/, T* /*top*/, + T* /*out*/, const int& /*x*/, int& /*xomap*/) {} }; @@ -50,7 +51,7 @@ class BlendScreen: typename FormatInfo::PROMOTED psum; public: BlendScreen(): BlendBase(), psum(FormatInfo::MAX + FormatInfo::MIN) {} - void blend(const float& opacity, T* bottom, T* top, T* out, const int& x, int& xomap) + void blend(const float& opacity, T* bottom, T* top, T* out, const int& x, int& /*xomap*/) { pos = x; //psum = FormatInfo::MAX + FormatInfo::MIN; diff --git a/src/base/blend_soft_light.hh b/src/base/blend_soft_light.hh index 98692ece1..9dea62d42 100644 --- a/src/base/blend_soft_light.hh +++ b/src/base/blend_soft_light.hh @@ -33,7 +33,8 @@ template { public: - void blend(const float& opacity, T* bottom, T* top, T* out, const int& x, int& xomap) {} + void blend(const float& /*opacity*/, T* /*bottom*/, T* /*top*/, + T* /*out*/, const int& /*x*/, int& /*xomap*/) {} }; @@ -55,7 +56,7 @@ public: psum((typename FormatInfo::PROMOTED)(FormatInfo::MAX) + FormatInfo::MIN), MAX2((typename FormatInfo::PROMOTED)(FormatInfo::MAX)*FormatInfo::MAX), sqrtMAX( sqrt(FormatInfo::MAX) ) {} - void blend(const float& opacity, T* bottom, T* top, T* out, const int& x, int& xomap) + void blend(const float& opacity, T* bottom, T* top, T* out, const int& x, int& /*xomap*/) { pos = x; //psum = FormatInfo::MAX + FormatInfo::MIN; diff --git a/src/base/blend_vivid_light.hh b/src/base/blend_vivid_light.hh index 9eef56121..9aa3ecce8 100644 --- a/src/base/blend_vivid_light.hh +++ b/src/base/blend_vivid_light.hh @@ -31,6 +31,7 @@ //#include "vivid_light.hh" +/* static float color_burn(float top, float bottom) { if( top == 1 ) return 0; @@ -46,13 +47,15 @@ static float color_dodge(float top, float bottom) float result = bottom / (1.0f-top); return( (result>1) ? 1 : result ); } +*/ template class BlendVividLight: public BlendBase { public: - void blend(const float& opacity, T* bottom, T* top, T* out, const int& x, int& xomap) {} + void blend(const float& /*opacity*/, T* /*bottom*/, T* /*top*/, + T* /*out*/, const int& /*x*/, int& /*xomap*/) {} }; @@ -70,7 +73,7 @@ class BlendVividLight: typename FormatInfo::PROMOTED psum; public: BlendVividLight(): BlendBase(), psum(FormatInfo::MAX + FormatInfo::MIN) {} - void blend(const float& opacity, T* bottom, T* top, T* out, const int& x, int& xomap) + void blend(const float& opacity, T* bottom, T* top, T* out, const int& x, int& /*xomap*/) { #ifdef DO_WARNINGS #warning "TODO: optimize vivid light blend" diff --git a/src/base/cachebuffer.cc b/src/base/cachebuffer.cc index d71d58381..2996c9de3 100644 --- a/src/base/cachebuffer.cc +++ b/src/base/cachebuffer.cc @@ -107,7 +107,7 @@ void PF::CacheBuffer::step() lseek( fd, offset, SEEK_SET ); p = VIPS_REGION_ADDR( reg, tile_area.left, tile_area.top+y ); ssize_t n = ::write( fd, p, VIPS_REGION_SIZEOF_LINE(reg) ); - if( n != VIPS_REGION_SIZEOF_LINE(reg) ) + if( n != (ssize_t)VIPS_REGION_SIZEOF_LINE(reg) ) break; offset += VIPS_IMAGE_SIZEOF_LINE(image); } diff --git a/src/base/format_info.hh b/src/base/format_info.hh index 85030c82e..788e866f8 100644 --- a/src/base/format_info.hh +++ b/src/base/format_info.hh @@ -131,6 +131,17 @@ namespace PF } */ + /* + template < typename Tin, typename T > + void clip(const Tin& val, T& clipped) + { + if(val > FormatInfo::MAX) clipped = FormatInfo::MAX; + else if(val < FormatInfo::MIN) clipped = FormatInfo::MIN; + else clipped = (T)val; + //std::cout<<"val="<<(int)val<<" max="<<(int)FormatInfo::MAX<<" min="<<(int)FormatInfo::MIN<<" clipped="<<(int)clipped< void clip(const typename FormatInfo::SIGNED& val, T& clipped) { diff --git a/src/base/imageprocessor.cc b/src/base/imageprocessor.cc index f2aeca8e9..15d6af5b0 100644 --- a/src/base/imageprocessor.cc +++ b/src/base/imageprocessor.cc @@ -33,10 +33,11 @@ #include "imageprocessor.hh" -static gpointer run_image_processor( gpointer data ) +static gpointer run_image_processor( gpointer /*data*/ ) { std::cout<<"Calling ImageProcessor::instance().run()"<= out_width ) { area_out.width -= (out_right-out_width-1); out_right = area_out.left + area_out.width - 1; } - unsigned int out_bottom = area_out.top + area_out.height - 1; + int out_bottom = area_out.top + area_out.height - 1; if( out_bottom >= out_height ) { area_out.height -= (out_bottom-out_height-1); out_bottom = area_out.top + area_out.height - 1; @@ -196,7 +196,7 @@ void PF::ImagePyramid::update( const VipsRect& area ) area_in.width = area_out.width*2; area_in.height = area_out.height*2; - unsigned int x, x2, y, in_linesz = area_in.width*pelsz, out_linesz = area_out.width*pelsz; + int x, x2, y, in_linesz = area_in.width*pelsz, out_linesz = area_out.width*pelsz; unsigned char* buf_in = new unsigned char[in_linesz]; if( !buf_in ) break; diff --git a/src/base/layer.cc b/src/base/layer.cc index 43ef2e322..695b9bd30 100644 --- a/src/base/layer.cc +++ b/src/base/layer.cc @@ -44,6 +44,7 @@ PF::Layer::Layer(int32_t i, bool c): dirty = true; modified_flag = true; + enabled = true; visible = true; normal = true; @@ -162,9 +163,9 @@ void PF::Layer::remove_input(int32_t lid) bool PF::Layer::save( std::ostream& ostr, int level ) { for(int i = 0; i < level; i++) ostr<<" "; - ostr<<"get_id() < 0"<get_id() >= layers_pool.size() ) { + if( layer->get_id() >= (int)layers_pool.size() ) { std::cout<<"ERROR: LayerManager::delete_layer(): layer->get_id() >= layers_pool.size()"<& childr get_child_layers( layer, *clist, children ); } - +/* + * Fill th list of layers that are parent of a target layer, i.e. the list of layers + * that contribute to the input of the target layer (excluding the mask associated + * to the target layer itself) + */ bool PF::LayerManager::get_parent_layers(Layer* layer, std::list< std::pair >& plist, std::string parent_name, std::list& list) @@ -217,12 +221,6 @@ bool PF::LayerManager::get_parent_layers(Layer* layer, #ifndef NDEBUG std::cout<<" checking layer \""<get_name()<<"\"("<get_id()<<")"<get_id() != layer->get_id() ) { - plist.push_back( make_pair( name, l ) ); -#ifndef NDEBUG - std::cout<<" added."<sublayers ) ) return true; @@ -233,6 +231,13 @@ bool PF::LayerManager::get_parent_layers(Layer* layer, if( get_parent_layers( layer, plist, name+"/OMap/", l->omap_layers ) ) return true; + if( l->get_id() != layer->get_id() ) { + plist.push_back( make_pair( name, l ) ); +#ifndef NDEBUG + std::cout<<" added."<get_id() == layer->get_id() ) return true; } @@ -385,14 +390,14 @@ PF::CacheBuffer* PF::LayerManager::get_cache_buffer( rendermode_t mode, std::lis PF::Layer* l = *li; if( !l ) continue; - if( !l->is_visible() ) continue; + if( !l->is_enabled() ) continue; //std::cout<<"LayerManager::get_cache_buffer(): checking layer "<get_name()<extra_inputs.size(); i++ ) { Layer* lextra = get_layer( l->extra_inputs[i].first ); - if( lextra && lextra->is_visible() && lextra->is_cached() && lextra->get_cache_buffer(mode) && + if( lextra && lextra->is_enabled() && lextra->is_cached() && lextra->get_cache_buffer(mode) && !lextra->get_cache_buffer(mode)->is_completed() ) { buf = lextra->get_cache_buffer( mode ); #ifndef NDEBUG @@ -427,7 +432,7 @@ PF::CacheBuffer* PF::LayerManager::get_cache_buffer( rendermode_t mode, std::lis std::cout<<"Layer \""<get_name()<<"\": pending cache buffer "<get_image()->get_npipelines()="<get_image()->get_npipelines()<get_image()->get_npipelines(); pi++ ) { + for( unsigned int pi = 0; pi < l->get_image()->get_npipelines(); pi++ ) { PF::Pipeline* pipeline = l->get_image()->get_pipeline(pi); //std::cout<<" l->get_image()->get_pipeline("<get_render_mode()=" // <get_render_mode()<& list, bool visible ) +{ + std::list::reverse_iterator li; + for(li = list.rbegin(); li != list.rend(); ++li) { + PF::Layer* l = *li; + if(!l) continue; + + // Reset visible flag first + l->set_visible( false ); + // Check if current layer is enabled + // If not, this and all subsequent and/or child layers + // will be marked as invisible + if( !l->is_enabled() ) { + visible = false; + } + l->set_visible( visible ); + + // Now we walk through the intensity and opacity maps. + update_visible( l->imap_layers, visible ); + + update_visible( l->omap_layers, visible ); + + // Finally we walk through the sub-layers. + update_visible( l->sublayers, visible ); + } +} + + + void PF::LayerManager::update_dirty( std::list& list, bool& dirty ) { std::list::iterator li = list.begin(); @@ -644,7 +678,7 @@ VipsImage* PF::LayerManager::rebuild_chain( PF::Pipeline* pipeline, colorspace_t g_assert( l->get_blender()->get_par() != NULL ); char* name = (char*)l->get_name().c_str(); - if( !l->is_visible() ) continue; + if( !l->is_enabled() ) continue; #ifndef NDEBUG std::cout<<"PF::LayerManager::rebuild_chain(): processing layer \""<extra_inputs[iextra].first.second; // If the extra input layer is not found we have a problem, better to give up // with an error. - g_assert( lextra != NULL ); + //g_assert( lextra != NULL ); + if( !lextra ) { + in.push_back( NULL ); + continue; + } + // If the layer is not visible (either bcause it is disabled, + // or one of its parents is disabled) we ignore the associated image + if( !(lextra->is_visible()) ) { + in.push_back( NULL ); + continue; + } PF::PipelineNode* extra_node = pipeline->get_node( lextra->get_id() ); - g_assert( extra_node != NULL ); + //g_assert( extra_node != NULL ); + if( extra_node == NULL ) { + in.push_back( NULL ); + continue; + } VipsImage* extra_img = NULL; // std::cout<<" imgid="<images.size()="<images.size()<extra_inputs[iextra].second == true ) { extra_img = extra_node->blended; } else { - if( (imgid>=0) && (imgidimages.size()) ) { + if( (imgid>=0) && (imgid<(int)extra_node->images.size()) ) { extra_img = extra_node->images[imgid]; //std::cout<<" extra_node->images[imgid]="<images[imgid]<& list, bool visible ); + // Walk through the given layer chain and set the "dirty" flag of all layers starting from "layer_id" to "true" void update_dirty( std::list& list, bool& dirty ); diff --git a/src/base/operation.hh b/src/base/operation.hh index ffc65173e..614f6ea2e 100644 --- a/src/base/operation.hh +++ b/src/base/operation.hh @@ -281,7 +281,7 @@ namespace PF rendermode_t get_render_mode() { return render_mode; } void set_render_mode(rendermode_t m) { render_mode = m; } - virtual void pre_build( rendermode_t mode ) {} + virtual void pre_build( rendermode_t /*mode*/ ) {} virtual VipsImage* build(std::vector& in, int first, VipsImage* imap, VipsImage* omap, unsigned int& level); @@ -395,7 +395,7 @@ namespace PF class IntensityProc { public: - float get_intensity(float& intensity, T*& p, int& x) + float get_intensity(float& intensity, T*& /*p*/, int& /*x*/) { //std::cout<<"IntensityProc::get_intensity()"< @@ -186,25 +192,31 @@ void start_element (GMarkupParseContext *context, layer_id_mapper[old_id] = layer; layer->set_name( name ); - layer->set_visible( visible ); + layer->set_enabled( visible ); layer->set_normal( normal ); if( (version<2) && (normal==0) ) { +#ifdef DEBUG_PF_LOAD std::cout<<"PF::pf_file_loader(): setting group layer operation to \"buffer\""<get_par(); } if( current_op ) current_op->set_map_flag( current_container_map_flag ); } +#ifdef DEBUG_PF_LOAD std::cout<<"Layer \""<get_name()<<"\" extra inputs: "; for(unsigned int i = 0; i < layer->get_extra_inputs().size(); i++) std::cout<get_extra_inputs()[i].first.first<<","<get_extra_inputs()[i].first.second <<" (blended="<get_extra_inputs()[i].second<<")"; std::cout<get_imap_layers()); current_container_map_flag = true; @@ -257,24 +271,34 @@ void start_element (GMarkupParseContext *context, if( !current_layer ) return; if( op_type == "blender" ) { +#ifdef DEBUG_PF_LOAD std::cout<<"PF::pf_file_loader(): setting blender operation"<get_blender() ) { current_op = current_layer->get_blender()->get_par(); +#ifdef DEBUG_PF_LOAD std::cout<<"PF::pf_file_loader(): blender operation set to "<get_par(); if( !PF::PhotoFlow::Instance().is_batch() && current_op->init_hidden() ) - current_layer->set_visible( false ); + current_layer->set_enabled( false ); } } +#ifdef DEBUG_PF_LOAD std::cout<<"PF::pf_file_loader(): current_container_map_flag="<set_map_flag( current_container_map_flag ); @@ -295,7 +319,9 @@ void start_element (GMarkupParseContext *context, value_cursor++; } +#ifdef DEBUG_PF_LOAD std::cout<<"PF::pf_file_loader(): setting property \""<image_area->get_hadj()->get_value()="<image_area->get_hadj()->get_value()<image_area->get_vadj()->get_value()="<image_area->get_vadj()->get_value()<image_area->set_size_request("<rect.width<<","<rect.height<<")"<image_area->set_size_request(update->rect.width,update->rect.height); // We need to change the upper limits explicitely, since the adjustments are not updated immediately @@ -118,9 +121,12 @@ gboolean PF::ImageArea::set_size_cb (PF::ImageArea::Update * update) std::cout<<"set_size_cb(2): update->image_area->get_hadj()->get_value()="<image_area->get_hadj()->get_value()<image_area->get_vadj()->get_value()="<image_area->get_vadj()->get_value()<rect: "<rect<rect: "<rect<& lis //#ifndef NDEBUG std::cout<<" checking layer \""<get_name()<<"\"("<get_id()<<")"<is_visible() ) continue; + if( !l->is_enabled() ) continue; if( l->get_processor() == NULL ) continue; if( l->get_processor()->get_par() == NULL ) continue; PF::OpParBase* par = l->get_processor()->get_par(); @@ -214,7 +214,7 @@ void PF::ImageEditor::get_child_layers( Layer* layer, std::list& con std::cout<<" checking layer \""<get_name()<<"\"("<get_id()<<")"<get_id() == l->get_id()) ) break; - if( !l->is_visible() ) continue; + if( !l->is_enabled() ) continue; if( l->get_processor() == NULL ) continue; if( l->get_processor()->get_par() == NULL ) continue; PF::OpParBase* par = l->get_processor()->get_par(); @@ -339,7 +339,7 @@ void PF::ImageEditor::open_image() //std::cout<<"ImageEditor::open_image(): ... done."<get_pipeline( PIPELINE_ID ); if( !pipeline ) return; - int level = 0; + int level = 1; pipeline->set_level( level ); imageArea->set_shrink_factor( 1 ); layersWidget.update(); @@ -636,7 +636,7 @@ void PF::ImageEditor::image2layer( gdouble& x, gdouble& y, gdouble& w, gdouble& std::list::reverse_iterator li; for(li = active_layer_children.rbegin(); li != active_layer_children.rend(); ++li) { PF::Layer* l = *li; - if( l && l->is_visible() ) { + if( l && l->is_enabled() ) { // Get the node associated to the layer PF::PipelineNode* node = pipeline->get_node( l->get_id() ); if( !node ) { @@ -727,7 +727,7 @@ void PF::ImageEditor::layer2image( gdouble& x, gdouble& y, gdouble& w, gdouble& std::list::iterator li; for(li = active_layer_children.begin(); li != active_layer_children.end(); ++li) { PF::Layer* l = *li; - if( l && l->is_visible() ) { + if( l && l->is_enabled() ) { // Get the node associated to the layer PF::PipelineNode* node = pipeline->get_node( l->get_id() ); if( !node ) { diff --git a/src/gui/layertree.cc b/src/gui/layertree.cc index 974d99524..1d9d46abc 100644 --- a/src/gui/layertree.cc +++ b/src/gui/layertree.cc @@ -222,13 +222,13 @@ void PF::LayerTree::on_cell_toggled( const Glib::ustring& path ) if (iter) { Gtk::TreeModel::Row row = *iter; //PF::LayerTreeColumns& columns = columns; - bool visible = (*iter)[treeModel->columns.col_visible]; + bool enabled = (*iter)[treeModel->columns.col_visible]; PF::Layer* l = (*iter)[treeModel->columns.col_layer]; if( !l ) return; #ifndef NDEBUG - std::cout<<"Toggled visibility of layer \""<get_name()<<"\": "<get_name()<<"\": "<set_visible( visible ); + l->set_enabled( enabled ); l->set_dirty( true ); //layer_manager->rebuild( PF::PF_COLORSPACE_RGB, VIPS_FORMAT_UCHAR, 100,100 ); l->get_image()->update(); @@ -253,7 +253,7 @@ void PF::LayerTree::update_model( Gtk::TreeModel::Row parent_row ) li != sublayers.end(); li++ ) { PF::Layer* l = *li; row = *(treeModel->prepend(parent_row.children())); - row[treeModel->columns.col_visible] = l->is_visible(); + row[treeModel->columns.col_visible] = l->is_enabled(); row[treeModel->columns.col_name] = l->get_name(); row[treeModel->columns.col_layer] = l; if( l->get_processor()->get_par()->has_intensity() ) @@ -291,7 +291,7 @@ void PF::LayerTree::update_model() continue; } Gtk::TreeModel::Row row = *(treeModel->prepend()); - row[treeModel->columns.col_visible] = l->is_visible(); + row[treeModel->columns.col_visible] = l->is_enabled(); row[treeModel->columns.col_name] = l->get_name(); row[treeModel->columns.col_layer] = l; if( l->get_processor()->get_par()->has_intensity() ) @@ -325,7 +325,7 @@ void PF::LayerTree::update_model() int layerid; for (iter=children.begin(), layerid=0; iter != children.end(); iter++, layerid++) { if (layerid >= layers.size()) break; - bool visible = layers[layerid]->is_visible(); + bool visible = layers[layerid]->is_enabled(); const std::string& name = layers[layerid]->get_name(); (*iter)[columns.col_visible] = visible; (*iter)[columns.col_name] = name; @@ -342,7 +342,7 @@ void PF::LayerTree::update_model() if (layerid < layers.size()) { // Append additional layers at the end of the list for (; layerid < layers.size(); layerid++) { - bool visible = layers[layerid]->is_visible(); + bool visible = layers[layerid]->is_enabled(); const std::string& name = layers[layerid]->get_name(); Gtk::TreeModel::Row row = *(treeModel->append()); row[columns.col_visible] = visible; @@ -415,6 +415,7 @@ bool PF::LayerTree::get_row(int id, const Gtk::TreeModel::Children& rows, Gtk::T return true; } } + return false; } diff --git a/src/gui/operations/raw_developer_config.cc b/src/gui/operations/raw_developer_config.cc index 326d0c2cd..ddb987b42 100644 --- a/src/gui/operations/raw_developer_config.cc +++ b/src/gui/operations/raw_developer_config.cc @@ -209,7 +209,7 @@ void PF::RawDeveloperConfigDialog::do_update() maker = makermodel; model = tmodel; wbModeSelector.set_maker_model( maker, model ); - std::cout<<"RawDeveloperConfigDialog::do_update(): maker="<Xsize; @@ -279,7 +274,9 @@ PF::RawImage::RawImage( const std::string f ): // Save the LibRaw parameters into the image void* buf2 = malloc( sizeof(dcraw_data_t) ); if( !buf2 ) return; - memcpy( buf2, buf, sizeof(dcraw_data_t) ); + memcpy( buf2, pdata, sizeof(dcraw_data_t) ); + dcraw_data_t* image_data = (dcraw_data_t*)buf2; + std::cout<<"RawImage: WB = "<color.cam_mul[0]<<" "<color.cam_mul[1]<<" "<color.cam_mul[2]<& in, int first, switch( wb_mode.get_enum_value().first ) { case PF::WB_CAMERA: + std::cout<<"RawOutputPar::build(): WB = "<color.cam_mul[0]<<" "<color.cam_mul[1]<<" "<color.cam_mul[2]<color.cam_mul[0]; wb_green_current = image_data->color.cam_mul[1]; wb_blue_current = image_data->color.cam_mul[2];