Compare commits

..

No commits in common. "d334db8291c312421739712ee9701bb4b1397dc9" and "47f11a7423cb2f064da90294299d06e943848827" have entirely different histories.

2 changed files with 11 additions and 22 deletions

View File

@ -337,39 +337,24 @@ func (i *Image) DrawTriangles(srcs [graphics.ShaderSrcImageCount]*Image, vertice
return
}
// Use the fast path when this package is not enabled.
if !needsRestoration() || !i.needsRestoration() {
var srcImages [graphics.ShaderSrcImageCount]*graphicscommand.Image
for i, src := range srcs {
if src == nil {
continue
}
srcImages[i] = src.image
}
i.makeStale(dstRegion)
i.image.DrawTriangles(srcImages, vertices, indices, blend, dstRegion, srcRegions, shader.shader, uniforms, fillRule)
return
}
// makeStaleIfDependingOnAtRegion is not available here.
// This might create cyclic dependency.
theImages.makeStaleIfDependingOn(i)
// TODO: Add tests to confirm this logic.
var srcstale bool
var srcImages [graphics.ShaderSrcImageCount]*graphicscommand.Image
for i, src := range srcs {
for _, src := range srcs {
if src == nil {
continue
}
srcImages[i] = src.image
if src.stale || src.imageType == ImageTypeVolatile {
srcstale = true
break
}
}
// Even if the image is already stale, call makeStale to extend the stale region.
if srcstale {
if srcstale || !needsRestoration() || !i.needsRestoration() {
i.makeStale(dstRegion)
} else if i.stale {
var overwrite bool
@ -391,7 +376,14 @@ func (i *Image) DrawTriangles(srcs [graphics.ShaderSrcImageCount]*Image, vertice
i.appendDrawTrianglesHistory(srcs, vertices, indices, blend, dstRegion, srcRegions, shader, uniforms, fillRule, hint)
}
i.image.DrawTriangles(srcImages, vertices, indices, blend, dstRegion, srcRegions, shader.shader, uniforms, fillRule)
var imgs [graphics.ShaderSrcImageCount]*graphicscommand.Image
for i, src := range srcs {
if src == nil {
continue
}
imgs[i] = src.image
}
i.image.DrawTriangles(imgs, vertices, indices, blend, dstRegion, srcRegions, shader.shader, uniforms, fillRule)
}
func (i *Image) areStaleRegionsIncludedIn(r image.Rectangle) bool {

View File

@ -255,9 +255,6 @@ func Measure(text string, face Face, lineSpacingInPixels float64) (width, height
// Draw and AppendGlyphs automatically create and cache necessary glyphs, so usually you don't have to call CacheGlyphs explicitly.
// If you really care about the performance, CacheGlyphs might be useful.
//
// CacheGlyphs is pretty heavy since it creates all the possible variations of glyphs.
// Call CacheGlyphs only when you really need it.
//
// CacheGlyphs is concurrent-safe.
func CacheGlyphs(text string, face Face) {
var x, y float64