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