| 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 "GrConvexPolyEffect.h" | 8 #include "GrConvexPolyEffect.h" |
| 9 | 9 |
| 10 #include "gl/GrGLEffect.h" | 10 #include "gl/GrGLEffect.h" |
| 11 #include "gl/GrGLSL.h" | 11 #include "gl/GrGLSL.h" |
| 12 #include "GrTBackendEffectFactory.h" | 12 #include "GrTBackendEffectFactory.h" |
| 13 | 13 |
| 14 #include "SkPath.h" | 14 #include "SkPath.h" |
| 15 | 15 |
| 16 ////////////////////////////////////////////////////////////////////////////// | 16 ////////////////////////////////////////////////////////////////////////////// |
| 17 class GLAARectEffect; | 17 class GLAARectEffect; |
| 18 | 18 |
| 19 class AARectEffect : public GrEffect { | 19 class AARectEffect : public GrEffect { |
| 20 public: | 20 public: |
| 21 typedef GLAARectEffect GLEffect; | 21 typedef GLAARectEffect GLEffect; |
| 22 | 22 |
| 23 const SkRect& getRect() const { return fRect; } | 23 const SkRect& getRect() const { return fRect; } |
| 24 | 24 |
| 25 static const char* Name() { return "AARect"; } | 25 static const char* Name() { return "AARect"; } |
| 26 | 26 |
| 27 static GrEffectRef* Create(GrEffectEdgeType edgeType, const SkRect& rect) { | 27 static GrEffectRef* Create(GrEffectEdgeType edgeType, const SkRect& rect) { |
| 28 return CreateEffectRef(AutoEffectUnref(SkNEW_ARGS(AARectEffect, (edgeTyp
e, rect)))); | 28 return SkNEW_ARGS(AARectEffect, (edgeType, rect)); |
| 29 } | 29 } |
| 30 | 30 |
| 31 virtual void getConstantColorComponents(GrColor* color, | 31 virtual void getConstantColorComponents(GrColor* color, |
| 32 uint32_t* validFlags) const SK_OVERR
IDE { | 32 uint32_t* validFlags) const SK_OVERR
IDE { |
| 33 if (fRect.isEmpty()) { | 33 if (fRect.isEmpty()) { |
| 34 // An empty rect will have no coverage anywhere. | 34 // An empty rect will have no coverage anywhere. |
| 35 *color = 0x00000000; | 35 *color = 0x00000000; |
| 36 *validFlags = kRGBA_GrColorComponentFlags; | 36 *validFlags = kRGBA_GrColorComponentFlags; |
| 37 } else { | 37 } else { |
| 38 *validFlags = 0; | 38 *validFlags = 0; |
| (...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 365 } | 365 } |
| 366 | 366 |
| 367 GrEffectRef* effect; | 367 GrEffectRef* effect; |
| 368 do { | 368 do { |
| 369 GrEffectEdgeType edgeType = static_cast<GrEffectEdgeType>( | 369 GrEffectEdgeType edgeType = static_cast<GrEffectEdgeType>( |
| 370 random->nextULessThan(kGrEffectEdgeTypeC
nt)); | 370 random->nextULessThan(kGrEffectEdgeTypeC
nt)); |
| 371 effect = GrConvexPolyEffect::Create(edgeType, count, edges); | 371 effect = GrConvexPolyEffect::Create(edgeType, count, edges); |
| 372 } while (NULL == effect); | 372 } while (NULL == effect); |
| 373 return effect; | 373 return effect; |
| 374 } | 374 } |
| OLD | NEW |