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 "gl/builders/GrGLProgramBuilder.h" | 8 #include "gl/builders/GrGLProgramBuilder.h" |
9 #include "GrAARectRenderer.h" | 9 #include "GrAARectRenderer.h" |
10 #include "GrGpu.h" | 10 #include "GrGpu.h" |
11 #include "gl/GrGLEffect.h" | 11 #include "gl/GrGLEffect.h" |
12 #include "gl/GrGLVertexEffect.h" | 12 #include "gl/GrGLGeometryProcessor.h" |
13 #include "GrTBackendEffectFactory.h" | 13 #include "GrTBackendEffectFactory.h" |
14 #include "SkColorPriv.h" | 14 #include "SkColorPriv.h" |
15 #include "effects/GrVertexEffect.h" | 15 #include "effects/GrGeometryProcessor.h" |
16 | 16 |
17 /////////////////////////////////////////////////////////////////////////////// | 17 /////////////////////////////////////////////////////////////////////////////// |
18 class GrGLAlignedRectEffect; | 18 class GrGLAlignedRectEffect; |
19 | 19 |
| 20 |
| 21 const GrShaderVar kAttrRect("aRect", |
| 22 kVec4f_GrSLType, |
| 23 GrShaderVar::kAttribute_TypeModifier); |
| 24 |
20 // Axis Aligned special case | 25 // Axis Aligned special case |
21 class GrAlignedRectEffect : public GrVertexEffect { | 26 class GrAlignedRectEffect : public GrGeometryProcessor { |
22 public: | 27 public: |
23 static GrEffect* Create() { | 28 static GrEffect* Create() { |
24 GR_CREATE_STATIC_EFFECT(gAlignedRectEffect, GrAlignedRectEffect, ()); | 29 GR_CREATE_STATIC_EFFECT(gAlignedRectEffect, GrAlignedRectEffect, ()); |
25 gAlignedRectEffect->ref(); | 30 gAlignedRectEffect->ref(); |
26 return gAlignedRectEffect; | 31 return gAlignedRectEffect; |
27 } | 32 } |
28 | 33 |
29 virtual ~GrAlignedRectEffect() {} | 34 virtual ~GrAlignedRectEffect() {} |
30 | 35 |
31 static const char* Name() { return "AlignedRectEdge"; } | 36 static const char* Name() { return "AlignedRectEdge"; } |
32 | 37 |
33 virtual void getConstantColorComponents(GrColor* color, | 38 virtual void getConstantColorComponents(GrColor* color, |
34 uint32_t* validFlags) const SK_OVERR
IDE { | 39 uint32_t* validFlags) const SK_OVERR
IDE { |
35 *validFlags = 0; | 40 *validFlags = 0; |
36 } | 41 } |
37 | 42 |
38 virtual const GrBackendEffectFactory& getFactory() const SK_OVERRIDE { | 43 virtual const GrBackendEffectFactory& getFactory() const SK_OVERRIDE { |
39 return GrTBackendEffectFactory<GrAlignedRectEffect>::getInstance(); | 44 return GrTBackendEffectFactory<GrAlignedRectEffect>::getInstance(); |
40 } | 45 } |
41 | 46 |
42 class GLEffect : public GrGLVertexEffect { | 47 class GLEffect : public GrGLGeometryProcessor { |
43 public: | 48 public: |
44 GLEffect(const GrBackendEffectFactory& factory, const GrDrawEffect&) | 49 GLEffect(const GrBackendEffectFactory& factory, const GrDrawEffect&) |
45 : INHERITED (factory) {} | 50 : INHERITED (factory) {} |
46 | 51 |
47 virtual void emitCode(GrGLFullProgramBuilder* builder, | 52 virtual void emitCode(GrGLFullProgramBuilder* builder, |
48 const GrDrawEffect& drawEffect, | 53 const GrDrawEffect& drawEffect, |
49 const GrEffectKey& key, | 54 const GrEffectKey& key, |
50 const char* outputColor, | 55 const char* outputColor, |
51 const char* inputColor, | 56 const char* inputColor, |
52 const TransformedCoordsArray&, | 57 const TransformedCoordsArray&, |
53 const TextureSamplerArray& samplers) SK_OVERRIDE { | 58 const TextureSamplerArray& samplers) SK_OVERRIDE { |
54 // setup the varying for the Axis aligned rect effect | 59 // setup the varying for the Axis aligned rect effect |
55 // xy -> interpolated offset | 60 // xy -> interpolated offset |
56 // zw -> w/2+0.5, h/2+0.5 | 61 // zw -> w/2+0.5, h/2+0.5 |
57 const char *vsRectName, *fsRectName; | 62 const char *vsRectName, *fsRectName; |
58 builder->addVarying(kVec4f_GrSLType, "Rect", &vsRectName, &fsRectNam
e); | 63 builder->addVarying(kVec4f_GrSLType, "Rect", &vsRectName, &fsRectNam
e); |
59 | 64 |
60 GrGLVertexShaderBuilder* vsBuilder = builder->getVertexShaderBuilder
(); | 65 GrGLVertexShaderBuilder* vsBuilder = builder->getVertexShaderBuilder
(); |
61 const SkString* attr0Name = | 66 vsBuilder->codeAppendf("\t%s = %s;\n", vsRectName, kAttrRect.c_str()
); |
62 vsBuilder->getEffectAttributeName(drawEffect.getVertexAttribIndi
ces()[0]); | |
63 vsBuilder->codeAppendf("\t%s = %s;\n", vsRectName, attr0Name->c_str(
)); | |
64 | 67 |
65 GrGLFragmentShaderBuilder* fsBuilder = builder->getFragmentShaderBui
lder(); | 68 GrGLFragmentShaderBuilder* fsBuilder = builder->getFragmentShaderBui
lder(); |
66 // TODO: compute all these offsets, spans, and scales in the VS | 69 // TODO: compute all these offsets, spans, and scales in the VS |
67 fsBuilder->codeAppendf("\tfloat insetW = min(1.0, %s.z) - 0.5;\n", f
sRectName); | 70 fsBuilder->codeAppendf("\tfloat insetW = min(1.0, %s.z) - 0.5;\n", f
sRectName); |
68 fsBuilder->codeAppendf("\tfloat insetH = min(1.0, %s.w) - 0.5;\n", f
sRectName); | 71 fsBuilder->codeAppendf("\tfloat insetH = min(1.0, %s.w) - 0.5;\n", f
sRectName); |
69 fsBuilder->codeAppend("\tfloat outset = 0.5;\n"); | 72 fsBuilder->codeAppend("\tfloat outset = 0.5;\n"); |
70 // For rects > 1 pixel wide and tall the span's are noops (i.e., 1.0
). For rects | 73 // For rects > 1 pixel wide and tall the span's are noops (i.e., 1.0
). For rects |
71 // < 1 pixel wide or tall they serve to normalize the < 1 ramp to a
0 .. 1 range. | 74 // < 1 pixel wide or tall they serve to normalize the < 1 ramp to a
0 .. 1 range. |
72 fsBuilder->codeAppend("\tfloat spanW = insetW + outset;\n"); | 75 fsBuilder->codeAppend("\tfloat spanW = insetW + outset;\n"); |
73 fsBuilder->codeAppend("\tfloat spanH = insetH + outset;\n"); | 76 fsBuilder->codeAppend("\tfloat spanH = insetH + outset;\n"); |
(...skipping 15 matching lines...) Expand all Loading... |
89 | 92 |
90 fsBuilder->codeAppendf("\t%s = %s;\n", outputColor, | 93 fsBuilder->codeAppendf("\t%s = %s;\n", outputColor, |
91 (GrGLSLExpr4(inputColor) * GrGLSLExpr1("cover
age")).c_str()); | 94 (GrGLSLExpr4(inputColor) * GrGLSLExpr1("cover
age")).c_str()); |
92 } | 95 } |
93 | 96 |
94 static void GenKey(const GrDrawEffect&, const GrGLCaps&, GrEffectKeyBuil
der*) {} | 97 static void GenKey(const GrDrawEffect&, const GrGLCaps&, GrEffectKeyBuil
der*) {} |
95 | 98 |
96 virtual void setData(const GrGLProgramDataManager& pdman, const GrDrawEf
fect&) SK_OVERRIDE {} | 99 virtual void setData(const GrGLProgramDataManager& pdman, const GrDrawEf
fect&) SK_OVERRIDE {} |
97 | 100 |
98 private: | 101 private: |
99 typedef GrGLVertexEffect INHERITED; | 102 typedef GrGLGeometryProcessor INHERITED; |
100 }; | 103 }; |
101 | 104 |
102 | 105 |
103 private: | 106 private: |
104 GrAlignedRectEffect() : GrVertexEffect() { | 107 GrAlignedRectEffect() : GrGeometryProcessor() { |
105 this->addVertexAttrib(kVec4f_GrSLType); | 108 this->addVertexAttrib(kAttrRect); |
106 } | 109 } |
107 | 110 |
108 virtual bool onIsEqual(const GrEffect&) const SK_OVERRIDE { return true; } | 111 virtual bool onIsEqual(const GrEffect&) const SK_OVERRIDE { return true; } |
109 | 112 |
110 GR_DECLARE_EFFECT_TEST; | 113 GR_DECLARE_EFFECT_TEST; |
111 | 114 |
112 typedef GrVertexEffect INHERITED; | 115 typedef GrGeometryProcessor INHERITED; |
113 }; | 116 }; |
114 | 117 |
115 | 118 |
116 GR_DEFINE_EFFECT_TEST(GrAlignedRectEffect); | 119 GR_DEFINE_EFFECT_TEST(GrAlignedRectEffect); |
117 | 120 |
118 GrEffect* GrAlignedRectEffect::TestCreate(SkRandom* random, | 121 GrEffect* GrAlignedRectEffect::TestCreate(SkRandom* random, |
119 GrContext* context, | 122 GrContext* context, |
120 const GrDrawTargetCaps&, | 123 const GrDrawTargetCaps&, |
121 GrTexture* textures[]) { | 124 GrTexture* textures[]) { |
122 return GrAlignedRectEffect::Create(); | 125 return GrAlignedRectEffect::Create(); |
123 } | 126 } |
124 | 127 |
125 /////////////////////////////////////////////////////////////////////////////// | 128 /////////////////////////////////////////////////////////////////////////////// |
126 class GrGLRectEffect; | 129 class GrGLRectEffect; |
127 | 130 |
128 /** | 131 /** |
129 * The output of this effect is a modulation of the input color and coverage | 132 * The output of this effect is a modulation of the input color and coverage |
130 * for an arbitrarily oriented rect. The rect is specified as: | 133 * for an arbitrarily oriented rect. The rect is specified as: |
131 * Center of the rect | 134 * Center of the rect |
132 * Unit vector point down the height of the rect | 135 * Unit vector point down the height of the rect |
133 * Half width + 0.5 | 136 * Half width + 0.5 |
134 * Half height + 0.5 | 137 * Half height + 0.5 |
135 * The center and vector are stored in a vec4 varying ("RectEdge") with the | 138 * The center and vector are stored in a vec4 varying ("RectEdge") with the |
136 * center in the xy components and the vector in the zw components. | 139 * center in the xy components and the vector in the zw components. |
137 * The munged width and height are stored in a vec2 varying ("WidthHeight") | 140 * The munged width and height are stored in a vec2 varying ("WidthHeight") |
138 * with the width in x and the height in y. | 141 * with the width in x and the height in y. |
139 */ | 142 */ |
140 class GrRectEffect : public GrVertexEffect { | 143 |
| 144 const GrShaderVar kAttrRectEdge("aRectEdge", |
| 145 kVec4f_GrSLType, |
| 146 GrShaderVar::kAttribute_TypeModifier); |
| 147 |
| 148 const GrShaderVar kAttrWidthHeight("aWidthHeight", |
| 149 kVec2f_GrSLType, |
| 150 GrShaderVar::kAttribute_TypeModifier); |
| 151 |
| 152 class GrRectEffect : public GrGeometryProcessor { |
141 public: | 153 public: |
142 static GrEffect* Create() { | 154 static GrEffect* Create() { |
143 GR_CREATE_STATIC_EFFECT(gRectEffect, GrRectEffect, ()); | 155 GR_CREATE_STATIC_EFFECT(gRectEffect, GrRectEffect, ()); |
144 gRectEffect->ref(); | 156 gRectEffect->ref(); |
145 return gRectEffect; | 157 return gRectEffect; |
146 } | 158 } |
147 | 159 |
148 virtual ~GrRectEffect() {} | 160 virtual ~GrRectEffect() {} |
149 | 161 |
150 static const char* Name() { return "RectEdge"; } | 162 static const char* Name() { return "RectEdge"; } |
151 | 163 |
152 virtual void getConstantColorComponents(GrColor* color, | 164 virtual void getConstantColorComponents(GrColor* color, |
153 uint32_t* validFlags) const SK_OVERR
IDE { | 165 uint32_t* validFlags) const SK_OVERR
IDE { |
154 *validFlags = 0; | 166 *validFlags = 0; |
155 } | 167 } |
156 | 168 |
157 virtual const GrBackendEffectFactory& getFactory() const SK_OVERRIDE { | 169 virtual const GrBackendEffectFactory& getFactory() const SK_OVERRIDE { |
158 return GrTBackendEffectFactory<GrRectEffect>::getInstance(); | 170 return GrTBackendEffectFactory<GrRectEffect>::getInstance(); |
159 } | 171 } |
160 | 172 |
161 class GLEffect : public GrGLVertexEffect { | 173 class GLEffect : public GrGLGeometryProcessor { |
162 public: | 174 public: |
163 GLEffect(const GrBackendEffectFactory& factory, const GrDrawEffect&) | 175 GLEffect(const GrBackendEffectFactory& factory, const GrDrawEffect&) |
164 : INHERITED (factory) {} | 176 : INHERITED (factory) {} |
165 | 177 |
166 virtual void emitCode(GrGLFullProgramBuilder* builder, | 178 virtual void emitCode(GrGLFullProgramBuilder* builder, |
167 const GrDrawEffect& drawEffect, | 179 const GrDrawEffect& drawEffect, |
168 const GrEffectKey& key, | 180 const GrEffectKey& key, |
169 const char* outputColor, | 181 const char* outputColor, |
170 const char* inputColor, | 182 const char* inputColor, |
171 const TransformedCoordsArray&, | 183 const TransformedCoordsArray&, |
172 const TextureSamplerArray& samplers) SK_OVERRIDE { | 184 const TextureSamplerArray& samplers) SK_OVERRIDE { |
173 // setup the varying for the center point and the unit vector | 185 // setup the varying for the center point and the unit vector |
174 // that points down the height of the rect | 186 // that points down the height of the rect |
175 const char *vsRectEdgeName, *fsRectEdgeName; | 187 const char *vsRectEdgeName, *fsRectEdgeName; |
176 builder->addVarying(kVec4f_GrSLType, "RectEdge", | 188 builder->addVarying(kVec4f_GrSLType, "RectEdge", |
177 &vsRectEdgeName, &fsRectEdgeName); | 189 &vsRectEdgeName, &fsRectEdgeName); |
178 | 190 |
179 GrGLVertexShaderBuilder* vsBuilder = builder->getVertexShaderBuilder
(); | 191 GrGLVertexShaderBuilder* vsBuilder = builder->getVertexShaderBuilder
(); |
180 const SkString* attr0Name = | 192 vsBuilder->codeAppendf("\t%s = %s;\n", vsRectEdgeName, kAttrRectEdge
.c_str()); |
181 vsBuilder->getEffectAttributeName(drawEffect.getVertexAttribIndi
ces()[0]); | |
182 vsBuilder->codeAppendf("\t%s = %s;\n", vsRectEdgeName, attr0Name->c_
str()); | |
183 | 193 |
184 // setup the varying for width/2+.5 and height/2+.5 | 194 // setup the varying for width/2+.5 and height/2+.5 |
185 const char *vsWidthHeightName, *fsWidthHeightName; | 195 const char *vsWidthHeightName, *fsWidthHeightName; |
186 builder->addVarying(kVec2f_GrSLType, "WidthHeight", | 196 builder->addVarying(kVec2f_GrSLType, "WidthHeight", |
187 &vsWidthHeightName, &fsWidthHeightName); | 197 &vsWidthHeightName, &fsWidthHeightName); |
188 const SkString* attr1Name = | 198 vsBuilder->codeAppendf("\t%s = %s;\n", vsWidthHeightName, kAttrWidth
Height.c_str()); |
189 vsBuilder->getEffectAttributeName(drawEffect.getVertexAttribIndi
ces()[1]); | |
190 vsBuilder->codeAppendf("\t%s = %s;\n", vsWidthHeightName, attr1Name-
>c_str()); | |
191 | 199 |
192 GrGLFragmentShaderBuilder* fsBuilder = builder->getFragmentShaderBui
lder(); | 200 GrGLFragmentShaderBuilder* fsBuilder = builder->getFragmentShaderBui
lder(); |
193 // TODO: compute all these offsets, spans, and scales in the VS | 201 // TODO: compute all these offsets, spans, and scales in the VS |
194 fsBuilder->codeAppendf("\tfloat insetW = min(1.0, %s.x) - 0.5;\n", f
sWidthHeightName); | 202 fsBuilder->codeAppendf("\tfloat insetW = min(1.0, %s.x) - 0.5;\n", f
sWidthHeightName); |
195 fsBuilder->codeAppendf("\tfloat insetH = min(1.0, %s.y) - 0.5;\n", f
sWidthHeightName); | 203 fsBuilder->codeAppendf("\tfloat insetH = min(1.0, %s.y) - 0.5;\n", f
sWidthHeightName); |
196 fsBuilder->codeAppend("\tfloat outset = 0.5;\n"); | 204 fsBuilder->codeAppend("\tfloat outset = 0.5;\n"); |
197 // For rects > 1 pixel wide and tall the span's are noops (i.e., 1.0
). For rects | 205 // For rects > 1 pixel wide and tall the span's are noops (i.e., 1.0
). For rects |
198 // < 1 pixel wide or tall they serve to normalize the < 1 ramp to a
0 .. 1 range. | 206 // < 1 pixel wide or tall they serve to normalize the < 1 ramp to a
0 .. 1 range. |
199 fsBuilder->codeAppend("\tfloat spanW = insetW + outset;\n"); | 207 fsBuilder->codeAppend("\tfloat spanW = insetW + outset;\n"); |
200 fsBuilder->codeAppend("\tfloat spanH = insetH + outset;\n"); | 208 fsBuilder->codeAppend("\tfloat spanH = insetH + outset;\n"); |
(...skipping 22 matching lines...) Expand all Loading... |
223 | 231 |
224 fsBuilder->codeAppendf("\t%s = %s;\n", outputColor, | 232 fsBuilder->codeAppendf("\t%s = %s;\n", outputColor, |
225 (GrGLSLExpr4(inputColor) * GrGLSLExpr1("cover
age")).c_str()); | 233 (GrGLSLExpr4(inputColor) * GrGLSLExpr1("cover
age")).c_str()); |
226 } | 234 } |
227 | 235 |
228 static void GenKey(const GrDrawEffect&, const GrGLCaps&, GrEffectKeyBuil
der*) {} | 236 static void GenKey(const GrDrawEffect&, const GrGLCaps&, GrEffectKeyBuil
der*) {} |
229 | 237 |
230 virtual void setData(const GrGLProgramDataManager& pdman, const GrDrawEf
fect&) SK_OVERRIDE {} | 238 virtual void setData(const GrGLProgramDataManager& pdman, const GrDrawEf
fect&) SK_OVERRIDE {} |
231 | 239 |
232 private: | 240 private: |
233 typedef GrGLVertexEffect INHERITED; | 241 typedef GrGLGeometryProcessor INHERITED; |
234 }; | 242 }; |
235 | 243 |
236 | 244 |
237 private: | 245 private: |
238 GrRectEffect() : GrVertexEffect() { | 246 GrRectEffect() : GrGeometryProcessor() { |
239 this->addVertexAttrib(kVec4f_GrSLType); | 247 this->addVertexAttrib(kAttrRectEdge); |
240 this->addVertexAttrib(kVec2f_GrSLType); | 248 this->addVertexAttrib(kAttrWidthHeight); |
241 this->setWillReadFragmentPosition(); | 249 this->setWillReadFragmentPosition(); |
242 } | 250 } |
243 | 251 |
244 virtual bool onIsEqual(const GrEffect&) const SK_OVERRIDE { return true; } | 252 virtual bool onIsEqual(const GrEffect&) const SK_OVERRIDE { return true; } |
245 | 253 |
246 GR_DECLARE_EFFECT_TEST; | 254 GR_DECLARE_EFFECT_TEST; |
247 | 255 |
248 typedef GrVertexEffect INHERITED; | 256 typedef GrGeometryProcessor INHERITED; |
249 }; | 257 }; |
250 | 258 |
251 | 259 |
252 GR_DEFINE_EFFECT_TEST(GrRectEffect); | 260 GR_DEFINE_EFFECT_TEST(GrRectEffect); |
253 | 261 |
254 GrEffect* GrRectEffect::TestCreate(SkRandom* random, | 262 GrEffect* GrRectEffect::TestCreate(SkRandom* random, |
255 GrContext* context, | 263 GrContext* context, |
256 const GrDrawTargetCaps&, | 264 const GrDrawTargetCaps&, |
257 GrTexture* textures[]) { | 265 GrTexture* textures[]) { |
258 return GrRectEffect::Create(); | 266 return GrRectEffect::Create(); |
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
639 | 647 |
640 GrDrawTarget::AutoReleaseGeometry geo(target, 4, 0); | 648 GrDrawTarget::AutoReleaseGeometry geo(target, 4, 0); |
641 if (!geo.succeeded()) { | 649 if (!geo.succeeded()) { |
642 GrPrintf("Failed to get space for vertices!\n"); | 650 GrPrintf("Failed to get space for vertices!\n"); |
643 return; | 651 return; |
644 } | 652 } |
645 | 653 |
646 RectVertex* verts = reinterpret_cast<RectVertex*>(geo.vertices()); | 654 RectVertex* verts = reinterpret_cast<RectVertex*>(geo.vertices()); |
647 | 655 |
648 GrEffect* effect = GrRectEffect::Create(); | 656 GrEffect* effect = GrRectEffect::Create(); |
649 static const int kRectAttrIndex = 1; | 657 drawState->setGeometryProcessor(effect)->unref(); |
650 static const int kWidthIndex = 2; | |
651 drawState->setGeometryProcessor(effect, kRectAttrIndex, kWidthIndex)->unref(
); | |
652 | 658 |
653 for (int i = 0; i < 4; ++i) { | 659 for (int i = 0; i < 4; ++i) { |
654 verts[i].fCenter = center; | 660 verts[i].fCenter = center; |
655 verts[i].fDir = dir; | 661 verts[i].fDir = dir; |
656 verts[i].fWidthHeight.fX = newWidth; | 662 verts[i].fWidthHeight.fX = newWidth; |
657 verts[i].fWidthHeight.fY = newHeight; | 663 verts[i].fWidthHeight.fY = newHeight; |
658 } | 664 } |
659 | 665 |
660 SkRect devRect; | 666 SkRect devRect; |
661 combinedMatrix.mapRect(&devRect, rect); | 667 combinedMatrix.mapRect(&devRect, rect); |
(...skipping 27 matching lines...) Expand all Loading... |
689 | 695 |
690 GrDrawTarget::AutoReleaseGeometry geo(target, 4, 0); | 696 GrDrawTarget::AutoReleaseGeometry geo(target, 4, 0); |
691 if (!geo.succeeded()) { | 697 if (!geo.succeeded()) { |
692 GrPrintf("Failed to get space for vertices!\n"); | 698 GrPrintf("Failed to get space for vertices!\n"); |
693 return; | 699 return; |
694 } | 700 } |
695 | 701 |
696 AARectVertex* verts = reinterpret_cast<AARectVertex*>(geo.vertices()); | 702 AARectVertex* verts = reinterpret_cast<AARectVertex*>(geo.vertices()); |
697 | 703 |
698 GrEffect* effect = GrAlignedRectEffect::Create(); | 704 GrEffect* effect = GrAlignedRectEffect::Create(); |
699 static const int kOffsetIndex = 1; | 705 drawState->setGeometryProcessor(effect)->unref(); |
700 drawState->setGeometryProcessor(effect, kOffsetIndex)->unref(); | |
701 | 706 |
702 SkRect devRect; | 707 SkRect devRect; |
703 combinedMatrix.mapRect(&devRect, rect); | 708 combinedMatrix.mapRect(&devRect, rect); |
704 | 709 |
705 SkRect devBounds = { | 710 SkRect devBounds = { |
706 devRect.fLeft - SK_ScalarHalf, | 711 devRect.fLeft - SK_ScalarHalf, |
707 devRect.fTop - SK_ScalarHalf, | 712 devRect.fTop - SK_ScalarHalf, |
708 devRect.fRight + SK_ScalarHalf, | 713 devRect.fRight + SK_ScalarHalf, |
709 devRect.fBottom + SK_ScalarHalf | 714 devRect.fBottom + SK_ScalarHalf |
710 }; | 715 }; |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
949 // can't call mapRect for devInside since it calls sort | 954 // can't call mapRect for devInside since it calls sort |
950 combinedMatrix.mapPoints((SkPoint*)&devInside, (const SkPoint*)&rects[1], 2)
; | 955 combinedMatrix.mapPoints((SkPoint*)&devInside, (const SkPoint*)&rects[1], 2)
; |
951 | 956 |
952 if (devInside.isEmpty()) { | 957 if (devInside.isEmpty()) { |
953 this->fillAARect(gpu, target, devOutside, SkMatrix::I(), devOutside); | 958 this->fillAARect(gpu, target, devOutside, SkMatrix::I(), devOutside); |
954 return; | 959 return; |
955 } | 960 } |
956 | 961 |
957 this->geometryStrokeAARect(gpu, target, devOutside, devOutsideAssist, devIns
ide, true); | 962 this->geometryStrokeAARect(gpu, target, devOutside, devOutsideAssist, devIns
ide, true); |
958 } | 963 } |
OLD | NEW |