blob: dd621538b9ba28f941bb02640bdcf89d49559e84 [file] [log] [blame]
Michael Ludwig4089df82018-09-12 15:22:37 -04001/*
2 * Copyright 2018 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
8in half4x4 gradientMatrix;
9
10@coordTransform {
11 gradientMatrix
12}
13
14void main() {
15 sk_OutColor = half4(length(sk_TransformedCoords2D[0].xy));
16}
17
18//////////////////////////////////////////////////////////////////////////////
19
20@header {
21 #include "SkRadialGradient.h"
22}
23
24@make {
25 static std::unique_ptr<GrFragmentProcessor> Make(const SkRadialGradient& gradient,
26 const GrFPArgs& args);
27}
28
29@cppEnd {
30 std::unique_ptr<GrFragmentProcessor> GrRadialGradientLayout::Make(
31 const SkRadialGradient& grad, const GrFPArgs& args) {
32 SkMatrix matrix;
33 if (!grad.totalLocalMatrix(args.fPreLocalMatrix, args.fPostLocalMatrix)->invert(&matrix)) {
34 return nullptr;
35 }
36 matrix.postConcat(grad.getGradientMatrix());
37 return std::unique_ptr<GrFragmentProcessor>(new GrRadialGradientLayout(matrix));
38 }
39}