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 #include "GrAARectRenderer.h" | 8 #include "GrAARectRenderer.h" |
9 #include "GrGpu.h" | 9 #include "GrGpu.h" |
10 #include "gl/builders/GrGLProgramBuilder.h" | 10 #include "gl/builders/GrGLProgramBuilder.h" |
11 #include "gl/GrGLProcessor.h" | 11 #include "gl/GrGLProcessor.h" |
12 #include "gl/GrGLGeometryProcessor.h" | 12 #include "gl/GrGLGeometryProcessor.h" |
13 #include "GrTBackendProcessorFactory.h" | 13 #include "GrTBackendProcessorFactory.h" |
14 #include "SkColorPriv.h" | 14 #include "SkColorPriv.h" |
15 #include "GrGeometryProcessor.h" | 15 #include "GrGeometryProcessor.h" |
16 | 16 |
17 /////////////////////////////////////////////////////////////////////////////// | 17 /////////////////////////////////////////////////////////////////////////////// |
18 class GrGLAlignedRectEffect; | 18 class GrGLAlignedRectEffect; |
19 | 19 |
20 // Axis Aligned special case | 20 // Axis Aligned special case |
21 class GrAlignedRectEffect : public GrGeometryProcessor { | 21 class GrAlignedRectEffect : public GrGeometryProcessor { |
22 public: | 22 public: |
23 static GrGeometryProcessor* Create() { | 23 static GrGeometryProcessor* Create() { |
24 GR_CREATE_STATIC_GEOMETRY_PROCESSOR(gAlignedRectEffect, GrAlignedRectEff
ect, ()); | 24 GR_CREATE_STATIC_PROCESSOR(gAlignedRectEffect, GrAlignedRectEffect, ()); |
25 gAlignedRectEffect->ref(); | 25 gAlignedRectEffect->ref(); |
26 return gAlignedRectEffect; | 26 return gAlignedRectEffect; |
27 } | 27 } |
28 | 28 |
29 virtual ~GrAlignedRectEffect() {} | 29 virtual ~GrAlignedRectEffect() {} |
30 | 30 |
31 static const char* Name() { return "AlignedRectEdge"; } | 31 static const char* Name() { return "AlignedRectEdge"; } |
32 | 32 |
33 const GrShaderVar& inRect() const { return fInRect; } | 33 const GrShaderVar& inRect() const { return fInRect; } |
34 | 34 |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 * Half height + 0.5 | 138 * Half height + 0.5 |
139 * The center and vector are stored in a vec4 varying ("RectEdge") with the | 139 * The center and vector are stored in a vec4 varying ("RectEdge") with the |
140 * center in the xy components and the vector in the zw components. | 140 * center in the xy components and the vector in the zw components. |
141 * The munged width and height are stored in a vec2 varying ("WidthHeight") | 141 * The munged width and height are stored in a vec2 varying ("WidthHeight") |
142 * with the width in x and the height in y. | 142 * with the width in x and the height in y. |
143 */ | 143 */ |
144 | 144 |
145 class GrRectEffect : public GrGeometryProcessor { | 145 class GrRectEffect : public GrGeometryProcessor { |
146 public: | 146 public: |
147 static GrGeometryProcessor* Create() { | 147 static GrGeometryProcessor* Create() { |
148 GR_CREATE_STATIC_GEOMETRY_PROCESSOR(gRectEffect, GrRectEffect, ()); | 148 GR_CREATE_STATIC_PROCESSOR(gRectEffect, GrRectEffect, ()); |
149 gRectEffect->ref(); | 149 gRectEffect->ref(); |
150 return gRectEffect; | 150 return gRectEffect; |
151 } | 151 } |
152 | 152 |
153 virtual ~GrRectEffect() {} | 153 virtual ~GrRectEffect() {} |
154 | 154 |
155 static const char* Name() { return "RectEdge"; } | 155 static const char* Name() { return "RectEdge"; } |
156 | 156 |
157 const GrShaderVar& inRectEdge() const { return fInRectEdge; } | 157 const GrShaderVar& inRectEdge() const { return fInRectEdge; } |
158 const GrShaderVar& inWidthHeight() const { return fInWidthHeight; } | 158 const GrShaderVar& inWidthHeight() const { return fInWidthHeight; } |
(...skipping 802 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
961 // can't call mapRect for devInside since it calls sort | 961 // can't call mapRect for devInside since it calls sort |
962 combinedMatrix.mapPoints((SkPoint*)&devInside, (const SkPoint*)&rects[1], 2)
; | 962 combinedMatrix.mapPoints((SkPoint*)&devInside, (const SkPoint*)&rects[1], 2)
; |
963 | 963 |
964 if (devInside.isEmpty()) { | 964 if (devInside.isEmpty()) { |
965 this->fillAARect(gpu, target, devOutside, SkMatrix::I(), devOutside); | 965 this->fillAARect(gpu, target, devOutside, SkMatrix::I(), devOutside); |
966 return; | 966 return; |
967 } | 967 } |
968 | 968 |
969 this->geometryStrokeAARect(gpu, target, devOutside, devOutsideAssist, devIns
ide, true); | 969 this->geometryStrokeAARect(gpu, target, devOutside, devOutsideAssist, devIns
ide, true); |
970 } | 970 } |
OLD | NEW |