| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #ifndef GrAARectRenderer_DEFINED | 8 #ifndef GrAARectRenderer_DEFINED |
| 9 #define GrAARectRenderer_DEFINED | 9 #define GrAARectRenderer_DEFINED |
| 10 | 10 |
| 11 #include "GrColor.h" | 11 #include "GrColor.h" |
| 12 #include "SkMatrix.h" | 12 #include "SkMatrix.h" |
| 13 #include "SkRect.h" | 13 #include "SkRect.h" |
| 14 #include "SkRefCnt.h" | |
| 15 #include "SkStrokeRec.h" | 14 #include "SkStrokeRec.h" |
| 16 | 15 |
| 17 class GrClip; | 16 class GrClip; |
| 18 class GrDrawTarget; | 17 class GrDrawTarget; |
| 19 class GrIndexBuffer; | 18 class GrIndexBuffer; |
| 20 class GrPipelineBuilder; | 19 class GrPipelineBuilder; |
| 21 | 20 |
| 22 /* | 21 /* |
| 23 * This class wraps helper functions that draw AA rects (filled & stroked) | 22 * This class wraps helper functions that draw AA rects (filled & stroked) |
| 24 */ | 23 */ |
| 25 class GrAARectRenderer : public SkRefCnt { | 24 class GrAARectRenderer { |
| 26 public: | 25 public: |
| 27 SK_DECLARE_INST_COUNT(GrAARectRenderer) | |
| 28 | |
| 29 // TODO: potentialy fuse the fill & stroke methods and differentiate | 26 // TODO: potentialy fuse the fill & stroke methods and differentiate |
| 30 // between them by passing in stroke (==NULL means fill). | 27 // between them by passing in stroke (==NULL means fill). |
| 31 | 28 |
| 32 void fillAARect(GrDrawTarget* target, | 29 static void FillAARect(GrDrawTarget* target, |
| 33 GrPipelineBuilder* pipelineBuilder, | 30 GrPipelineBuilder* pipelineBuilder, |
| 34 GrColor color, | 31 GrColor color, |
| 35 const SkMatrix& viewMatrix, | 32 const SkMatrix& viewMatrix, |
| 36 const SkRect& rect, | 33 const SkRect& rect, |
| 37 const SkRect& devRect) { | 34 const SkRect& devRect) { |
| 38 this->geometryFillAARect(target, pipelineBuilder, color, viewMatrix, rec
t, devRect); | 35 GeometryFillAARect(target, pipelineBuilder, color, viewMatrix, rect, dev
Rect); |
| 39 } | 36 } |
| 40 | 37 |
| 41 void strokeAARect(GrDrawTarget*, | 38 static void StrokeAARect(GrDrawTarget*, |
| 42 GrPipelineBuilder*, | 39 GrPipelineBuilder*, |
| 43 GrColor, | 40 GrColor, |
| 44 const SkMatrix& viewMatrix, | 41 const SkMatrix& viewMatrix, |
| 45 const SkRect& rect, | 42 const SkRect& rect, |
| 46 const SkRect& devRect, | 43 const SkRect& devRect, |
| 47 const SkStrokeRec& stroke); | 44 const SkStrokeRec& stroke); |
| 48 | 45 |
| 49 // First rect is outer; second rect is inner | 46 // First rect is outer; second rect is inner |
| 50 void fillAANestedRects(GrDrawTarget*, | 47 static void FillAANestedRects(GrDrawTarget*, |
| 51 GrPipelineBuilder*, | 48 GrPipelineBuilder*, |
| 52 GrColor, | 49 GrColor, |
| 53 const SkMatrix& viewMatrix, | 50 const SkMatrix& viewMatrix, |
| 54 const SkRect rects[2]); | 51 const SkRect rects[2]); |
| 55 | 52 |
| 56 private: | 53 private: |
| 57 void geometryFillAARect(GrDrawTarget*, | 54 GrAARectRenderer(); |
| 58 GrPipelineBuilder*, | |
| 59 GrColor, | |
| 60 const SkMatrix& viewMatrix, | |
| 61 const SkRect& rect, | |
| 62 const SkRect& devRect); | |
| 63 | 55 |
| 64 void geometryStrokeAARect(GrDrawTarget*, | 56 static void GeometryFillAARect(GrDrawTarget*, |
| 65 GrPipelineBuilder*, | 57 GrPipelineBuilder*, |
| 66 GrColor, | 58 GrColor, |
| 67 const SkMatrix& viewMatrix, | 59 const SkMatrix& viewMatrix, |
| 68 const SkRect& devOutside, | 60 const SkRect& rect, |
| 69 const SkRect& devOutsideAssist, | 61 const SkRect& devRect); |
| 70 const SkRect& devInside, | |
| 71 bool miterStroke); | |
| 72 | 62 |
| 73 typedef SkRefCnt INHERITED; | 63 static void GeometryStrokeAARect(GrDrawTarget*, |
| 64 GrPipelineBuilder*, |
| 65 GrColor, |
| 66 const SkMatrix& viewMatrix, |
| 67 const SkRect& devOutside, |
| 68 const SkRect& devOutsideAssist, |
| 69 const SkRect& devInside, |
| 70 bool miterStroke); |
| 74 }; | 71 }; |
| 75 | 72 |
| 76 #endif // GrAARectRenderer_DEFINED | 73 #endif // GrAARectRenderer_DEFINED |
| OLD | NEW |