GrStencilPathOp.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /*
  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. #ifndef GrStencilPathOp_DEFINED
  8. #define GrStencilPathOp_DEFINED
  9. #include "src/gpu/GrPath.h"
  10. #include "src/gpu/GrPathRendering.h"
  11. #include "src/gpu/GrStencilSettings.h"
  12. #include "src/gpu/ops/GrOp.h"
  13. class GrOpFlushState;
  14. class GrRecordingContext;
  15. class GrStencilPathOp final : public GrOp {
  16. public:
  17. DEFINE_OP_CLASS_ID
  18. static std::unique_ptr<GrOp> Make(GrRecordingContext* context,
  19. const SkMatrix& viewMatrix,
  20. bool useHWAA,
  21. GrPathRendering::FillType fillType,
  22. bool hasStencilClip,
  23. const GrScissorState& scissor,
  24. const GrPath* path);
  25. const char* name() const override { return "StencilPathOp"; }
  26. #ifdef SK_DEBUG
  27. SkString dumpInfo() const override {
  28. SkString string;
  29. string.printf("Path: 0x%p, AA: %d", fPath.get(), fUseHWAA);
  30. string.append(INHERITED::dumpInfo());
  31. return string;
  32. }
  33. #endif
  34. private:
  35. friend class GrOpMemoryPool; // for ctor
  36. GrStencilPathOp(const SkMatrix& viewMatrix,
  37. bool useHWAA,
  38. GrPathRendering::FillType fillType,
  39. bool hasStencilClip,
  40. const GrScissorState& scissor,
  41. const GrPath* path)
  42. : INHERITED(ClassID())
  43. , fViewMatrix(viewMatrix)
  44. , fUseHWAA(useHWAA)
  45. , fFillType(fillType)
  46. , fHasStencilClip(hasStencilClip)
  47. , fScissor(scissor)
  48. , fPath(path) {
  49. this->setBounds(path->getBounds(), HasAABloat::kNo, IsZeroArea::kNo);
  50. }
  51. void onPrepare(GrOpFlushState*) override {}
  52. void onExecute(GrOpFlushState*, const SkRect& chainBounds) override;
  53. SkMatrix fViewMatrix;
  54. bool fUseHWAA;
  55. GrPathRendering::FillType fFillType;
  56. bool fHasStencilClip;
  57. GrScissorState fScissor;
  58. GrPendingIOResource<const GrPath, kRead_GrIOType> fPath;
  59. typedef GrOp INHERITED;
  60. };
  61. #endif