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