OLD | NEW |
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 Loading... |
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 = PaintImage::AnimationType::UNKNOWN; |
| 1056 PaintImage::CompletionState completion_state = |
| 1057 PaintImage::CompletionState::UNKNOWN; |
| 1058 if (image) { |
| 1059 sk_image = image->ImageForCurrentFrame(); |
| 1060 animation_type = image->MaybeAnimated() |
| 1061 ? PaintImage::AnimationType::ANIMATED |
| 1062 : PaintImage::AnimationType::STATIC; |
| 1063 completion_state = image->CurrentFrameIsComplete() |
| 1064 ? PaintImage::CompletionState::DONE |
| 1065 : PaintImage::CompletionState::PARTIALLY_DONE; |
| 1066 } |
1055 | 1067 |
1056 if (image && sk_image && image->IsBitmapImage()) { | 1068 if (image && sk_image && image->IsBitmapImage()) { |
1057 if (respect_image_orientation == kRespectImageOrientation) { | 1069 if (respect_image_orientation == kRespectImageOrientation) { |
1058 ImageOrientation image_orientation = | 1070 ImageOrientation image_orientation = |
1059 ToBitmapImage(image)->CurrentFrameOrientation(); | 1071 ToBitmapImage(image)->CurrentFrameOrientation(); |
1060 sk_image = DragImage::ResizeAndOrientImage(std::move(sk_image), | 1072 sk_image = DragImage::ResizeAndOrientImage(std::move(sk_image), |
1061 image_orientation); | 1073 image_orientation); |
1062 } | 1074 } |
1063 } | 1075 } |
1064 | 1076 |
1065 if (image && sk_image) { | 1077 if (image && sk_image) { |
1066 if (!image_layer_) { | 1078 if (!image_layer_) { |
1067 image_layer_ = | 1079 image_layer_ = |
1068 Platform::Current()->CompositorSupport()->CreateImageLayer(); | 1080 Platform::Current()->CompositorSupport()->CreateImageLayer(); |
1069 RegisterContentsLayer(image_layer_->Layer()); | 1081 RegisterContentsLayer(image_layer_->Layer()); |
1070 } | 1082 } |
1071 image_layer_->SetImage(sk_image.get()); | 1083 image_layer_->SetImage( |
| 1084 PaintImage(std::move(sk_image), animation_type, completion_state)); |
1072 image_layer_->Layer()->SetOpaque(image->CurrentFrameKnownToBeOpaque()); | 1085 image_layer_->Layer()->SetOpaque(image->CurrentFrameKnownToBeOpaque()); |
1073 UpdateContentsRect(); | 1086 UpdateContentsRect(); |
1074 } else { | 1087 } else { |
1075 if (image_layer_) { | 1088 if (image_layer_) { |
1076 UnregisterContentsLayer(image_layer_->Layer()); | 1089 UnregisterContentsLayer(image_layer_->Layer()); |
1077 image_layer_.reset(); | 1090 image_layer_.reset(); |
1078 } | 1091 } |
1079 } | 1092 } |
1080 | 1093 |
1081 SetContentsTo(image_layer_ ? image_layer_->Layer() : 0); | 1094 SetContentsTo(image_layer_ ? image_layer_->Layer() : 0); |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1293 void showGraphicsLayerTree(const blink::GraphicsLayer* layer) { | 1306 void showGraphicsLayerTree(const blink::GraphicsLayer* layer) { |
1294 if (!layer) { | 1307 if (!layer) { |
1295 LOG(INFO) << "Cannot showGraphicsLayerTree for (nil)."; | 1308 LOG(INFO) << "Cannot showGraphicsLayerTree for (nil)."; |
1296 return; | 1309 return; |
1297 } | 1310 } |
1298 | 1311 |
1299 String output = layer->LayerTreeAsText(blink::kLayerTreeIncludesDebugInfo); | 1312 String output = layer->LayerTreeAsText(blink::kLayerTreeIncludesDebugInfo); |
1300 LOG(INFO) << output.Utf8().data(); | 1313 LOG(INFO) << output.Utf8().data(); |
1301 } | 1314 } |
1302 #endif | 1315 #endif |
OLD | NEW |