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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 crashed_layer->SetMasksToBounds(true); | 122 crashed_layer->SetMasksToBounds(true); |
123 crashed_layer->SetBackgroundColor(SK_ColorBLACK); | 123 crashed_layer->SetBackgroundColor(SK_ColorBLACK); |
124 | 124 |
125 if (web_layer_) { | 125 if (web_layer_) { |
126 SkBitmap* sad_bitmap = | 126 SkBitmap* sad_bitmap = |
127 GetContentClient()->renderer()->GetSadWebViewBitmap(); | 127 GetContentClient()->renderer()->GetSadWebViewBitmap(); |
128 if (sad_bitmap && web_layer_->bounds().width > sad_bitmap->width() && | 128 if (sad_bitmap && web_layer_->bounds().width > sad_bitmap->width() && |
129 web_layer_->bounds().height > sad_bitmap->height()) { | 129 web_layer_->bounds().height > sad_bitmap->height()) { |
130 scoped_refptr<cc::PictureImageLayer> sad_layer = | 130 scoped_refptr<cc::PictureImageLayer> sad_layer = |
131 cc::PictureImageLayer::Create(); | 131 cc::PictureImageLayer::Create(); |
132 skia::RefPtr<SkImage> image = | 132 sad_layer->SetImage(SkImage::MakeFromBitmap(*sad_bitmap)); |
133 skia::AdoptRef(SkImage::NewFromBitmap(*sad_bitmap)); | |
134 sad_layer->SetImage(image); | |
135 sad_layer->SetBounds( | 133 sad_layer->SetBounds( |
136 gfx::Size(sad_bitmap->width(), sad_bitmap->height())); | 134 gfx::Size(sad_bitmap->width(), sad_bitmap->height())); |
137 sad_layer->SetPosition(gfx::PointF( | 135 sad_layer->SetPosition(gfx::PointF( |
138 (web_layer_->bounds().width - sad_bitmap->width()) / 2, | 136 (web_layer_->bounds().width - sad_bitmap->width()) / 2, |
139 (web_layer_->bounds().height - sad_bitmap->height()) / 2)); | 137 (web_layer_->bounds().height - sad_bitmap->height()) / 2)); |
140 sad_layer->SetIsDrawable(true); | 138 sad_layer->SetIsDrawable(true); |
141 | 139 |
142 crashed_layer->AddChild(sad_layer); | 140 crashed_layer->AddChild(sad_layer); |
143 } | 141 } |
144 } | 142 } |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 frame_size, scale_factor, | 239 frame_size, scale_factor, |
242 static_cast<cc_blink::WebLayerImpl*>(web_layer_.get())->layer()); | 240 static_cast<cc_blink::WebLayerImpl*>(web_layer_.get())->layer()); |
243 } | 241 } |
244 | 242 |
245 void ChildFrameCompositingHelper::UpdateVisibility(bool visible) { | 243 void ChildFrameCompositingHelper::UpdateVisibility(bool visible) { |
246 if (web_layer_) | 244 if (web_layer_) |
247 web_layer_->setDrawsContent(visible); | 245 web_layer_->setDrawsContent(visible); |
248 } | 246 } |
249 | 247 |
250 } // namespace content | 248 } // namespace content |
OLD | NEW |