blob: edfcaa89435436b267ef95325b00d2c3cd309cce [file] [log] [blame]
Brian Salomon82c263f2016-12-15 09:54:06 -05001/*
2 * Copyright 2015 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 GrStencilPathOp_DEFINED
9#define GrStencilPathOp_DEFINED
10
Brian Salomon82c263f2016-12-15 09:54:06 -050011#include "GrOp.h"
Brian Salomon82c263f2016-12-15 09:54:06 -050012#include "GrPath.h"
13#include "GrPathRendering.h"
Hal Canary6b20a552017-02-07 14:09:38 -050014#include "GrStencilSettings.h"
Brian Salomon82c263f2016-12-15 09:54:06 -050015
Robert Phillips7c525e62018-06-12 10:11:12 -040016class GrContext;
Robert Phillips009e9af2017-06-15 14:01:04 -040017class GrOpFlushState;
18
Brian Salomon82c263f2016-12-15 09:54:06 -050019class GrStencilPathOp final : public GrOp {
20public:
21 DEFINE_OP_CLASS_ID
22
Robert Phillips7c525e62018-06-12 10:11:12 -040023 static std::unique_ptr<GrOp> Make(GrContext* context,
24 const SkMatrix& viewMatrix,
Brian Salomonf8334782017-01-03 09:42:58 -050025 bool useHWAA,
26 GrPathRendering::FillType fillType,
27 bool hasStencilClip,
Brian Salomonf8334782017-01-03 09:42:58 -050028 const GrScissorState& scissor,
Robert Phillips7c525e62018-06-12 10:11:12 -040029 const GrPath* path);
Brian Salomon82c263f2016-12-15 09:54:06 -050030
31 const char* name() const override { return "StencilPathOp"; }
32
Brian Salomon82c263f2016-12-15 09:54:06 -050033 SkString dumpInfo() const override {
34 SkString string;
Robert Phillipsb9a02a12017-04-06 11:08:40 -040035 string.printf("Path: 0x%p, AA: %d", fPath.get(), fUseHWAA);
Brian Salomon82c263f2016-12-15 09:54:06 -050036 string.append(INHERITED::dumpInfo());
37 return string;
38 }
39
40private:
Robert Phillips7c525e62018-06-12 10:11:12 -040041 friend class GrOpMemoryPool; // for ctor
42
Brian Salomon82c263f2016-12-15 09:54:06 -050043 GrStencilPathOp(const SkMatrix& viewMatrix,
44 bool useHWAA,
45 GrPathRendering::FillType fillType,
46 bool hasStencilClip,
Brian Salomon82c263f2016-12-15 09:54:06 -050047 const GrScissorState& scissor,
Brian Salomon82c263f2016-12-15 09:54:06 -050048 const GrPath* path)
49 : INHERITED(ClassID())
50 , fViewMatrix(viewMatrix)
51 , fUseHWAA(useHWAA)
Robert Phillips65048132017-08-10 08:44:49 -040052 , fFillType(fillType)
53 , fHasStencilClip(hasStencilClip)
Brian Salomon82c263f2016-12-15 09:54:06 -050054 , fScissor(scissor)
Brian Salomon82c263f2016-12-15 09:54:06 -050055 , fPath(path) {
56 this->setBounds(path->getBounds(), HasAABloat::kNo, IsZeroArea::kNo);
57 }
58
Brian Salomon82c263f2016-12-15 09:54:06 -050059 void onPrepare(GrOpFlushState*) override {}
60
Robert Phillips009e9af2017-06-15 14:01:04 -040061 void onExecute(GrOpFlushState* state) override;
Brian Salomon82c263f2016-12-15 09:54:06 -050062
Robert Phillips2f4ddf62017-06-01 08:48:19 -040063 SkMatrix fViewMatrix;
64 bool fUseHWAA;
Robert Phillips65048132017-08-10 08:44:49 -040065 GrPathRendering::FillType fFillType;
66 bool fHasStencilClip;
Robert Phillips2f4ddf62017-06-01 08:48:19 -040067 GrScissorState fScissor;
68 GrPendingIOResource<const GrPath, kRead_GrIOType> fPath;
Brian Salomon82c263f2016-12-15 09:54:06 -050069
70 typedef GrOp INHERITED;
71};
72
73#endif