| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CC_PAINT_PAINT_SHADER_H_ | 5 #ifndef CC_PAINT_PAINT_SHADER_H_ |
| 6 #define CC_PAINT_PAINT_SHADER_H_ | 6 #define CC_PAINT_PAINT_SHADER_H_ |
| 7 | 7 |
| 8 #include "cc/paint/paint_record.h" | 8 #include "cc/paint/paint_record.h" |
| 9 #include "third_party/skia/include/core/SkImage.h" | 9 #include "third_party/skia/include/core/SkImage.h" |
| 10 #include "third_party/skia/include/core/SkShader.h" | 10 #include "third_party/skia/include/core/SkShader.h" |
| 11 | 11 |
| 12 namespace cc { | 12 namespace cc { |
| 13 using PaintShader = SkShader; | 13 using PaintShader = SkShader; |
| 14 | 14 |
| 15 inline sk_sp<PaintShader> WrapSkShader(sk_sp<SkShader> shader) { | 15 inline sk_sp<PaintShader> WrapSkShader(sk_sp<SkShader> shader) { |
| 16 return shader; | 16 return shader; |
| 17 } | 17 } |
| 18 | 18 |
| 19 inline sk_sp<PaintShader> MakePaintShaderImage(const SkImage* image, | 19 inline sk_sp<PaintShader> MakePaintShaderImage(sk_sp<const SkImage> image, |
| 20 SkShader::TileMode tx, | 20 SkShader::TileMode tx, |
| 21 SkShader::TileMode ty, | 21 SkShader::TileMode ty, |
| 22 const SkMatrix* local_matrix) { | 22 const SkMatrix* local_matrix) { |
| 23 return image->makeShader(tx, ty, local_matrix); | |
| 24 } | |
| 25 | |
| 26 inline sk_sp<PaintShader> MakePaintShaderImage(const sk_sp<SkImage> image, | |
| 27 SkShader::TileMode tx, | |
| 28 SkShader::TileMode ty, | |
| 29 const SkMatrix* local_matrix) { | |
| 30 return image->makeShader(tx, ty, local_matrix); | 23 return image->makeShader(tx, ty, local_matrix); |
| 31 } | 24 } |
| 32 | 25 |
| 33 inline sk_sp<PaintShader> MakePaintShaderRecord(sk_sp<PaintRecord> record, | 26 inline sk_sp<PaintShader> MakePaintShaderRecord(sk_sp<PaintRecord> record, |
| 34 SkShader::TileMode tx, | 27 SkShader::TileMode tx, |
| 35 SkShader::TileMode ty, | 28 SkShader::TileMode ty, |
| 36 const SkMatrix* local_matrix, | 29 const SkMatrix* local_matrix, |
| 37 const SkRect* tile) { | 30 const SkRect* tile) { |
| 38 return SkShader::MakePictureShader(ToSkPicture(record), tx, ty, local_matrix, | 31 return SkShader::MakePictureShader(ToSkPicture(record), tx, ty, local_matrix, |
| 39 tile); | 32 tile); |
| 40 } | 33 } |
| 41 | 34 |
| 42 } // namespace cc | 35 } // namespace cc |
| 43 | 36 |
| 44 #endif // CC_PAINT_PAINT_SHADER_H_ | 37 #endif // CC_PAINT_PAINT_SHADER_H_ |
| OLD | NEW |