| OLD | NEW |
| 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" |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 crashed_layer->SetMasksToBounds(true); | 185 crashed_layer->SetMasksToBounds(true); |
| 186 crashed_layer->SetBackgroundColor(SK_ColorBLACK); | 186 crashed_layer->SetBackgroundColor(SK_ColorBLACK); |
| 187 | 187 |
| 188 if (web_layer_) { | 188 if (web_layer_) { |
| 189 SkBitmap* sad_bitmap = | 189 SkBitmap* sad_bitmap = |
| 190 GetContentClient()->renderer()->GetSadWebViewBitmap(); | 190 GetContentClient()->renderer()->GetSadWebViewBitmap(); |
| 191 if (sad_bitmap && web_layer_->Bounds().width > sad_bitmap->width() && | 191 if (sad_bitmap && web_layer_->Bounds().width > sad_bitmap->width() && |
| 192 web_layer_->Bounds().height > sad_bitmap->height()) { | 192 web_layer_->Bounds().height > sad_bitmap->height()) { |
| 193 scoped_refptr<cc::PictureImageLayer> sad_layer = | 193 scoped_refptr<cc::PictureImageLayer> sad_layer = |
| 194 cc::PictureImageLayer::Create(); | 194 cc::PictureImageLayer::Create(); |
| 195 sad_layer->SetImage(cc::PaintImage(cc::PaintImage::kNonLazyStableId, | 195 sad_layer->SetImage(cc::PaintImage(SkImage::MakeFromBitmap(*sad_bitmap))); |
| 196 SkImage::MakeFromBitmap(*sad_bitmap))); | |
| 197 sad_layer->SetBounds( | 196 sad_layer->SetBounds( |
| 198 gfx::Size(sad_bitmap->width(), sad_bitmap->height())); | 197 gfx::Size(sad_bitmap->width(), sad_bitmap->height())); |
| 199 sad_layer->SetPosition(gfx::PointF( | 198 sad_layer->SetPosition(gfx::PointF( |
| 200 (web_layer_->Bounds().width - sad_bitmap->width()) / 2, | 199 (web_layer_->Bounds().width - sad_bitmap->width()) / 2, |
| 201 (web_layer_->Bounds().height - sad_bitmap->height()) / 2)); | 200 (web_layer_->Bounds().height - sad_bitmap->height()) / 2)); |
| 202 sad_layer->SetIsDrawable(true); | 201 sad_layer->SetIsDrawable(true); |
| 203 | 202 |
| 204 crashed_layer->AddChild(sad_layer); | 203 crashed_layer->AddChild(sad_layer); |
| 205 } | 204 } |
| 206 } | 205 } |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 surface_info.size_in_pixels(), surface_info.device_scale_factor(), | 250 surface_info.size_in_pixels(), surface_info.device_scale_factor(), |
| 252 static_cast<cc_blink::WebLayerImpl*>(web_layer_.get())->layer()); | 251 static_cast<cc_blink::WebLayerImpl*>(web_layer_.get())->layer()); |
| 253 } | 252 } |
| 254 | 253 |
| 255 void ChildFrameCompositingHelper::UpdateVisibility(bool visible) { | 254 void ChildFrameCompositingHelper::UpdateVisibility(bool visible) { |
| 256 if (web_layer_) | 255 if (web_layer_) |
| 257 web_layer_->SetDrawsContent(visible); | 256 web_layer_->SetDrawsContent(visible); |
| 258 } | 257 } |
| 259 | 258 |
| 260 } // namespace content | 259 } // namespace content |
| OLD | NEW |