1 /*
2 * Copyright 2014 Google Inc.
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 GrDisableColorXP_DEFINED
9 #define GrDisableColorXP_DEFINED
10
11 #include "include/core/SkRefCnt.h"
12 #include "include/gpu/GrTypes.h"
13 #include "src/gpu/ganesh/GrProcessorUnitTest.h"
14 #include "src/gpu/ganesh/GrXferProcessor.h"
15
16 // See the comment above GrXPFactory's definition about this warning suppression.
17 #if defined(__GNUC__)
18 #pragma GCC diagnostic push
19 #pragma GCC diagnostic ignored "-Wnon-virtual-dtor"
20 #endif
21 #if defined(__clang__)
22 #pragma clang diagnostic push
23 #pragma clang diagnostic ignored "-Wnon-virtual-dtor"
24 #endif
25 class GrDisableColorXPFactory : public GrXPFactory {
26 public:
27 static const GrDisableColorXPFactory* Get();
28
29 static sk_sp<const GrXferProcessor> MakeXferProcessor();
30
31 private:
GrDisableColorXPFactory()32 constexpr GrDisableColorXPFactory() {}
33
analysisProperties(const GrProcessorAnalysisColor &,const GrProcessorAnalysisCoverage &,const GrCaps &,GrClampType)34 AnalysisProperties analysisProperties(
35 const GrProcessorAnalysisColor&, const GrProcessorAnalysisCoverage&, const GrCaps&,
36 GrClampType) const override {
37 return AnalysisProperties::kCompatibleWithCoverageAsAlpha |
38 AnalysisProperties::kIgnoresInputColor;
39 }
40
makeXferProcessor(const GrProcessorAnalysisColor &,GrProcessorAnalysisCoverage,const GrCaps &,GrClampType)41 sk_sp<const GrXferProcessor> makeXferProcessor(
42 const GrProcessorAnalysisColor&, GrProcessorAnalysisCoverage, const GrCaps&,
43 GrClampType) const override {
44 return MakeXferProcessor();
45 }
46
47 GR_DECLARE_XP_FACTORY_TEST
48
49 using INHERITED = GrXPFactory;
50 };
51 #if defined(__GNUC__)
52 #pragma GCC diagnostic pop
53 #endif
54 #if defined(__clang__)
55 #pragma clang diagnostic pop
56 #endif
57
Get()58 inline const GrDisableColorXPFactory* GrDisableColorXPFactory::Get() {
59 static constexpr const GrDisableColorXPFactory gDisableColorXPFactory;
60 return &gDisableColorXPFactory;
61 }
62
63 #endif
64