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 #include "include/core/SkImage.h" 12 13 #include "include/gpu/GrBackendSurface.h" 14 15 SkImage::CompressionType GrBackendFormatToCompressionType(const GrBackendFormat& format); 16 17 // Returns the number of bytes per texel block for the given format. All non compressed formats 18 // are treated as having a block size of 1x1, so this is equivalent to bytesPerPixel. 19 size_t GrBackendFormatBytesPerBlock(const GrBackendFormat& format); 20 21 // Returns the number of bytes per pixel for the given format. All compressed formats will return 0. 22 size_t GrBackendFormatBytesPerPixel(const GrBackendFormat& format); 23 24 int GrBackendFormatStencilBits(const GrBackendFormat& format); 25 26 #endif 27