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