| 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 "GrRRectEffect.h" | 8 #include "GrRRectEffect.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 // This effect only supports circular corner rrects where all corners have the s
ame radius | 16 // This effect only supports circular corner rrects where all corners have the s
ame radius |
| 17 // which must be <= kRadiusMin. | 17 // which must be <= kRadiusMin. |
| 18 static const SkScalar kRadiusMin = 0.5; | 18 static const SkScalar kRadiusMin = 0.5f; |
| 19 | 19 |
| 20 ////////////////////////////////////////////////////////////////////////////// | 20 ////////////////////////////////////////////////////////////////////////////// |
| 21 class GrGLRRectEffect : public GrGLEffect { | 21 class GrGLRRectEffect : public GrGLEffect { |
| 22 public: | 22 public: |
| 23 GrGLRRectEffect(const GrBackendEffectFactory&, const GrDrawEffect&); | 23 GrGLRRectEffect(const GrBackendEffectFactory&, const GrDrawEffect&); |
| 24 | 24 |
| 25 virtual void emitCode(GrGLShaderBuilder* builder, | 25 virtual void emitCode(GrGLShaderBuilder* builder, |
| 26 const GrDrawEffect& drawEffect, | 26 const GrDrawEffect& drawEffect, |
| 27 EffectKey key, | 27 EffectKey key, |
| 28 const char* outputColor, | 28 const char* outputColor, |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 const GrDrawTargetCaps& caps, | 146 const GrDrawTargetCaps& caps, |
| 147 GrTexture*[]) { | 147 GrTexture*[]) { |
| 148 SkScalar w = random->nextRangeScalar(20.f, 1000.f); | 148 SkScalar w = random->nextRangeScalar(20.f, 1000.f); |
| 149 SkScalar h = random->nextRangeScalar(20.f, 1000.f); | 149 SkScalar h = random->nextRangeScalar(20.f, 1000.f); |
| 150 SkScalar r = random->nextRangeF(kRadiusMin, 9.f); | 150 SkScalar r = random->nextRangeF(kRadiusMin, 9.f); |
| 151 SkRRect rrect; | 151 SkRRect rrect; |
| 152 rrect.setRectXY(SkRect::MakeWH(w, h), r, r); | 152 rrect.setRectXY(SkRect::MakeWH(w, h), r, r); |
| 153 | 153 |
| 154 return GrRRectEffect::Create(rrect); | 154 return GrRRectEffect::Create(rrect); |
| 155 } | 155 } |
| OLD | NEW |