X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=synfig-core%2Ftrunk%2Fsrc%2Fsynfig%2Flayer_shape.cpp;h=e8f13a5d6156a40fd23dc0b0ecaa2af95b463cc6;hb=d15c4522466bedfbe61620c401becae0931854f5;hp=a686bcffa3cecd4bcbf46829f029a6112368c092;hpb=2e98eca8dbf8e348f2456d9a9372cf23055a81c9;p=synfig.git diff --git a/synfig-core/trunk/src/synfig/layer_shape.cpp b/synfig-core/trunk/src/synfig/layer_shape.cpp index a686bcf..e8f13a5 100644 --- a/synfig-core/trunk/src/synfig/layer_shape.cpp +++ b/synfig-core/trunk/src/synfig/layer_shape.cpp @@ -1,12 +1,12 @@ /* === S Y N F I G ========================================================= */ /*! \file layer_shape.cpp -** \brief Template Header +** \brief Implementation of the "Shape" layer ** ** $Id$ ** ** \legal ** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley -** Copyright (c) 2007 Chris Moore +** Copyright (c) 2007, 2008 Chris Moore ** ** This package is free software; you can redistribute it and/or ** modify it under the terms of the GNU General Public License as @@ -60,8 +60,8 @@ using namespace etl; SYNFIG_LAYER_INIT(Layer_Shape); SYNFIG_LAYER_SET_NAME(Layer_Shape,"shape"); -SYNFIG_LAYER_SET_LOCAL_NAME(Layer_Shape,_("Shape")); -SYNFIG_LAYER_SET_CATEGORY(Layer_Shape,_("Internal")); +SYNFIG_LAYER_SET_LOCAL_NAME(Layer_Shape,N_("Shape")); +SYNFIG_LAYER_SET_CATEGORY(Layer_Shape,N_("Internal")); SYNFIG_LAYER_SET_VERSION(Layer_Shape,"0.1"); SYNFIG_LAYER_SET_CVS_ID(Layer_Shape,"$Id$"); @@ -245,11 +245,13 @@ struct MonoSegment //assumes that the rect culled away anything that would be beyond the edges if(ydir > 0) { - while(y > (*++p)[1]); + while(y > (*++p)[1]) + ; } else { - while(y < (*++p)[1]); + while(y < (*++p)[1]) + ; } //for the loop to break there must have been a slope (straight line would do nothing) @@ -335,7 +337,7 @@ struct CurveArray if( (y > ymax && y > p[1][1]) || (y < ymin && y < p[1][1]) ) return 0; //degenerate line max - if(ymin == ymax == p[1][1]) + if(ymin == ymax && ymax == p[1][1]) return 0; //degenerate accept - to the right and crossing the base line @@ -945,7 +947,7 @@ struct PenMark void setcover(Real c, Real a) { cover = c; area = a; } void addcover(Real c, Real a) { cover += c; area += a; } - bool operator < (const PenMark &rhs) const + bool operator<(const PenMark &rhs) const { return y == rhs.y ? x < rhs.x : y < rhs.y; } @@ -1149,7 +1151,9 @@ Layer_Shape::clear() bool Layer_Shape::set_param(const String & param, const ValueBase &value) { - IMPORT(color); + IMPORT_PLUS(color, { if (color.get_a() == 0) { if (converted_blend_) { + set_blend_method(Color::BLEND_ALPHA_OVER); + color.set_a(1); } else transparent_color_ = true; } }); IMPORT(offset); IMPORT(invert); IMPORT(antialias); @@ -1187,7 +1191,7 @@ Layer_Shape::get_param_vocab()const .set_description(_("Layer_Shape Color")) ); ret.push_back(ParamDesc("offset") - .set_local_name(_("Position")) + .set_local_name(_("Offset")) ); ret.push_back(ParamDesc("invert") .set_local_name(_("Invert")) @@ -1291,7 +1295,7 @@ Layer_Shape::get_color(Context context, const Point &p)const //************** SCANLINE RENDERING ********************* void Layer_Shape::PolySpan::line_to(Real x, Real y) { - Real n[4]; + Real n[4] = {0,0,0,0}; bool afterx = false; const Real xin(x), yin(y); @@ -2477,8 +2481,8 @@ Layer_Shape::accelerated_render(Context context,Surface *surface,int quality, co Rect nrect; - Real pixelfeatherx = abs(feather/pw), - pixelfeathery = abs(feather/ph); + Real pixelfeatherx = quality == 10 ? 0 : abs(feather/pw), + pixelfeathery = quality == 10 ? 0 : abs(feather/ph); nrect.set_point((aabb.minx - tl[0])/pw,(aabb.miny - tl[1])/ph); nrect.expand((aabb.maxx - tl[0])/pw,(aabb.maxy - tl[1])/ph); @@ -2519,7 +2523,7 @@ Layer_Shape::accelerated_render(Context context,Surface *surface,int quality, co if(cb && !cb->amount_complete(10000,10001+renddesc.get_h())) return false; - if(feather) + if(feather && quality != 10) { //we have to blur rather than be crappy @@ -2859,7 +2863,7 @@ Layer_Shape::render_shape(Surface *surface,bool useblend,int /*quality*/, } bool -Layer_Shape::render_shape(surface *surface,int /*quality*/, +Layer_Shape::render_shape(etl::surface *surface,int /*quality*/, const RendDesc &renddesc, ProgressCallback */*cb*/)const { // If our amount is set to zero, no need to render anything