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

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

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
Index: third_party/WebKit/Source/platform/graphics/Image.cpp
diff --git a/third_party/WebKit/Source/platform/graphics/Image.cpp b/third_party/WebKit/Source/platform/graphics/Image.cpp
index d930750d1e5a688a23af043f0892e03b0f66f83d..c0fe493df46129c4a1ca11c08c0c329162c1f085 100644
--- a/third_party/WebKit/Source/platform/graphics/Image.cpp
+++ b/third_party/WebKit/Source/platform/graphics/Image.cpp
@@ -227,15 +227,14 @@
namespace {
-std::unique_ptr<PaintShader> CreatePatternShader(const PaintImage& image,
- const SkMatrix& shader_matrix,
- const PaintFlags& paint,
- const FloatSize& spacing,
- SkShader::TileMode tmx,
- SkShader::TileMode tmy) {
- if (spacing.IsZero()) {
- return PaintShader::MakeImage(image.sk_image(), tmx, tmy, &shader_matrix);
- }
+sk_sp<PaintShader> CreatePatternShader(const PaintImage& image,
+ const SkMatrix& shader_matrix,
+ const PaintFlags& paint,
+ const FloatSize& spacing,
+ SkShader::TileMode tmx,
+ SkShader::TileMode tmy) {
+ if (spacing.IsZero())
+ return MakePaintShaderImage(image.sk_image(), tmx, tmy, &shader_matrix);
// Arbitrary tiling is currently only supported for SkPictureShader, so we use
// that instead of a plain bitmap shader to implement spacing.
@@ -247,8 +246,8 @@
PaintCanvas* canvas = recorder.beginRecording(tile_rect);
canvas->drawImage(image, 0, 0, &paint);
- return PaintShader::MakePaintRecord(recorder.finishRecordingAsPicture(),
- tile_rect, tmx, tmy, &shader_matrix);
+ return MakePaintShaderRecord(recorder.finishRecordingAsPicture(), tile_rect,
+ tmx, tmy, &shader_matrix);
}
SkShader::TileMode ComputeTileMode(float left,
@@ -328,7 +327,7 @@
// If the shader could not be instantiated (e.g. non-invertible matrix),
// draw transparent.
// Note: we can't simply bail, because of arbitrary blend mode.
- if (!flags.HasShader())
+ if (!flags.getShader())
flags.setColor(SK_ColorTRANSPARENT);
context.DrawRect(dest_rect, flags);
@@ -360,10 +359,9 @@
if (!image)
return false;
- flags.setShader(
- PaintShader::MakeImage(std::move(image), SkShader::kRepeat_TileMode,
- SkShader::kRepeat_TileMode, &local_matrix));
- if (!flags.HasShader())
+ flags.setShader(image->makeShader(SkShader::kRepeat_TileMode,
+ SkShader::kRepeat_TileMode, &local_matrix));
+ if (!flags.getShader())
return false;
// Animation is normally refreshed in draw() impls, which we don't call when
« no previous file with comments | « third_party/WebKit/Source/platform/graphics/Gradient.cpp ('k') | third_party/WebKit/Source/platform/graphics/ImagePattern.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698