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

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

Issue 2812763002: paint: Introduce PaintImage that wraps SkImage in paint calls. (Closed)
Patch Set: update Created 3 years, 8 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 57f94fa06d8753ed701353fa05becf47833aa9ae..77d2ee4c940bd46697942bf0fb1de37767297d88 100644
--- a/third_party/WebKit/Source/platform/graphics/Image.cpp
+++ b/third_party/WebKit/Source/platform/graphics/Image.cpp
@@ -35,6 +35,7 @@
#include "platform/graphics/BitmapImage.h"
#include "platform/graphics/DeferredImageDecoder.h"
#include "platform/graphics/GraphicsContext.h"
+#include "platform/graphics/paint/PaintImage.h"
#include "platform/graphics/paint/PaintRecorder.h"
#include "platform/graphics/paint/PaintShader.h"
#include "platform/instrumentation/PlatformInstrumentation.h"
@@ -229,7 +230,9 @@ sk_sp<PaintShader> CreatePatternShader(sk_sp<const SkImage> image,
const PaintFlags& paint,
const FloatSize& spacing,
SkShader::TileMode tmx,
- SkShader::TileMode tmy) {
+ SkShader::TileMode tmy,
+ bool animated,
+ bool complete) {
if (spacing.IsZero())
return MakePaintShaderImage(image, tmx, tmy, &shader_matrix);
@@ -240,7 +243,14 @@ sk_sp<PaintShader> CreatePatternShader(sk_sp<const SkImage> image,
PaintRecorder recorder;
PaintCanvas* canvas = recorder.beginRecording(tile_rect);
- canvas->drawImage(image, 0, 0, &paint);
+ auto animation_type = animated ? PaintImage::AnimationType::ANIMATED
+ : PaintImage::AnimationType::STATIC;
+ auto completion_state = complete
+ ? PaintImage::CompletionState::DONE
+ : PaintImage::CompletionState::PARTIALLY_DONE;
+ canvas->drawImage(
+ PaintImage(std::move(image), animation_type, completion_state), 0, 0,
pdr. 2017/04/12 17:37:05 It looks like PaintImage is used as a single-frame
vmpstr 2017/04/12 18:58:44 Yeah, that's the plan. I'm just trying to stage th
+ &paint);
return MakePaintShaderRecord(recorder.finishRecordingAsPicture(), tmx, tmy,
&shader_matrix, nullptr);
@@ -315,7 +325,7 @@ void Image::DrawPattern(GraphicsContext& context,
CreatePatternShader(std::move(image), local_matrix, flags,
FloatSize(repeat_spacing.Width() / scale.Width(),
repeat_spacing.Height() / scale.Height()),
- tmx, tmy));
+ tmx, tmy, MaybeAnimated(), CurrentFrameIsComplete()));
// 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.

Powered by Google App Engine
This is Rietveld 408576698