/* === S Y N F I G ========================================================= */
/*! \file layer_shape.cpp
-** \brief Template Header
+** \brief Implementation of the "Shape" layer
**
** $Id$
**
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$");
//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)
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
{
Rect aabb;
- //! true iff aabb hasn't been initialised yet
+ //! true iff aabb hasn't been initialized yet
bool initaabb;
int flags;
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);
.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"))
//************** 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);
{
if(num >= MAX_SUBDIVISION_SIZE)
{
- warning("Curve subdivision somehow ran out of space while tesselating!");
+ warning("Curve subdivision somehow ran out of space while tessellating!");
//do something...
assert(0);
{
if(num >= MAX_SUBDIVISION_SIZE)
{
- warning("Curve subdivision somehow ran out of space while tesselating!");
+ warning("Curve subdivision somehow ran out of space while tessellating!");
//do something...
assert(0);
//case all in same pixel
if(ix1 == ix2) //impossible for degenerate case (covered by the previous cases)
{
- current.addcover(dy,(fx1 + fx2)*dy/2); //horizontal trapazoid area
+ current.addcover(dy,(fx1 + fx2)*dy/2); //horizontal trapezoid area
return;
}
mult = (1 - fx1)*dydx; //next y intersection diff value (at 1)
//first pixel
- current.addcover(mult,(1 + fx1)*mult/2); // fx1,fy1,1,fy@1 - starting trapazoidal area
+ current.addcover(mult,(1 + fx1)*mult/2); // fx1,fy1,1,fy@1 - starting trapezoidal area
//move to the next pixel
fy1 += mult;
mult = fx1*dydx; //next y intersection diff value
//first pixel
- current.addcover(mult,fx1*mult/2); // fx1,fy1,0,fy@0 - starting trapazoidal area
+ current.addcover(mult,fx1*mult/2); // fx1,fy1,0,fy@0 - starting trapezoidal area
//move to next pixel
fy1 += mult;
mult = (1 - fy1) * dxdy;
- //x interset scanline
+ //x intersect scanline
x_from = x1 + mult;
draw_scanline(iy1,x1,fy1,x_from,1);
mult = fy1 * dxdy;
- //x interset scanline
+ //x intersect scanline
x_from = x1 + mult;
draw_scanline(iy1,x1,fy1,x_from,0);
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);
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
PolySpan span;
- //optimization for tesselating only inside tiles
+ // if the pixels are zero sized then we're too zoomed out to see anything
+ if (pw == 0 || ph == 0)
+ return true;
+
+ //optimization for tessellating only inside tiles
span.window.minx = 0;
span.window.miny = 0;
span.window.maxx = w;
}
bool
-Layer_Shape::render_shape(surface<float> *surface,int /*quality*/,
+Layer_Shape::render_shape(etl::surface<float> *surface,int /*quality*/,
const RendDesc &renddesc, ProgressCallback */*cb*/)const
{
// If our amount is set to zero, no need to render anything
PolySpan span;
- //optimization for tesselating only inside tiles
+ //optimization for tessellating only inside tiles
span.window.minx = 0;
span.window.miny = 0;
span.window.maxx = w;