| Index: cc/paint/paint_shader.h
|
| diff --git a/cc/paint/paint_shader.h b/cc/paint/paint_shader.h
|
| index 6afdaa650de9f4b8d242364919350b1d9c24498e..22588cae6b8276193583a46e5b182886757d539e 100644
|
| --- a/cc/paint/paint_shader.h
|
| +++ b/cc/paint/paint_shader.h
|
| @@ -5,32 +5,82 @@
|
| #ifndef CC_PAINT_PAINT_SHADER_H_
|
| #define CC_PAINT_PAINT_SHADER_H_
|
|
|
| -#include "cc/paint/paint_record.h"
|
| +#include "cc/paint/paint_export.h"
|
| #include "third_party/skia/include/core/SkImage.h"
|
| +#include "third_party/skia/include/core/SkScalar.h"
|
| #include "third_party/skia/include/core/SkShader.h"
|
|
|
| namespace cc {
|
| -using PaintShader = SkShader;
|
| -
|
| -inline sk_sp<PaintShader> WrapSkShader(sk_sp<SkShader> shader) {
|
| - return shader;
|
| -}
|
| -
|
| -inline sk_sp<PaintShader> MakePaintShaderImage(sk_sp<const SkImage> image,
|
| - SkShader::TileMode tx,
|
| - SkShader::TileMode ty,
|
| - const SkMatrix* local_matrix) {
|
| - return image->makeShader(tx, ty, local_matrix);
|
| -}
|
| -
|
| -inline sk_sp<PaintShader> MakePaintShaderRecord(sk_sp<PaintRecord> record,
|
| - SkShader::TileMode tx,
|
| - SkShader::TileMode ty,
|
| - const SkMatrix* local_matrix,
|
| - const SkRect* tile) {
|
| - return SkShader::MakePictureShader(ToSkPicture(record), tx, ty, local_matrix,
|
| - tile);
|
| -}
|
| +
|
| +class PaintOpBuffer;
|
| +using PaintRecord = PaintOpBuffer;
|
| +
|
| +class CC_PAINT_EXPORT PaintShader {
|
| + public:
|
| + // Creates a color shader. See SkShader::MakeColorShader.
|
| + explicit PaintShader(SkColor color);
|
| + // Creates a linear gradient shader. See SkGradientShader::MakeLinear.
|
| + PaintShader(const SkPoint points[],
|
| + const SkColor colors[],
|
| + const SkScalar pos[],
|
| + int count,
|
| + SkShader::TileMode mode,
|
| + uint32_t flags = 0,
|
| + const SkMatrix* local_matrix = nullptr);
|
| + // Creates a radial gradient shader. See SkGradientShader::MakeRadial
|
| + PaintShader(const SkPoint& center,
|
| + SkScalar radius,
|
| + const SkColor colors[],
|
| + const SkScalar pos[],
|
| + int color_count,
|
| + SkShader::TileMode mode,
|
| + uint32_t flags = 0,
|
| + const SkMatrix* local_matrix = nullptr);
|
| + // Creates a two point conical gradient shader. See
|
| + // SkGradientShader::MakeTwoPointConical.
|
| + PaintShader(const SkPoint& start,
|
| + SkScalar start_radius,
|
| + const SkPoint& end,
|
| + SkScalar end_radius,
|
| + const SkColor colors[],
|
| + const SkScalar pos[],
|
| + int color_count,
|
| + SkShader::TileMode mode,
|
| + uint32_t flags,
|
| + const SkMatrix* local_matrix);
|
| + // Creates a sweep gradient shader. See SkGradientShader::MakeSweep.
|
| + PaintShader(SkScalar cx,
|
| + SkScalar cy,
|
| + const SkColor colors[],
|
| + const SkScalar pos[],
|
| + int color_count,
|
| + uint32_t flags,
|
| + const SkMatrix* local_matrix);
|
| + // Creates an image shader. See SkImage::makeShader.
|
| + PaintShader(sk_sp<const SkImage> image,
|
| + SkShader::TileMode tx,
|
| + SkShader::TileMode ty,
|
| + const SkMatrix* local_matrix);
|
| + // Creates a picture shader. See SkShader::MakePictureShader.
|
| + PaintShader(sk_sp<PaintRecord> record,
|
| + SkShader::TileMode tx,
|
| + SkShader::TileMode ty,
|
| + const SkMatrix* local_matrix,
|
| + const SkRect* tile);
|
| + PaintShader(const PaintShader& other);
|
| + PaintShader(PaintShader&& other);
|
| + ~PaintShader();
|
| +
|
| + // TODO(vmpstr): Can we always determine this without constructing an
|
| + // |sk_shader_|?
|
| + bool is_valid() const { return !!sk_shader_; }
|
| + const sk_sp<SkShader>& sk_shader() const { return sk_shader_; }
|
| +
|
| + private:
|
| + explicit PaintShader(sk_sp<SkShader> shader);
|
| +
|
| + sk_sp<SkShader> sk_shader_;
|
| +};
|
|
|
| } // namespace cc
|
|
|
|
|