Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5251)

Unified Diff: cc/paint/paint_shader.h

Issue 2928703005: Revert of cc: Move SkShader construction to a single spot in PaintShader (Closed)
Patch Set: Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/paint/paint_op_buffer_unittest.cc ('k') | cc/paint/paint_shader.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/paint/paint_shader.h
diff --git a/cc/paint/paint_shader.h b/cc/paint/paint_shader.h
index 6fc1a4662d1fe102aef8254273d691697d0cd12c..019174443bb1470dbd448dd40f14ca7bbbcc3e70 100644
--- a/cc/paint/paint_shader.h
+++ b/cc/paint/paint_shader.h
@@ -5,92 +5,32 @@
#ifndef CC_PAINT_PAINT_SHADER_H_
#define CC_PAINT_PAINT_SHADER_H_
-#include <memory>
-
-#include "cc/paint/paint_export.h"
+#include "cc/paint/paint_record.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;
-class PaintOpBuffer;
-using PaintRecord = PaintOpBuffer;
+inline sk_sp<PaintShader> WrapSkShader(sk_sp<SkShader> shader) {
+ return shader;
+}
-class CC_PAINT_EXPORT PaintShader {
- public:
- static std::unique_ptr<PaintShader> MakeColor(SkColor color);
+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);
+}
- static std::unique_ptr<PaintShader> MakeLinearGradient(
- const SkPoint points[],
- const SkColor colors[],
- const SkScalar pos[],
- int count,
- SkShader::TileMode mode,
- uint32_t flags = 0,
- const SkMatrix* local_matrix = nullptr,
- SkColor fallback_color = SK_ColorTRANSPARENT);
-
- static std::unique_ptr<PaintShader> MakeRadialGradient(
- 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,
- SkColor fallback_color = SK_ColorTRANSPARENT);
-
- static std::unique_ptr<PaintShader> MakeTwoPointConicalGradient(
- 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 = 0,
- const SkMatrix* local_matrix = nullptr,
- SkColor fallback_color = SK_ColorTRANSPARENT);
-
- static std::unique_ptr<PaintShader> MakeSweepGradient(
- SkScalar cx,
- SkScalar cy,
- const SkColor colors[],
- const SkScalar pos[],
- int color_count,
- uint32_t flags = 0,
- const SkMatrix* local_matrix = nullptr,
- SkColor fallback_color = SK_ColorTRANSPARENT);
-
- static std::unique_ptr<PaintShader> MakeImage(sk_sp<const SkImage> image,
+inline sk_sp<PaintShader> MakePaintShaderRecord(sk_sp<PaintRecord> record,
+ const SkRect& tile,
SkShader::TileMode tx,
SkShader::TileMode ty,
- const SkMatrix* local_matrix);
-
- static std::unique_ptr<PaintShader> MakePaintRecord(
- sk_sp<PaintRecord> record,
- const SkRect& tile,
- SkShader::TileMode tx,
- SkShader::TileMode ty,
- const SkMatrix* local_matrix);
-
- PaintShader(const PaintShader& other);
- PaintShader(PaintShader&& other);
- ~PaintShader();
-
- PaintShader& operator=(const PaintShader& other);
- PaintShader& operator=(PaintShader&& other);
-
- const sk_sp<SkShader>& sk_shader() const { return sk_shader_; }
-
- private:
- PaintShader(sk_sp<SkShader> shader, SkColor fallback_color);
-
- sk_sp<SkShader> sk_shader_;
-};
+ const SkMatrix* local_matrix) {
+ return SkShader::MakePictureShader(ToSkPicture(record, tile), tx, ty,
+ local_matrix, nullptr);
+}
} // namespace cc
« no previous file with comments | « cc/paint/paint_op_buffer_unittest.cc ('k') | cc/paint/paint_shader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698