| 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 | 8 |
| 9 #ifndef GrAARectRenderer_DEFINED | 9 #ifndef GrAARectRenderer_DEFINED |
| 10 #define GrAARectRenderer_DEFINED | 10 #define GrAARectRenderer_DEFINED |
| 11 | 11 |
| 12 #include "GrRect.h" | 12 #include "GrRect.h" |
| 13 #include "GrRefCnt.h" | 13 #include "GrRefCnt.h" |
| 14 | 14 |
| 15 class GrGpu; | 15 class GrGpu; |
| 16 class GrDrawTarget; | 16 class GrDrawTarget; |
| 17 class GrIndexBuffer; | 17 class GrIndexBuffer; |
| 18 class SkMatrix; |
| 18 | 19 |
| 19 /* | 20 /* |
| 20 * This class wraps helper functions that draw AA rects (filled & stroked) | 21 * This class wraps helper functions that draw AA rects (filled & stroked) |
| 21 */ | 22 */ |
| 22 class GrAARectRenderer : public GrRefCnt { | 23 class GrAARectRenderer : public GrRefCnt { |
| 23 public: | 24 public: |
| 24 SK_DECLARE_INST_COUNT(GrAARectRenderer) | 25 SK_DECLARE_INST_COUNT(GrAARectRenderer) |
| 25 | 26 |
| 26 GrAARectRenderer() | 27 GrAARectRenderer() |
| 27 : fAAFillRectIndexBuffer(NULL) | 28 : fAAFillRectIndexBuffer(NULL) |
| 28 , fAAStrokeRectIndexBuffer(NULL) { | 29 , fAAStrokeRectIndexBuffer(NULL) { |
| 29 } | 30 } |
| 30 | 31 |
| 31 void reset(); | 32 void reset(); |
| 32 | 33 |
| 33 ~GrAARectRenderer() { | 34 ~GrAARectRenderer() { |
| 34 this->reset(); | 35 this->reset(); |
| 35 } | 36 } |
| 36 | 37 |
| 37 // TODO: potentialy fuse the fill & stroke methods and differentiate | 38 // TODO: potentialy fuse the fill & stroke methods and differentiate |
| 38 // btween them by passing in strokeWidth (<0 means fill). | 39 // between them by passing in strokeWidth (<0 means fill). |
| 39 | 40 |
| 40 // TODO: Remove the useVertexCoverage boolean. Just use it all the time | 41 // TODO: Remove the useVertexCoverage boolean. Just use it all the time |
| 41 // since we now have a coverage vertex attribute | 42 // since we now have a coverage vertex attribute |
| 42 void fillAARect(GrGpu* gpu, | 43 void fillAARect(GrGpu* gpu, |
| 43 GrDrawTarget* target, | 44 GrDrawTarget* target, |
| 44 const GrRect& devRect, | 45 const GrRect& devRect, |
| 45 bool useVertexCoverage); | 46 bool useVertexCoverage); |
| 46 | 47 |
| 48 void shaderFillAARect(GrGpu* gpu, |
| 49 GrDrawTarget* target, |
| 50 const GrRect& rect, |
| 51 const SkMatrix& combinedMatrix, |
| 52 const GrRect& devRect, |
| 53 bool useVertexCoverage); |
| 54 |
| 47 void strokeAARect(GrGpu* gpu, | 55 void strokeAARect(GrGpu* gpu, |
| 48 GrDrawTarget* target, | 56 GrDrawTarget* target, |
| 49 const GrRect& devRect, | 57 const GrRect& devRect, |
| 50 const GrVec& devStrokeSize, | 58 const GrVec& devStrokeSize, |
| 51 bool useVertexCoverage); | 59 bool useVertexCoverage); |
| 52 | 60 |
| 53 private: | 61 private: |
| 54 GrIndexBuffer* fAAFillRectIndexBuffer; | 62 GrIndexBuffer* fAAFillRectIndexBuffer; |
| 55 GrIndexBuffer* fAAStrokeRectIndexBuffer; | 63 GrIndexBuffer* fAAStrokeRectIndexBuffer; |
| 56 | 64 |
| 57 GrIndexBuffer* aaFillRectIndexBuffer(GrGpu* gpu); | 65 GrIndexBuffer* aaFillRectIndexBuffer(GrGpu* gpu); |
| 58 | 66 |
| 59 static int aaStrokeRectIndexCount(); | 67 static int aaStrokeRectIndexCount(); |
| 60 GrIndexBuffer* aaStrokeRectIndexBuffer(GrGpu* gpu); | 68 GrIndexBuffer* aaStrokeRectIndexBuffer(GrGpu* gpu); |
| 61 | 69 |
| 62 typedef GrRefCnt INHERITED; | 70 typedef GrRefCnt INHERITED; |
| 63 }; | 71 }; |
| 64 | 72 |
| 65 #endif // GrAARectRenderer_DEFINED | 73 #endif // GrAARectRenderer_DEFINED |
| OLD | NEW |