mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-01 07:35:40 +00:00
layout: [API] remove FRect
We're about to unexport f32.Rectangle, this change removes the only public API for it. Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
+2
-2
@@ -855,7 +855,7 @@ func (g *compute) blitLayers(d driver.LoadDesc, fbo driver.Texture, viewport ima
|
||||
for _, l := range layers {
|
||||
placef := layout.FPt(l.alloc.rect.Min)
|
||||
sizef := layout.FPt(l.rect.Size())
|
||||
r := layout.FRect(l.rect)
|
||||
r := frect(l.rect)
|
||||
quad := [4]layerVertex{
|
||||
{posX: float32(r.Min.X), posY: float32(r.Min.Y), u: placef.X, v: placef.Y},
|
||||
{posX: float32(r.Max.X), posY: float32(r.Min.Y), u: placef.X + sizef.X, v: placef.Y},
|
||||
@@ -1782,7 +1782,7 @@ func (c *collector) collect(root *op.Ops, viewport image.Point, texOps *[]textur
|
||||
case ops.TypeClip:
|
||||
var op ops.ClipOp
|
||||
op.Decode(encOp.Data)
|
||||
bounds := layout.FRect(op.Bounds)
|
||||
bounds := frect(op.Bounds)
|
||||
c.addClip(&state, fview, bounds, pathData.data, pathData.key, pathData.hash, strWidth, true)
|
||||
pathData.data = nil
|
||||
strWidth = 0
|
||||
|
||||
+18
-4
@@ -695,8 +695,8 @@ func (r *renderer) intersectPath(p *pathOp, clip image.Rectangle) {
|
||||
}
|
||||
fbo := r.pather.stenciler.cover(p.place.Idx)
|
||||
r.ctx.BindTexture(0, fbo.tex)
|
||||
coverScale, coverOff := texSpaceTransform(layout.FRect(uv), fbo.size)
|
||||
subScale, subOff := texSpaceTransform(layout.FRect(sub), p.clip.Size())
|
||||
coverScale, coverOff := texSpaceTransform(frect(uv), fbo.size)
|
||||
subScale, subOff := texSpaceTransform(frect(sub), p.clip.Size())
|
||||
r.pather.stenciler.ipipeline.uniforms.vert.uvTransform = [4]float32{coverScale.X, coverScale.Y, coverOff.X, coverOff.Y}
|
||||
r.pather.stenciler.ipipeline.uniforms.vert.subUVTransform = [4]float32{subScale.X, subScale.Y, subOff.X, subOff.Y}
|
||||
r.pather.stenciler.ipipeline.pipeline.UploadUniforms(r.ctx)
|
||||
@@ -888,7 +888,7 @@ loop:
|
||||
var op ops.ClipOp
|
||||
op.Decode(encOp.Data)
|
||||
quads.key.outline = op.Outline
|
||||
bounds := layout.FRect(op.Bounds)
|
||||
bounds := frect(op.Bounds)
|
||||
trans, off := splitTransform(state.t)
|
||||
if len(quads.aux) > 0 {
|
||||
// There is a clipping path, build the gpu data and update the
|
||||
@@ -1108,7 +1108,7 @@ func (r *renderer) drawOps(cache *resourceCache, ops []imageOp) {
|
||||
Min: img.place.Pos,
|
||||
Max: img.place.Pos.Add(drc.Size()),
|
||||
}
|
||||
coverScale, coverOff := texSpaceTransform(layout.FRect(uv), fbo.size)
|
||||
coverScale, coverOff := texSpaceTransform(frect(uv), fbo.size)
|
||||
p := r.pather.coverer.pipelines[m.material]
|
||||
r.ctx.BindPipeline(p.pipeline)
|
||||
r.ctx.BindVertexBuffer(r.blitter.quadVerts, 0)
|
||||
@@ -1406,3 +1406,17 @@ func isPureOffset(t f32.Affine2D) bool {
|
||||
a, b, _, d, e, _ := t.Elems()
|
||||
return a == 1 && b == 0 && d == 0 && e == 1
|
||||
}
|
||||
|
||||
// frect converts a rectangle to a f32.Rectangle.
|
||||
func frect(r image.Rectangle) f32.Rectangle {
|
||||
return f32.Rectangle{
|
||||
Min: fpt(r.Min), Max: fpt(r.Max),
|
||||
}
|
||||
}
|
||||
|
||||
// fpt converts an point to a f32.Point.
|
||||
func fpt(p image.Point) f32.Point {
|
||||
return f32.Point{
|
||||
X: float32(p.X), Y: float32(p.Y),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user