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

Side by Side Diff: third_party/WebKit/Source/platform/graphics/GraphicsLayer.cpp

Issue 2835373003: Plumb PaintImage to the PictureImageLayer. (Closed)
Patch Set: 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2009 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 1033 matching lines...) Expand 10 before | Expand all | Expand 10 after
1044 if (rect == contents_rect_) 1044 if (rect == contents_rect_)
1045 return; 1045 return;
1046 1046
1047 contents_rect_ = rect; 1047 contents_rect_ = rect;
1048 UpdateContentsRect(); 1048 UpdateContentsRect();
1049 } 1049 }
1050 1050
1051 void GraphicsLayer::SetContentsToImage( 1051 void GraphicsLayer::SetContentsToImage(
1052 Image* image, 1052 Image* image,
1053 RespectImageOrientationEnum respect_image_orientation) { 1053 RespectImageOrientationEnum respect_image_orientation) {
1054 sk_sp<SkImage> sk_image = image ? image->ImageForCurrentFrame() : nullptr; 1054 sk_sp<SkImage> sk_image;
1055 PaintImage::AnimationType animation_type;
1056 PaintImage::CompletionState completion_state;
1057 if (image) {
1058 sk_image = image->ImageForCurrentFrame();
Khushal 2017/04/26 03:06:42 May be a PaintImageForCurrentFrame on blink::Image
1059 animation_type = image->MaybeAnimated()
1060 ? PaintImage::AnimationType::ANIMATED
1061 : PaintImage::AnimationType::STATIC;
1062 completion_state = image->CurrentFrameIsComplete()
1063 ? PaintImage::CompletionState::DONE
1064 : PaintImage::CompletionState::PARTIALLY_DONE;
1065 }
1055 1066
1056 if (image && sk_image && image->IsBitmapImage()) { 1067 if (image && sk_image && image->IsBitmapImage()) {
1057 if (respect_image_orientation == kRespectImageOrientation) { 1068 if (respect_image_orientation == kRespectImageOrientation) {
1058 ImageOrientation image_orientation = 1069 ImageOrientation image_orientation =
1059 ToBitmapImage(image)->CurrentFrameOrientation(); 1070 ToBitmapImage(image)->CurrentFrameOrientation();
1060 sk_image = DragImage::ResizeAndOrientImage(std::move(sk_image), 1071 sk_image = DragImage::ResizeAndOrientImage(std::move(sk_image),
1061 image_orientation); 1072 image_orientation);
1062 } 1073 }
1063 } 1074 }
1064 1075
1065 if (image && sk_image) { 1076 if (image && sk_image) {
1066 if (!image_layer_) { 1077 if (!image_layer_) {
1067 image_layer_ = 1078 image_layer_ =
1068 Platform::Current()->CompositorSupport()->CreateImageLayer(); 1079 Platform::Current()->CompositorSupport()->CreateImageLayer();
1069 RegisterContentsLayer(image_layer_->Layer()); 1080 RegisterContentsLayer(image_layer_->Layer());
1070 } 1081 }
1071 image_layer_->SetImage(sk_image.get()); 1082 image_layer_->SetImage(
1083 PaintImage(std::move(sk_image), animation_type, completion_state));
1072 image_layer_->Layer()->SetOpaque(image->CurrentFrameKnownToBeOpaque()); 1084 image_layer_->Layer()->SetOpaque(image->CurrentFrameKnownToBeOpaque());
1073 UpdateContentsRect(); 1085 UpdateContentsRect();
1074 } else { 1086 } else {
1075 if (image_layer_) { 1087 if (image_layer_) {
1076 UnregisterContentsLayer(image_layer_->Layer()); 1088 UnregisterContentsLayer(image_layer_->Layer());
1077 image_layer_.reset(); 1089 image_layer_.reset();
1078 } 1090 }
1079 } 1091 }
1080 1092
1081 SetContentsTo(image_layer_ ? image_layer_->Layer() : 0); 1093 SetContentsTo(image_layer_ ? image_layer_->Layer() : 0);
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
1293 void showGraphicsLayerTree(const blink::GraphicsLayer* layer) { 1305 void showGraphicsLayerTree(const blink::GraphicsLayer* layer) {
1294 if (!layer) { 1306 if (!layer) {
1295 LOG(INFO) << "Cannot showGraphicsLayerTree for (nil)."; 1307 LOG(INFO) << "Cannot showGraphicsLayerTree for (nil).";
1296 return; 1308 return;
1297 } 1309 }
1298 1310
1299 String output = layer->LayerTreeAsText(blink::kLayerTreeIncludesDebugInfo); 1311 String output = layer->LayerTreeAsText(blink::kLayerTreeIncludesDebugInfo);
1300 LOG(INFO) << output.Utf8().data(); 1312 LOG(INFO) << output.Utf8().data();
1301 } 1313 }
1302 #endif 1314 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698