OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 "GrOvalEffect.h" | 8 #include "GrOvalEffect.h" |
9 | 9 |
10 #include "gl/GrGLEffect.h" | 10 #include "gl/GrGLEffect.h" |
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
335 case kInverseFillAA_GrEffectEdgeType: | 335 case kInverseFillAA_GrEffectEdgeType: |
336 builder->fsCodeAppend("\t\tfloat alpha = clamp(0.5 + approx_dist, 0.
0, 1.0);\n"); | 336 builder->fsCodeAppend("\t\tfloat alpha = clamp(0.5 + approx_dist, 0.
0, 1.0);\n"); |
337 break; | 337 break; |
338 case kFillBW_GrEffectEdgeType: | 338 case kFillBW_GrEffectEdgeType: |
339 builder->fsCodeAppend("\t\tfloat alpha = approx_dist > 0.0 ? 0.0 : 1
.0;\n"); | 339 builder->fsCodeAppend("\t\tfloat alpha = approx_dist > 0.0 ? 0.0 : 1
.0;\n"); |
340 break; | 340 break; |
341 case kInverseFillBW_GrEffectEdgeType: | 341 case kInverseFillBW_GrEffectEdgeType: |
342 builder->fsCodeAppend("\t\tfloat alpha = approx_dist > 0.0 ? 1.0 : 0
.0;\n"); | 342 builder->fsCodeAppend("\t\tfloat alpha = approx_dist > 0.0 ? 1.0 : 0
.0;\n"); |
343 break; | 343 break; |
344 case kHairlineAA_GrEffectEdgeType: | 344 case kHairlineAA_GrEffectEdgeType: |
345 GrCrash("Hairline not expected here."); | 345 SkFAIL("Hairline not expected here."); |
346 } | 346 } |
347 | 347 |
348 builder->fsCodeAppendf("\t\t%s = %s;\n", outputColor, | 348 builder->fsCodeAppendf("\t\t%s = %s;\n", outputColor, |
349 (GrGLSLExpr4(inputColor) * GrGLSLExpr1("alpha")).c_st
r()); | 349 (GrGLSLExpr4(inputColor) * GrGLSLExpr1("alpha")).c_st
r()); |
350 } | 350 } |
351 | 351 |
352 GrGLEffect::EffectKey GLEllipseEffect::GenKey(const GrDrawEffect& drawEffect, | 352 GrGLEffect::EffectKey GLEllipseEffect::GenKey(const GrDrawEffect& drawEffect, |
353 const GrGLCaps&) { | 353 const GrGLCaps&) { |
354 const EllipseEffect& ee = drawEffect.castEffect<EllipseEffect>(); | 354 const EllipseEffect& ee = drawEffect.castEffect<EllipseEffect>(); |
355 return ee.getEdgeType(); | 355 return ee.getEdgeType(); |
(...skipping 22 matching lines...) Expand all Loading... |
378 w /= 2; | 378 w /= 2; |
379 return CircleEffect::Create(edgeType, SkPoint::Make(oval.fLeft + w, oval
.fTop + w), w); | 379 return CircleEffect::Create(edgeType, SkPoint::Make(oval.fLeft + w, oval
.fTop + w), w); |
380 } else { | 380 } else { |
381 w /= 2; | 381 w /= 2; |
382 h /= 2; | 382 h /= 2; |
383 return EllipseEffect::Create(edgeType, SkPoint::Make(oval.fLeft + w, ova
l.fTop + h), w, h); | 383 return EllipseEffect::Create(edgeType, SkPoint::Make(oval.fLeft + w, ova
l.fTop + h), w, h); |
384 } | 384 } |
385 | 385 |
386 return NULL; | 386 return NULL; |
387 } | 387 } |
OLD | NEW |