File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -8,13 +8,11 @@ import (
88 "image"
99 "image/color"
1010 "log"
11- "unsafe"
1211
1312 "github.com/go-gl/gl/v2.1/gl"
1413 "github.com/golang/freetype/truetype"
1514 "github.com/llgcode/draw2d"
1615 "github.com/llgcode/draw2d/draw2dbase"
17- "github.com/llgcode/draw2d/draw2dimg"
1816
1917 "golang.org/x/image/font"
2018 "golang.org/x/image/math/fixed"
@@ -658,12 +656,5 @@ func fUnitsToFloat64(x fixed.Int26_6) float64 {
658656 return float64 (scaled / 256 ) + float64 (scaled % 256 )/ 256.0
659657}
660658
661- // Ensure pathFlattener implements the Flattener interface
662- var _ draw2dbase.Flattener = (* pathFlattener )(nil )
663-
664659// Make sure the interface is satisfied at compile time
665660var _ draw2d.GraphicContext = (* GraphicContext )(nil )
666-
667- func init () {
668- _ = unsafe .Sizeof (Point2D {})
669- }
Original file line number Diff line number Diff line change 44package draw2dgles2
55
66import (
7+ "math"
78 "testing"
89)
910
@@ -196,13 +197,13 @@ func BenchmarkTriangulate(b *testing.B) {
196197}
197198
198199func BenchmarkTriangulateLarge (b * testing.B ) {
199- // Create a polygon with many vertices
200+ // Create a polygon with many vertices (circular pattern)
200201 vertices := make ([]Point2D , 100 )
201202 for i := 0 ; i < 100 ; i ++ {
202- angle := float32 (i ) * 3.14159 * 2 / 100
203+ angle := float64 (i ) * 3.14159 * 2 / 100
203204 vertices [i ] = Point2D {
204- X : 50 + 40 * float32 (cos ( float64 ( angle ) )),
205- Y : 50 + 40 * float32 (sin ( float64 ( angle ) )),
205+ X : 50 + 40 * float32 (math . Cos ( angle )),
206+ Y : 50 + 40 * float32 (math . Sin ( angle )),
206207 }
207208 }
208209
@@ -211,13 +212,3 @@ func BenchmarkTriangulateLarge(b *testing.B) {
211212 Triangulate (vertices )
212213 }
213214}
214-
215- func cos (x float64 ) float64 {
216- // Simple cos approximation for benchmark
217- return float64 (Point2D {}.X ) // Placeholder
218- }
219-
220- func sin (x float64 ) float64 {
221- // Simple sin approximation for benchmark
222- return float64 (Point2D {}.Y ) // Placeholder
223- }
You can’t perform that action at this time.
0 commit comments