| 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 "SkMatrix.h" | 12 #include "SkMatrix.h" |
| 12 #include "SkRect.h" | 13 #include "SkRect.h" |
| 13 #include "SkRefCnt.h" | 14 #include "SkRefCnt.h" |
| 14 #include "SkStrokeRec.h" | 15 #include "SkStrokeRec.h" |
| 15 | 16 |
| 16 class GrGpu; | 17 class GrGpu; |
| 17 class GrDrawState; | 18 class GrDrawState; |
| 18 class GrDrawTarget; | 19 class GrDrawTarget; |
| 19 class GrIndexBuffer; | 20 class GrIndexBuffer; |
| 20 | 21 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 36 | 37 |
| 37 ~GrAARectRenderer() { | 38 ~GrAARectRenderer() { |
| 38 this->reset(); | 39 this->reset(); |
| 39 } | 40 } |
| 40 | 41 |
| 41 // TODO: potentialy fuse the fill & stroke methods and differentiate | 42 // TODO: potentialy fuse the fill & stroke methods and differentiate |
| 42 // between them by passing in stroke (==NULL means fill). | 43 // between them by passing in stroke (==NULL means fill). |
| 43 | 44 |
| 44 void fillAARect(GrDrawTarget* target, | 45 void fillAARect(GrDrawTarget* target, |
| 45 GrDrawState* ds, | 46 GrDrawState* ds, |
| 47 GrColor color, |
| 46 const SkRect& rect, | 48 const SkRect& rect, |
| 47 const SkMatrix& combinedMatrix, | 49 const SkMatrix& combinedMatrix, |
| 48 const SkRect& devRect) { | 50 const SkRect& devRect) { |
| 49 this->geometryFillAARect(target, ds, rect, combinedMatrix, devRect); | 51 this->geometryFillAARect(target, ds, color, rect, combinedMatrix, devRec
t); |
| 50 } | 52 } |
| 51 | 53 |
| 52 void strokeAARect(GrDrawTarget*, | 54 void strokeAARect(GrDrawTarget*, |
| 53 GrDrawState*, | 55 GrDrawState*, |
| 56 GrColor, |
| 54 const SkRect& rect, | 57 const SkRect& rect, |
| 55 const SkMatrix& combinedMatrix, | 58 const SkMatrix& combinedMatrix, |
| 56 const SkRect& devRect, | 59 const SkRect& devRect, |
| 57 const SkStrokeRec& stroke); | 60 const SkStrokeRec& stroke); |
| 58 | 61 |
| 59 // First rect is outer; second rect is inner | 62 // First rect is outer; second rect is inner |
| 60 void fillAANestedRects(GrDrawTarget*, | 63 void fillAANestedRects(GrDrawTarget*, |
| 61 GrDrawState*, | 64 GrDrawState*, |
| 65 GrColor, |
| 62 const SkRect rects[2], | 66 const SkRect rects[2], |
| 63 const SkMatrix& combinedMatrix); | 67 const SkMatrix& combinedMatrix); |
| 64 | 68 |
| 65 private: | 69 private: |
| 66 GrIndexBuffer* aaStrokeRectIndexBuffer(bool miterStroke); | 70 GrIndexBuffer* aaStrokeRectIndexBuffer(bool miterStroke); |
| 67 | 71 |
| 68 void geometryFillAARect(GrDrawTarget*, | 72 void geometryFillAARect(GrDrawTarget*, |
| 69 GrDrawState*, | 73 GrDrawState*, |
| 74 GrColor, |
| 70 const SkRect& rect, | 75 const SkRect& rect, |
| 71 const SkMatrix& combinedMatrix, | 76 const SkMatrix& combinedMatrix, |
| 72 const SkRect& devRect); | 77 const SkRect& devRect); |
| 73 | 78 |
| 74 void geometryStrokeAARect(GrDrawTarget*, | 79 void geometryStrokeAARect(GrDrawTarget*, |
| 75 GrDrawState*, | 80 GrDrawState*, |
| 81 GrColor, |
| 76 const SkRect& devOutside, | 82 const SkRect& devOutside, |
| 77 const SkRect& devOutsideAssist, | 83 const SkRect& devOutsideAssist, |
| 78 const SkRect& devInside, | 84 const SkRect& devInside, |
| 79 bool miterStroke); | 85 bool miterStroke); |
| 80 | 86 |
| 81 GrGpu* fGpu; | 87 GrGpu* fGpu; |
| 82 GrIndexBuffer* fAAFillRectIndexBuffer; | 88 GrIndexBuffer* fAAFillRectIndexBuffer; |
| 83 GrIndexBuffer* fAAMiterStrokeRectIndexBuffer; | 89 GrIndexBuffer* fAAMiterStrokeRectIndexBuffer; |
| 84 GrIndexBuffer* fAABevelStrokeRectIndexBuffer; | 90 GrIndexBuffer* fAABevelStrokeRectIndexBuffer; |
| 85 | 91 |
| 86 typedef SkRefCnt INHERITED; | 92 typedef SkRefCnt INHERITED; |
| 87 }; | 93 }; |
| 88 | 94 |
| 89 #endif // GrAARectRenderer_DEFINED | 95 #endif // GrAARectRenderer_DEFINED |
| OLD | NEW |