Commit 472a35ff authored by Fredrik Söderquist's avatar Fredrik Söderquist Committed by Commit Bot

Remove Pattern-wrapper in GeneratedImage::DrawPattern

Don't create a Pattern just to have it create a PaintShader - just
create the PaintShader directly.

Change-Id: I85b96ed9becea31e93d62191baac263f08f53f91
Reviewed-on: https://chromium-review.googlesource.com/c/1352258
Commit-Queue: Fredrik Söderquist <fs@opera.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: default avatarFlorin Malita <fmalita@chromium.org>
Cr-Commit-Position: refs/heads/master@{#611258}
parent d5299a49
......@@ -33,8 +33,8 @@
#include "third_party/blink/renderer/platform/geometry/float_rect.h"
#include "third_party/blink/renderer/platform/graphics/graphics_context.h"
#include "third_party/blink/renderer/platform/graphics/paint/paint_controller.h"
#include "third_party/blink/renderer/platform/graphics/paint/paint_image.h"
#include "third_party/blink/renderer/platform/graphics/paint/paint_record.h"
#include "third_party/skia/include/core/SkImage.h"
namespace blink {
......@@ -46,7 +46,7 @@ void GeneratedImage::DrawPattern(GraphicsContext& dest_context,
const FloatRect& dest_rect,
const FloatSize& repeat_spacing) {
FloatRect tile_rect = src_rect;
tile_rect.Expand(FloatSize(repeat_spacing));
tile_rect.Expand(repeat_spacing);
std::unique_ptr<PaintController> paint_controller = PaintController::Create();
GraphicsContext context(*paint_controller);
......@@ -58,11 +58,12 @@ void GeneratedImage::DrawPattern(GraphicsContext& dest_context,
pattern_matrix.preScale(scale.Width(), scale.Height());
pattern_matrix.preTranslate(tile_rect.X(), tile_rect.Y());
scoped_refptr<Pattern> pattern =
Pattern::CreatePaintRecordPattern(std::move(record), tile_rect);
sk_sp<PaintShader> tile_shader = PaintShader::MakePaintRecord(
std::move(record), tile_rect, SkShader::kRepeat_TileMode,
SkShader::kRepeat_TileMode, &pattern_matrix);
PaintFlags fill_flags = dest_context.FillFlags();
pattern->ApplyToFlags(fill_flags, pattern_matrix);
fill_flags.setShader(std::move(tile_shader));
fill_flags.setColor(SK_ColorBLACK);
fill_flags.setBlendMode(composite_op);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment