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

Side by Side Diff: content/renderer/child_frame_compositing_helper.cc

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 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/renderer/child_frame_compositing_helper.h" 5 #include "content/renderer/child_frame_compositing_helper.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "cc/blink/web_layer_impl.h" 9 #include "cc/blink/web_layer_impl.h"
10 #include "cc/layers/picture_image_layer.h" 10 #include "cc/layers/picture_image_layer.h"
11 #include "cc/layers/solid_color_layer.h" 11 #include "cc/layers/solid_color_layer.h"
12 #include "cc/layers/surface_layer.h" 12 #include "cc/layers/surface_layer.h"
13 #include "cc/output/context_provider.h" 13 #include "cc/output/context_provider.h"
14 #include "cc/output/copy_output_request.h" 14 #include "cc/output/copy_output_request.h"
15 #include "cc/output/copy_output_result.h" 15 #include "cc/output/copy_output_result.h"
16 #include "cc/paint/paint_image.h"
16 #include "cc/resources/single_release_callback.h" 17 #include "cc/resources/single_release_callback.h"
17 #include "cc/surfaces/sequence_surface_reference_factory.h" 18 #include "cc/surfaces/sequence_surface_reference_factory.h"
18 #include "content/child/thread_safe_sender.h" 19 #include "content/child/thread_safe_sender.h"
19 #include "content/common/browser_plugin/browser_plugin_messages.h" 20 #include "content/common/browser_plugin/browser_plugin_messages.h"
20 #include "content/common/content_switches_internal.h" 21 #include "content/common/content_switches_internal.h"
21 #include "content/common/frame_messages.h" 22 #include "content/common/frame_messages.h"
22 #include "content/public/common/content_client.h" 23 #include "content/public/common/content_client.h"
23 #include "content/public/renderer/content_renderer_client.h" 24 #include "content/public/renderer/content_renderer_client.h"
24 #include "content/renderer/browser_plugin/browser_plugin.h" 25 #include "content/renderer/browser_plugin/browser_plugin.h"
25 #include "content/renderer/browser_plugin/browser_plugin_manager.h" 26 #include "content/renderer/browser_plugin/browser_plugin_manager.h"
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 crashed_layer->SetMasksToBounds(true); 185 crashed_layer->SetMasksToBounds(true);
185 crashed_layer->SetBackgroundColor(SK_ColorBLACK); 186 crashed_layer->SetBackgroundColor(SK_ColorBLACK);
186 187
187 if (web_layer_) { 188 if (web_layer_) {
188 SkBitmap* sad_bitmap = 189 SkBitmap* sad_bitmap =
189 GetContentClient()->renderer()->GetSadWebViewBitmap(); 190 GetContentClient()->renderer()->GetSadWebViewBitmap();
190 if (sad_bitmap && web_layer_->Bounds().width > sad_bitmap->width() && 191 if (sad_bitmap && web_layer_->Bounds().width > sad_bitmap->width() &&
191 web_layer_->Bounds().height > sad_bitmap->height()) { 192 web_layer_->Bounds().height > sad_bitmap->height()) {
192 scoped_refptr<cc::PictureImageLayer> sad_layer = 193 scoped_refptr<cc::PictureImageLayer> sad_layer =
193 cc::PictureImageLayer::Create(); 194 cc::PictureImageLayer::Create();
194 sad_layer->SetImage(SkImage::MakeFromBitmap(*sad_bitmap)); 195 sad_layer->SetImage(
196 cc::PaintImage(SkImage::MakeFromBitmap(*sad_bitmap),
197 cc::PaintImage::AnimationType::STATIC,
198 cc::PaintImage::CompletionState::DONE));
195 sad_layer->SetBounds( 199 sad_layer->SetBounds(
196 gfx::Size(sad_bitmap->width(), sad_bitmap->height())); 200 gfx::Size(sad_bitmap->width(), sad_bitmap->height()));
197 sad_layer->SetPosition(gfx::PointF( 201 sad_layer->SetPosition(gfx::PointF(
198 (web_layer_->Bounds().width - sad_bitmap->width()) / 2, 202 (web_layer_->Bounds().width - sad_bitmap->width()) / 2,
199 (web_layer_->Bounds().height - sad_bitmap->height()) / 2)); 203 (web_layer_->Bounds().height - sad_bitmap->height()) / 2));
200 sad_layer->SetIsDrawable(true); 204 sad_layer->SetIsDrawable(true);
201 205
202 crashed_layer->AddChild(sad_layer); 206 crashed_layer->AddChild(sad_layer);
203 } 207 }
204 } 208 }
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 surface_info.size_in_pixels(), surface_info.device_scale_factor(), 253 surface_info.size_in_pixels(), surface_info.device_scale_factor(),
250 static_cast<cc_blink::WebLayerImpl*>(web_layer_.get())->layer()); 254 static_cast<cc_blink::WebLayerImpl*>(web_layer_.get())->layer());
251 } 255 }
252 256
253 void ChildFrameCompositingHelper::UpdateVisibility(bool visible) { 257 void ChildFrameCompositingHelper::UpdateVisibility(bool visible) {
254 if (web_layer_) 258 if (web_layer_)
255 web_layer_->SetDrawsContent(visible); 259 web_layer_->SetDrawsContent(visible);
256 } 260 }
257 261
258 } // namespace content 262 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698