Remove no longer needed code

This commit is contained in:
Kovid Goyal
2025-11-08 12:21:28 +05:30
parent 426167d78d
commit 87f4c5ccec
2 changed files with 6 additions and 11 deletions

View File

@@ -12,7 +12,7 @@ import (
var _ = fmt.Print var _ = fmt.Print
func Render(path, original_file_path string, ro *images.RenderOptions, frames []images.IdentifyRecord) (ans []*image_frame, err error) { func render(path, original_file_path string, ro *images.RenderOptions, frames []images.IdentifyRecord) (ans []*image_frame, err error) {
ro.TempfilenameTemplate = shm_template ro.TempfilenameTemplate = shm_template
image_frames, filenames, err := images.RenderWithMagick(path, original_file_path, ro, frames) image_frames, filenames, err := images.RenderWithMagick(path, original_file_path, ro, frames)
if err == nil { if err == nil {
@@ -56,7 +56,7 @@ func render_image_with_magick(imgd *image_data, src *opened_input) (err error) {
if scale_image(imgd) { if scale_image(imgd) {
ro.ResizeTo.X, ro.ResizeTo.Y = imgd.canvas_width, imgd.canvas_height ro.ResizeTo.X, ro.ResizeTo.Y = imgd.canvas_width, imgd.canvas_height
} }
imgd.frames, err = Render(src.FileSystemName(), imgd.source_name, &ro, frames) imgd.frames, err = render(src.FileSystemName(), imgd.source_name, &ro, frames)
if err != nil { if err != nil {
return err return err
} }

View File

@@ -32,13 +32,7 @@ func resize_frame(imgd *image_data, img image.Image) (image.Image, image.Rectang
const shm_template = "kitty-icat-*" const shm_template = "kitty-icat-*"
func add_frame(ctx *images.Context, imgd *image_data, img image.Image, left, top int) *image_frame { func add_frame(ctx *images.Context, imgd *image_data, img image.Image, left, top int) *image_frame {
is_opaque := false is_opaque := imaging.IsOpaque(img)
if imgd.format_uppercase == "JPEG" {
// special cased because EXIF orientation could have already changed this image to an NRGBA making IsOpaque() very slow
is_opaque = true
} else {
is_opaque = imaging.IsOpaque(img)
}
b := img.Bounds() b := img.Bounds()
if imgd.scaled_frac.x != 0 { if imgd.scaled_frac.x != 0 {
img, b = resize_frame(imgd, img) img, b = resize_frame(imgd, img)
@@ -163,10 +157,11 @@ func render_image_with_go(imgd *image_data, src *opened_input) (err error) {
if imgs == nil { if imgs == nil {
return fmt.Errorf("unknown image format") return fmt.Errorf("unknown image format")
} }
imgd.format_uppercase = imgs.Metadata.Format.String()
// Loading could auto orient and therefore change width/height, so // Loading could auto orient and therefore change width/height, so
// re-calculate // re-calculate
imgd.canvas_width = int(imgs.Metadata.PixelWidth) b := imgs.Bounds()
imgd.canvas_height = int(imgs.Metadata.PixelHeight) imgd.canvas_width, imgd.canvas_height = b.Dx(), b.Dy()
set_basic_metadata(imgd) set_basic_metadata(imgd)
scale_image(imgd) scale_image(imgd)
add_frames(&ctx, imgd, imgs) add_frames(&ctx, imgd, imgs)