GrStrokeRectOp.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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 GrStrokeRectOp_DEFINED
  8. #define GrStrokeRectOp_DEFINED
  9. #include "include/private/GrTypesPriv.h"
  10. class GrDrawOp;
  11. class GrPaint;
  12. class GrRecordingContext;
  13. class SkMatrix;
  14. struct SkRect;
  15. class SkStrokeRec;
  16. /**
  17. * A set of factory functions for drawing stroked rectangles either coverage-antialiased, or
  18. * non-antialiased. The non-antialiased ops can be used with MSAA. As with other GrDrawOp factories,
  19. * the GrPaint is only consumed by these methods if a valid op is returned. If null is returned then
  20. * the paint is unmodified and may still be used.
  21. */
  22. namespace GrStrokeRectOp {
  23. std::unique_ptr<GrDrawOp> Make(GrRecordingContext* context,
  24. GrPaint&& paint,
  25. GrAAType aaType,
  26. const SkMatrix& viewMatrix,
  27. const SkRect& rect,
  28. const SkStrokeRec& stroke);
  29. // rects[0] == outer rectangle, rects[1] == inner rectangle. Null return means there is nothing to
  30. // draw rather than failure. The area between the rectangles will be filled by the paint, and it
  31. // will be anti-aliased with coverage AA. viewMatrix.rectStaysRect() must be true.
  32. std::unique_ptr<GrDrawOp> MakeNested(GrRecordingContext* context,
  33. GrPaint&& paint,
  34. const SkMatrix& viewMatrix,
  35. const SkRect rects[2]);
  36. } // namespace GrStrokeRectOp
  37. #endif // GrStrokeRectOp_DEFINED