1 /* 2 * Copyright 2020 Google LLC 3 * 4 * Use of this source code is governed by a BSD-style license that can be 5 * found in the LICENSE file. 6 */ 7 8 #ifndef GrBackendUtils_DEFINED 9 #define GrBackendUtils_DEFINED 10 11 class GrBackendFormat; 12 enum class SkTextureCompressionType; 13 14 #include <cstddef> 15 16 SkTextureCompressionType GrBackendFormatToCompressionType(const GrBackendFormat& format); 17 18 // Returns the number of bytes per texel block for the given format. All non compressed formats 19 // are treated as having a block size of 1x1, so this is equivalent to bytesPerPixel. 20 size_t GrBackendFormatBytesPerBlock(const GrBackendFormat& format); 21 22 // Returns the number of bytes per pixel for the given format. All compressed formats will return 0. 23 size_t GrBackendFormatBytesPerPixel(const GrBackendFormat& format); 24 25 int GrBackendFormatStencilBits(const GrBackendFormat& format); 26 27 #endif 28