/src/skia/src/gpu/effects/GrOvalEffect.cpp
Line | Count | Source (jump to first uncovered line) |
1 | | /* |
2 | | * Copyright 2014 Google Inc. |
3 | | * |
4 | | * Use of this source code is governed by a BSD-style license that can be |
5 | | * found in the LICENSE file. |
6 | | */ |
7 | | |
8 | | #include "include/core/SkRect.h" |
9 | | #include "src/gpu/GrFragmentProcessor.h" |
10 | | #include "src/gpu/effects/GrOvalEffect.h" |
11 | | |
12 | | GrFPResult GrOvalEffect::Make(std::unique_ptr<GrFragmentProcessor> inputFP, GrClipEdgeType edgeType, |
13 | 6 | const SkRect& oval, const GrShaderCaps& caps) { |
14 | 6 | SkScalar w = oval.width(); |
15 | 6 | SkScalar h = oval.height(); |
16 | 6 | if (SkScalarNearlyEqual(w, h)) { |
17 | 0 | w /= 2; |
18 | 0 | return GrFragmentProcessor::Circle(std::move(inputFP), edgeType, |
19 | 0 | SkPoint::Make(oval.fLeft + w, oval.fTop + w), w); |
20 | 6 | } else { |
21 | 6 | w /= 2; |
22 | 6 | h /= 2; |
23 | 6 | return GrFragmentProcessor::Ellipse(std::move(inputFP), edgeType, |
24 | 6 | SkPoint::Make(oval.fLeft + w, oval.fTop + h), |
25 | 6 | SkPoint::Make(w, h), caps); |
26 | 6 | } |
27 | 0 | SkUNREACHABLE; |
28 | 0 | } |