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

Unified Diff: third_party/WebKit/Source/platform/graphics/ImagePattern.cpp

Issue 2893083002: cc: Move SkShader construction to a single spot in PaintShader (Closed)
Patch Set: update 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
Index: third_party/WebKit/Source/platform/graphics/ImagePattern.cpp
diff --git a/third_party/WebKit/Source/platform/graphics/ImagePattern.cpp b/third_party/WebKit/Source/platform/graphics/ImagePattern.cpp
index b913790757bca9c8ffa42f44d0f09f4ad9aca498..dbf9de5067e462548a1189ec1b2972fa824ccc4c 100644
--- a/third_party/WebKit/Source/platform/graphics/ImagePattern.cpp
+++ b/third_party/WebKit/Source/platform/graphics/ImagePattern.cpp
@@ -29,14 +29,16 @@ bool ImagePattern::IsLocalMatrixChanged(const SkMatrix& local_matrix) const {
return local_matrix != previous_local_matrix_;
}
-sk_sp<PaintShader> ImagePattern::CreateShader(const SkMatrix& local_matrix) {
- if (!tile_image_)
- return WrapSkShader(SkShader::MakeColorShader(SK_ColorTRANSPARENT));
+std::unique_ptr<PaintShader> ImagePattern::CreateShader(
+ const SkMatrix& local_matrix) {
+ if (!tile_image_) {
+ return PaintShader::MakeColor(SK_ColorTRANSPARENT);
+ }
if (IsRepeatXY()) {
// Fast path: for repeatXY we just return a shader from the original image.
- return MakePaintShaderImage(tile_image_, SkShader::kRepeat_TileMode,
- SkShader::kRepeat_TileMode, &local_matrix);
+ return PaintShader::MakeImage(tile_image_, SkShader::kRepeat_TileMode,
+ SkShader::kRepeat_TileMode, &local_matrix);
}
// Skia does not have a "draw the tile only once" option. Clamp_TileMode
@@ -73,8 +75,8 @@ sk_sp<PaintShader> ImagePattern::CreateShader(const SkMatrix& local_matrix) {
SkMatrix adjusted_matrix(local_matrix);
adjusted_matrix.postTranslate(-border_pixel_x, -border_pixel_y);
- return MakePaintShaderImage(std::move(tile_image), tile_mode_x, tile_mode_y,
- &adjusted_matrix);
+ return PaintShader::MakeImage(std::move(tile_image), tile_mode_x, tile_mode_y,
+ &adjusted_matrix);
}
bool ImagePattern::IsTextureBacked() const {

Powered by Google App Engine
This is Rietveld 408576698