OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "cc/paint/paint_shader.h" |
| 6 #include "cc/paint/paint_record.h" |
| 7 |
| 8 #include "third_party/skia/include/effects/SkGradientShader.h" |
| 9 |
| 10 namespace cc { |
| 11 |
| 12 PaintShader::PaintShader(SkColor color) |
| 13 : PaintShader(SkShader::MakeColorShader(SK_ColorTRANSPARENT)) {} |
| 14 PaintShader::PaintShader(const SkPoint points[], |
| 15 const SkColor colors[], |
| 16 const SkScalar pos[], |
| 17 int count, |
| 18 SkShader::TileMode mode, |
| 19 uint32_t flags, |
| 20 const SkMatrix* local_matrix) |
| 21 : PaintShader(SkGradientShader::MakeLinear(points, |
| 22 colors, |
| 23 pos, |
| 24 count, |
| 25 mode, |
| 26 flags, |
| 27 local_matrix)) {} |
| 28 PaintShader::PaintShader(const SkPoint& center, |
| 29 SkScalar radius, |
| 30 const SkColor colors[], |
| 31 const SkScalar pos[], |
| 32 int color_count, |
| 33 SkShader::TileMode mode, |
| 34 uint32_t flags, |
| 35 const SkMatrix* local_matrix) |
| 36 : PaintShader(SkGradientShader::MakeRadial(center, |
| 37 radius, |
| 38 colors, |
| 39 pos, |
| 40 color_count, |
| 41 mode, |
| 42 flags, |
| 43 local_matrix)) {} |
| 44 PaintShader::PaintShader(const SkPoint& start, |
| 45 SkScalar start_radius, |
| 46 const SkPoint& end, |
| 47 SkScalar end_radius, |
| 48 const SkColor colors[], |
| 49 const SkScalar pos[], |
| 50 int color_count, |
| 51 SkShader::TileMode mode, |
| 52 uint32_t flags, |
| 53 const SkMatrix* local_matrix) |
| 54 : PaintShader(SkGradientShader::MakeTwoPointConical(start, |
| 55 start_radius, |
| 56 end, |
| 57 end_radius, |
| 58 colors, |
| 59 pos, |
| 60 color_count, |
| 61 mode, |
| 62 flags, |
| 63 local_matrix)) {} |
| 64 PaintShader::PaintShader(SkScalar cx, |
| 65 SkScalar cy, |
| 66 const SkColor colors[], |
| 67 const SkScalar pos[], |
| 68 int color_count, |
| 69 uint32_t flags, |
| 70 const SkMatrix* local_matrix) |
| 71 : PaintShader(SkGradientShader::MakeSweep(cx, |
| 72 cy, |
| 73 colors, |
| 74 pos, |
| 75 color_count, |
| 76 flags, |
| 77 local_matrix)) {} |
| 78 PaintShader::PaintShader(sk_sp<const SkImage> image, |
| 79 SkShader::TileMode tx, |
| 80 SkShader::TileMode ty, |
| 81 const SkMatrix* local_matrix) |
| 82 : PaintShader(image->makeShader(tx, ty, local_matrix)) {} |
| 83 PaintShader::PaintShader(sk_sp<PaintRecord> record, |
| 84 SkShader::TileMode tx, |
| 85 SkShader::TileMode ty, |
| 86 const SkMatrix* local_matrix, |
| 87 const SkRect* tile) |
| 88 : PaintShader(SkShader::MakePictureShader(ToSkPicture(std::move(record)), |
| 89 tx, |
| 90 ty, |
| 91 local_matrix, |
| 92 tile)) {} |
| 93 PaintShader::PaintShader(sk_sp<SkShader> shader) |
| 94 : sk_shader_(std::move(shader)) {} |
| 95 PaintShader::PaintShader(const PaintShader& other) = default; |
| 96 PaintShader::PaintShader(PaintShader&& other) = default; |
| 97 PaintShader::~PaintShader() = default; |
| 98 |
| 99 } // namespace cc |
OLD | NEW |