示例#1
0
 class PrivatePool { } //this make sure we don't share the pool with others
 static Temp <PrivatePool, List <Poly2Tri.TriangulationPoint> > .TempContext Borrow(out List <Poly2Tri.TriangulationPoint> list)
 {
     if (!Temp <PrivatePool, List <Poly2Tri.TriangulationPoint> > .IsInit())
     {
         Temp <PrivatePool, List <Poly2Tri.TriangulationPoint> > .SetNewHandler(
             () => new List <Poly2Tri.TriangulationPoint>(),
             s => s.Clear());
     }
     return(Temp <PrivatePool, List <Poly2Tri.TriangulationPoint> > .Borrow(out list));
 }
示例#2
0
 static TempContext <PixelFarm.CpuBlit.PathWriter> Borrow(out PixelFarm.CpuBlit.PathWriter pathWriter)
 {
     if (!Temp <PixelFarm.CpuBlit.PathWriter> .IsInit())
     {
         Temp <PixelFarm.CpuBlit.PathWriter> .SetNewHandler(
             () => new PixelFarm.CpuBlit.PathWriter(),
             w => w.UnbindVxs());
     }
     return(Temp <PixelFarm.CpuBlit.PathWriter> .Borrow(out pathWriter));
 }
示例#3
0
 public static TempContext <VxsClipper> Borrow(out VxsClipper clipper)
 {
     if (!Temp <VxsClipper> .IsInit())
     {
         Temp <VxsClipper> .SetNewHandler(
             () => new VxsClipper(),
             c => c.Reset());
     }
     return(Temp <VxsClipper> .Borrow(out clipper));
 }
示例#4
0
 public static TempContext <Stroke> Borrow(out Stroke stroke)
 {
     if (!Temp <Stroke> .IsInit())
     {
         Temp <Stroke> .SetNewHandler(() => new Stroke(1),
                                      s =>
         {
             s.Width    = 1;
             s.LineCap  = LineCap.Butt;
             s.LineJoin = LineJoin.Miter;
             s.StrokeSideForClosedShape = StrokeSideForClosedShape.Both;
         }
                                      );//reset?
     }
     return(Temp <Stroke> .Borrow(out stroke));
 }