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