blob: 92d4ff57e765f8cbde1f410c006147b1846023af [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 fmtETC1_RGB8 struct{ binary.Generate }
func (f *fmtETC1_RGB8) Key() interface{} { return *f }
func (*fmtETC1_RGB8) String() string { return "ETC1_RGB8" }
func (*fmtETC1_RGB8) Size(w, h int) int {
return (sint.Max(sint.AlignUp(w, 4), 4) * sint.Max(sint.AlignUp(h, 4), 4)) / 2
}
func (*fmtETC1_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)
}
// ETC1_RGB8 returns a format representing the texture compression format
// with the same name.
func ETC1_RGB8() Format { return &fmtETC1_RGB8{} }