blob: c70f9779e0e90a2d46d71bc73e6a758d1e919abf [file] [log] [blame]
// Copyright (C) 2016 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package image
import (
"android.googlesource.com/platform/tools/gpu/framework/binary"
"android.googlesource.com/platform/tools/gpu/framework/math/sint"
)
type fmtETC2_RGB8 struct{ binary.Generate }
func (f *fmtETC2_RGB8) Key() interface{} { return *f }
func (*fmtETC2_RGB8) String() string { return "ETC2_RGB8" }
func (*fmtETC2_RGB8) Size(w, h int) int {
return (sint.Max(sint.AlignUp(w, 4), 4) * sint.Max(sint.AlignUp(h, 4), 4)) / 2
}
func (*fmtETC2_RGB8) Check(d []byte, w, h int) error {
return checkSize(d, sint.Max(sint.AlignUp(w, 4), 4), sint.Max(sint.AlignUp(h, 4), 4), 4)
}
// ETC2_RGB8 returns a format representing the COMPRESSED_RGB8_ETC2 texture
// compression format.
func ETC2_RGB8() Format { return &fmtETC2_RGB8{} }
type fmtETC2_RGBA8_EAC struct{ binary.Generate }
func (f *fmtETC2_RGBA8_EAC) Key() interface{} { return *f }
func (*fmtETC2_RGBA8_EAC) String() string { return "ETC2_RGBA8_EAC" }
func (*fmtETC2_RGBA8_EAC) Size(w, h int) int {
return (sint.Max(sint.AlignUp(w, 4), 4) * sint.Max(sint.AlignUp(h, 4), 4))
}
func (*fmtETC2_RGBA8_EAC) Check(d []byte, w, h int) error {
return checkSize(d, sint.Max(sint.AlignUp(w, 4), 4), sint.Max(sint.AlignUp(h, 4), 4), 8)
}
// ETC2_RGBA8_EAC returns a format representing the COMPRESSED_RGBA8_ETC2_EAC
// texture compression format.
func ETC2_RGBA8_EAC() Format { return &fmtETC2_RGBA8_EAC{} }