Skip to content

Commit

Permalink
Remove support for .pkm, .ktx, .astc, .dng, .heif, and .heic formats
Browse files Browse the repository at this point in the history
While the skia library claimed these should all be enabled, I've been
unable to actually load those types of image files, so have removed the
illusion of support for them. There are Go implementations for some of
these that could be used instead, albeit likely slower, as they won't
get the benefit of various compiler optimizations that can be done in C.
  • Loading branch information
richardwilkes committed Feb 28, 2022
1 parent 21725cd commit 394f980
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 11 deletions.
31 changes: 20 additions & 11 deletions image_format.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,16 @@ const (
PNG
WBMP
WEBP
PKM
KTX
ASTC
DNG
HEIF
/*
The following formats, though supported in theory, fail to work with the cskia builds I've done.
PKM
KTX
ASTC
DNG
HEIF
*/
knownEncodedImageFormatCount
UnknownEncodedImageFormat EncodedImageFormat = 255
)

Expand All @@ -43,11 +48,15 @@ var imageFormatToExtensions = map[EncodedImageFormat][]string{
PNG: {".png"},
WBMP: {".wbmp"},
WEBP: {".webp"},
PKM: {".pkm"},
KTX: {".ktx"},
ASTC: {".astc"},
DNG: {".dng"},
HEIF: {".heif", ".heic"},
/*
The following formats, though supported in theory, fail to work with the cskia builds I've done.
PKM: {".pkm"},
KTX: {".ktx"},
ASTC: {".astc"},
DNG: {".dng"},
HEIF: {".heif", ".heic"},
*/
}

var (
Expand All @@ -74,7 +83,7 @@ func (e EncodedImageFormat) String() string {

// CanRead returns true if the format can be read.
func (e EncodedImageFormat) CanRead() bool {
return e <= HEIF
return e < knownEncodedImageFormatCount
}

// CanWrite returns true if the format can be written.
Expand Down
Binary file modified internal/skia/libskia_darwin_amd64.a
Binary file not shown.

0 comments on commit 394f980

Please sign in to comment.