2 * Copyright 2014 Google Inc.
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
8 #ifndef GrDisableColorXP_DEFINED
9 #define GrDisableColorXP_DEFINED
11 #include "include/core/SkRefCnt.h"
12 #include "include/gpu/GrTypes.h"
13 #include "src/gpu/ganesh/GrXferProcessor.h"
15 // See the comment above GrXPFactory's definition about this warning suppression.
17 #pragma GCC diagnostic push
18 #pragma GCC diagnostic ignored "-Wnon-virtual-dtor"
20 #if defined(__clang__)
21 #pragma clang diagnostic push
22 #pragma clang diagnostic ignored "-Wnon-virtual-dtor"
24 class GrDisableColorXPFactory : public GrXPFactory {
26 static const GrDisableColorXPFactory* Get();
28 static sk_sp<const GrXferProcessor> MakeXferProcessor();
31 constexpr GrDisableColorXPFactory() {}
33 AnalysisProperties analysisProperties(
34 const GrProcessorAnalysisColor&, const GrProcessorAnalysisCoverage&, const GrCaps&,
35 GrClampType) const override {
36 return AnalysisProperties::kCompatibleWithCoverageAsAlpha |
37 AnalysisProperties::kIgnoresInputColor;
40 sk_sp<const GrXferProcessor> makeXferProcessor(
41 const GrProcessorAnalysisColor&, GrProcessorAnalysisCoverage, const GrCaps&,
42 GrClampType) const override {
43 return MakeXferProcessor();
46 GR_DECLARE_XP_FACTORY_TEST
48 using INHERITED = GrXPFactory;
51 #pragma GCC diagnostic pop
53 #if defined(__clang__)
54 #pragma clang diagnostic pop
57 inline const GrDisableColorXPFactory* GrDisableColorXPFactory::Get() {
58 static constexpr const GrDisableColorXPFactory gDisableColorXPFactory;
59 return &gDisableColorXPFactory;