2014-12-17 21:37:13 +00:00
|
|
|
/*
|
|
|
|
* Copyright 2014 Google Inc.
|
|
|
|
*
|
|
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
|
|
* found in the LICENSE file.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef GrCoverageSetOpXP_DEFINED
|
|
|
|
#define GrCoverageSetOpXP_DEFINED
|
|
|
|
|
|
|
|
#include "GrTypes.h"
|
|
|
|
#include "GrXferProcessor.h"
|
|
|
|
#include "SkRegion.h"
|
|
|
|
|
|
|
|
class GrProcOptInfo;
|
|
|
|
|
2017-01-09 16:46:10 +00:00
|
|
|
// See the comment above GrXPFactory's definition about this warning suppression.
|
|
|
|
#if defined(__GNUC__) || defined(__clang)
|
|
|
|
#pragma GCC diagnostic push
|
|
|
|
#pragma GCC diagnostic ignored "-Wnon-virtual-dtor"
|
|
|
|
#endif
|
|
|
|
|
2015-02-17 15:34:43 +00:00
|
|
|
/**
|
|
|
|
* This xfer processor directly blends the the src coverage with the dst using a set operator. It is
|
|
|
|
* useful for rendering coverage masks using CSG. It can optionally invert the src coverage before
|
|
|
|
* applying the set operator.
|
|
|
|
*/
|
2014-12-17 21:37:13 +00:00
|
|
|
class GrCoverageSetOpXPFactory : public GrXPFactory {
|
|
|
|
public:
|
2017-01-09 16:46:10 +00:00
|
|
|
static const GrXPFactory* Get(SkRegion::Op regionOp, bool invertCoverage = false);
|
2014-12-17 21:37:13 +00:00
|
|
|
|
2015-06-02 17:43:39 +00:00
|
|
|
void getInvariantBlendedColor(const GrProcOptInfo& colorPOI,
|
|
|
|
GrXPFactory::InvariantBlendedColor*) const override;
|
2014-12-17 21:37:13 +00:00
|
|
|
|
|
|
|
private:
|
2017-01-09 16:46:10 +00:00
|
|
|
constexpr GrCoverageSetOpXPFactory(SkRegion::Op regionOp, bool invertCoverage);
|
2014-12-17 21:37:13 +00:00
|
|
|
|
2016-12-21 14:20:25 +00:00
|
|
|
GrXferProcessor* onCreateXferProcessor(const GrCaps&,
|
|
|
|
const GrPipelineAnalysis&,
|
2015-06-08 22:11:04 +00:00
|
|
|
bool hasMixedSamples,
|
2015-05-26 16:49:05 +00:00
|
|
|
const DstTexture*) const override;
|
2015-02-06 15:02:37 +00:00
|
|
|
|
2017-01-20 19:06:29 +00:00
|
|
|
bool willReadDstColor(const GrCaps&, ColorType, CoverageType) const override { return false; }
|
2015-02-06 15:02:37 +00:00
|
|
|
|
2014-12-17 21:37:13 +00:00
|
|
|
GR_DECLARE_XP_FACTORY_TEST;
|
|
|
|
|
|
|
|
SkRegion::Op fRegionOp;
|
|
|
|
bool fInvertCoverage;
|
|
|
|
|
|
|
|
typedef GrXPFactory INHERITED;
|
|
|
|
};
|
2017-01-09 16:46:10 +00:00
|
|
|
#if defined(__GNUC__) || defined(__clang)
|
|
|
|
#pragma GCC diagnostic pop
|
|
|
|
#endif
|
2014-12-17 21:37:13 +00:00
|
|
|
#endif
|
|
|
|
|