• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2023 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 #ifndef DisplayParams_DEFINED
8 #define DisplayParams_DEFINED
9 
10 #include "include/core/SkColorSpace.h"
11 #include "include/core/SkImageInfo.h"
12 #include "include/core/SkSurfaceProps.h"
13 #include "include/gpu/GrContextOptions.h"
14 
15 #if defined(SK_GRAPHITE)
16 #include "include/gpu/graphite/ContextOptions.h"
17 #include "include/private/gpu/graphite/ContextOptionsPriv.h"
18 #endif
19 
20 namespace skwindow {
21 
22 #if defined(SK_GRAPHITE)
23 struct GraphiteContextOptions {
GraphiteContextOptionsGraphiteContextOptions24     GraphiteContextOptions() {
25         fOptions.fOptionsPriv = &fPriv;
26     }
27 
GraphiteContextOptionsGraphiteContextOptions28     GraphiteContextOptions(const GraphiteContextOptions& other)
29         : fOptions(other.fOptions)
30         , fPriv(other.fPriv) {
31         fOptions.fOptionsPriv = &fPriv;
32     }
33 
34     GraphiteContextOptions& operator=(const GraphiteContextOptions& other) {
35         fOptions = other.fOptions;
36         fPriv = other.fPriv;
37         fOptions.fOptionsPriv = &fPriv;
38         return *this;
39     }
40 
41     skgpu::graphite::ContextOptions     fOptions;
42     skgpu::graphite::ContextOptionsPriv fPriv;
43 };
44 
45 #endif
46 
47 struct DisplayParams {
DisplayParamsDisplayParams48     DisplayParams()
49         : fColorType(kN32_SkColorType)
50         , fColorSpace(nullptr)
51         , fMSAASampleCount(1)
52         , fSurfaceProps(0, kRGB_H_SkPixelGeometry)
53         , fDisableVsync(false)
54         , fDelayDrawableAcquisition(false)
55         , fCreateProtectedNativeBackend(false)
56     {}
57 
58     SkColorType            fColorType;
59     sk_sp<SkColorSpace>    fColorSpace;
60     int                    fMSAASampleCount;
61     GrContextOptions       fGrContextOptions;
62 #if defined(SK_GRAPHITE)
63     GraphiteContextOptions fGraphiteContextOptions;
64 #if defined(SK_DAWN)
65     bool fDisableTintSymbolRenaming = false;
66 #endif
67 #endif
68     SkSurfaceProps         fSurfaceProps;
69     bool                   fDisableVsync;
70     bool                   fDelayDrawableAcquisition;
71     bool                   fCreateProtectedNativeBackend = false;
72 };
73 
74 }  // namespace skwindow
75 
76 #endif
77