| 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 "SkStrokeRec.h" | 14 #include "SkStrokeRec.h" |
| 15 | 15 |
| 16 class GrClip; | 16 class GrClip; |
| 17 class GrDrawTarget; | 17 class GrDrawTarget; |
| 18 class GrIndexBuffer; | 18 class GrIndexBuffer; |
| 19 class GrPipelineBuilder; | 19 class GrPipelineBuilder; |
| 20 | 20 |
| 21 /* | 21 /* |
| 22 * This class wraps helper functions that draw AA rects (filled & stroked) | 22 * This class wraps helper functions that draw AA rects (filled & stroked) |
| 23 */ | 23 */ |
| 24 class GrAARectRenderer { | 24 class GrAARectRenderer { |
| 25 public: | 25 public: |
| 26 // TODO: potentialy fuse the fill & stroke methods and differentiate | 26 // TODO: potentialy fuse the fill & stroke methods and differentiate |
| 27 // between them by passing in stroke (==NULL means fill). | 27 // between them by passing in stroke (==NULL means fill). |
| 28 | 28 |
| 29 static void FillAARect(GrDrawTarget* target, | 29 static void FillAARect(GrDrawTarget* target, |
| 30 GrPipelineBuilder* pipelineBuilder, | 30 const GrPipelineBuilder& pipelineBuilder, |
| 31 GrColor color, | 31 GrColor color, |
| 32 const SkMatrix& viewMatrix, | 32 const SkMatrix& viewMatrix, |
| 33 const SkRect& rect, | 33 const SkRect& rect, |
| 34 const SkRect& devRect) { | 34 const SkRect& devRect) { |
| 35 GeometryFillAARect(target, pipelineBuilder, color, viewMatrix, rect, dev
Rect); | 35 GeometryFillAARect(target, pipelineBuilder, color, viewMatrix, rect, dev
Rect); |
| 36 } | 36 } |
| 37 | 37 |
| 38 static void StrokeAARect(GrDrawTarget*, | 38 static void StrokeAARect(GrDrawTarget*, |
| 39 GrPipelineBuilder*, | 39 const GrPipelineBuilder&, |
| 40 GrColor, | 40 GrColor, |
| 41 const SkMatrix& viewMatrix, | 41 const SkMatrix& viewMatrix, |
| 42 const SkRect& rect, | 42 const SkRect& rect, |
| 43 const SkRect& devRect, | 43 const SkRect& devRect, |
| 44 const SkStrokeRec& stroke); | 44 const SkStrokeRec& stroke); |
| 45 | 45 |
| 46 // First rect is outer; second rect is inner | 46 // First rect is outer; second rect is inner |
| 47 static void FillAANestedRects(GrDrawTarget*, | 47 static void FillAANestedRects(GrDrawTarget*, |
| 48 GrPipelineBuilder*, | 48 const GrPipelineBuilder&, |
| 49 GrColor, | 49 GrColor, |
| 50 const SkMatrix& viewMatrix, | 50 const SkMatrix& viewMatrix, |
| 51 const SkRect rects[2]); | 51 const SkRect rects[2]); |
| 52 | 52 |
| 53 private: | 53 private: |
| 54 GrAARectRenderer(); | 54 GrAARectRenderer(); |
| 55 | 55 |
| 56 static void GeometryFillAARect(GrDrawTarget*, | 56 static void GeometryFillAARect(GrDrawTarget*, |
| 57 GrPipelineBuilder*, | 57 const GrPipelineBuilder&, |
| 58 GrColor, | 58 GrColor, |
| 59 const SkMatrix& viewMatrix, | 59 const SkMatrix& viewMatrix, |
| 60 const SkRect& rect, | 60 const SkRect& rect, |
| 61 const SkRect& devRect); | 61 const SkRect& devRect); |
| 62 | 62 |
| 63 static void GeometryStrokeAARect(GrDrawTarget*, | 63 static void GeometryStrokeAARect(GrDrawTarget*, |
| 64 GrPipelineBuilder*, | 64 const GrPipelineBuilder&, |
| 65 GrColor, | 65 GrColor, |
| 66 const SkMatrix& viewMatrix, | 66 const SkMatrix& viewMatrix, |
| 67 const SkRect& devOutside, | 67 const SkRect& devOutside, |
| 68 const SkRect& devOutsideAssist, | 68 const SkRect& devOutsideAssist, |
| 69 const SkRect& devInside, | 69 const SkRect& devInside, |
| 70 bool miterStroke); | 70 bool miterStroke); |
| 71 }; | 71 }; |
| 72 | 72 |
| 73 #endif // GrAARectRenderer_DEFINED | 73 #endif // GrAARectRenderer_DEFINED |
| OLD | NEW |