xref: /aosp_15_r20/external/skia/src/gpu/ganesh/mock/GrMockTypes.cpp (revision c8dee2aa9b3f27cf6c858bd81872bdeb2c07ed17)
1 /*
2  * Copyright 2019 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 #include "include/gpu/ganesh/mock/GrMockTypes.h"
9 
10 #include "include/core/SkTextureCompressionType.h"
11 #include "include/gpu/ganesh/GrBackendSurface.h"
12 #include "include/gpu/ganesh/GrTypes.h"
13 #include "src/gpu/ganesh/mock/GrMockTypesPriv.h"
14 
getBackendFormat() const15 GrBackendFormat GrMockRenderTargetInfo::getBackendFormat() const {
16     return GrBackendFormat::MakeMock(fColorType, SkTextureCompressionType::kNone);
17 }
18 
getBackendFormat() const19 GrBackendFormat GrMockTextureInfo::getBackendFormat() const {
20     return GrBackendFormat::MakeMock(fColorType, fCompressionType);
21 }
22 
GrMockTextureSpecToSurfaceInfo(const GrMockTextureSpec & mockSpec,uint32_t sampleCount,uint32_t levelCount,GrProtected isProtected)23 GrMockSurfaceInfo GrMockTextureSpecToSurfaceInfo(const GrMockTextureSpec& mockSpec,
24                                                  uint32_t sampleCount,
25                                                  uint32_t levelCount,
26                                                  GrProtected isProtected) {
27     GrMockSurfaceInfo info;
28     // Shared info
29     info.fSampleCount = sampleCount;
30     info.fLevelCount = levelCount;
31     info.fProtected = isProtected;
32 
33     // Mock info
34     info.fColorType = mockSpec.fColorType;
35     info.fCompressionType = mockSpec.fCompressionType;
36 
37     return info;
38 }
39