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

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

Issue 2835373003: Plumb PaintImage to the PictureImageLayer. (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/GraphicsLayer.cpp
diff --git a/third_party/WebKit/Source/platform/graphics/GraphicsLayer.cpp b/third_party/WebKit/Source/platform/graphics/GraphicsLayer.cpp
index b021d596fcc0da7bce353e086280d1668ee0a0eb..b683998817426e2df60f8eccd7cb2ee8849c6265 100644
--- a/third_party/WebKit/Source/platform/graphics/GraphicsLayer.cpp
+++ b/third_party/WebKit/Source/platform/graphics/GraphicsLayer.cpp
@@ -1051,7 +1051,19 @@ void GraphicsLayer::SetContentsRect(const IntRect& rect) {
void GraphicsLayer::SetContentsToImage(
Image* image,
RespectImageOrientationEnum respect_image_orientation) {
- sk_sp<SkImage> sk_image = image ? image->ImageForCurrentFrame() : nullptr;
+ sk_sp<SkImage> sk_image;
+ PaintImage::AnimationType animation_type = PaintImage::AnimationType::UNKNOWN;
+ PaintImage::CompletionState completion_state =
+ PaintImage::CompletionState::UNKNOWN;
+ if (image) {
+ sk_image = image->ImageForCurrentFrame();
+ animation_type = image->MaybeAnimated()
+ ? PaintImage::AnimationType::ANIMATED
+ : PaintImage::AnimationType::STATIC;
+ completion_state = image->CurrentFrameIsComplete()
+ ? PaintImage::CompletionState::DONE
+ : PaintImage::CompletionState::PARTIALLY_DONE;
+ }
if (image && sk_image && image->IsBitmapImage()) {
if (respect_image_orientation == kRespectImageOrientation) {
@@ -1068,7 +1080,8 @@ void GraphicsLayer::SetContentsToImage(
Platform::Current()->CompositorSupport()->CreateImageLayer();
RegisterContentsLayer(image_layer_->Layer());
}
- image_layer_->SetImage(sk_image.get());
+ image_layer_->SetImage(
+ PaintImage(std::move(sk_image), animation_type, completion_state));
image_layer_->Layer()->SetOpaque(image->CurrentFrameKnownToBeOpaque());
UpdateContentsRect();
} else {

Powered by Google App Engine
This is Rietveld 408576698