GrFillRectOp.h 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /*
  2. * Copyright 2018 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 GrFillRectOp_DEFINED
  8. #define GrFillRectOp_DEFINED
  9. #include "include/private/GrTypesPriv.h"
  10. #include "src/gpu/GrRenderTargetContext.h"
  11. class GrDrawOp;
  12. class GrPaint;
  13. class GrQuad;
  14. class GrRecordingContext;
  15. struct GrUserStencilSettings;
  16. class SkMatrix;
  17. struct SkRect;
  18. /**
  19. * A set of factory functions for drawing filled rectangles either coverage-antialiased, or
  20. * non-antialiased. The non-antialiased ops can be used with MSAA. As with other GrDrawOp factories,
  21. * the GrPaint is only consumed by these methods if a valid op is returned. If null is returned then
  22. * the paint is unmodified and may still be used.
  23. */
  24. namespace GrFillRectOp {
  25. std::unique_ptr<GrDrawOp> Make(GrRecordingContext* context,
  26. GrPaint&& paint,
  27. GrAAType aaType,
  28. GrQuadAAFlags aaFlags,
  29. const GrQuad& deviceQuad,
  30. const GrQuad& localQuad,
  31. const GrUserStencilSettings* stencil = nullptr);
  32. // Utility function to create a non-AA rect transformed by view. This is used commonly enough in
  33. // testing and GMs that manage ops without going through GrRTC that it's worth the convenience.
  34. std::unique_ptr<GrDrawOp> MakeNonAARect(GrRecordingContext* context,
  35. GrPaint&& paint,
  36. const SkMatrix& view,
  37. const SkRect& rect,
  38. const GrUserStencilSettings* stencil = nullptr);
  39. // Bulk API for drawing quads with a single op
  40. // TODO(michaelludwig) - remove if the bulk API is not useful for SkiaRenderer
  41. std::unique_ptr<GrDrawOp> MakeSet(GrRecordingContext* context,
  42. GrPaint&& paint,
  43. GrAAType aaType,
  44. const SkMatrix& viewMatrix,
  45. const GrRenderTargetContext::QuadSetEntry quads[],
  46. int quadCount,
  47. const GrUserStencilSettings* stencil = nullptr);
  48. } // namespace GrFillRectOp
  49. #endif // GrFillRectOp_DEFINED