1 /* 2 * Copyright 2013 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 GrOvalRenderer_DEFINED 9 #define GrOvalRenderer_DEFINED 10 11 #include "GrColor.h" 12 13 class GrDrawBatch; 14 class GrShaderCaps; 15 class SkMatrix; 16 struct SkRect; 17 class SkRRect; 18 class SkStrokeRec; 19 20 /* 21 * This class wraps helper functions that draw ovals and roundrects (filled & stroked) 22 */ 23 class GrOvalRenderer { 24 public: 25 static GrDrawBatch* CreateOvalBatch(GrColor, 26 const SkMatrix& viewMatrix, 27 const SkRect& oval, 28 const SkStrokeRec& stroke, 29 GrShaderCaps* shaderCaps); 30 static GrDrawBatch* CreateRRectBatch(GrColor, 31 const SkMatrix& viewMatrix, 32 const SkRRect& rrect, 33 const SkStrokeRec& stroke, 34 GrShaderCaps* shaderCaps); 35 36 private: 37 GrOvalRenderer(); 38 39 static GrDrawBatch* CreateEllipseBatch(GrColor, 40 const SkMatrix& viewMatrix, 41 const SkRect& ellipse, 42 const SkStrokeRec& stroke); 43 static GrDrawBatch* CreateDIEllipseBatch(GrColor, 44 const SkMatrix& viewMatrix, 45 const SkRect& ellipse, 46 const SkStrokeRec& stroke); 47 static GrDrawBatch* CreateCircleBatch(GrColor, 48 const SkMatrix& viewMatrix, 49 const SkRect& circle, 50 const SkStrokeRec& stroke); 51 }; 52 53 #endif // GrOvalRenderer_DEFINED 54