| 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/pepper/pepper_compositor_host.h" | 5 #include "content/renderer/pepper/pepper_compositor_host.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/memory/shared_memory.h" | 10 #include "base/memory/shared_memory.h" |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 new_layer->common.clip_rect.size.height != 0) { | 238 new_layer->common.clip_rect.size.height != 0) { |
| 239 scoped_refptr<cc::Layer> clip_parent = layer->parent(); | 239 scoped_refptr<cc::Layer> clip_parent = layer->parent(); |
| 240 if (clip_parent.get() == layer_.get()) { | 240 if (clip_parent.get() == layer_.get()) { |
| 241 // Create a clip parent layer, if it does not exist. | 241 // Create a clip parent layer, if it does not exist. |
| 242 clip_parent = cc::Layer::Create(cc_blink::WebLayerImpl::LayerSettings()); | 242 clip_parent = cc::Layer::Create(cc_blink::WebLayerImpl::LayerSettings()); |
| 243 clip_parent->SetMasksToBounds(true); | 243 clip_parent->SetMasksToBounds(true); |
| 244 clip_parent->SetIsDrawable(true); | 244 clip_parent->SetIsDrawable(true); |
| 245 layer_->ReplaceChild(layer.get(), clip_parent); | 245 layer_->ReplaceChild(layer.get(), clip_parent); |
| 246 clip_parent->AddChild(layer); | 246 clip_parent->AddChild(layer); |
| 247 } | 247 } |
| 248 gfx::Point position = PP_ToGfxPoint(new_layer->common.clip_rect.point); | 248 auto position = |
| 249 gfx::PointF(PP_ToGfxPoint(new_layer->common.clip_rect.point)); |
| 249 clip_parent->SetPosition(position); | 250 clip_parent->SetPosition(position); |
| 250 clip_parent->SetBounds(PP_ToGfxSize(new_layer->common.clip_rect.size)); | 251 clip_parent->SetBounds(PP_ToGfxSize(new_layer->common.clip_rect.size)); |
| 251 layer->SetPosition(gfx::Point(-position.x(), -position.y())); | 252 layer->SetPosition(gfx::PointF(-position.x(), -position.y())); |
| 252 } else if (layer->parent() != layer_.get()) { | 253 } else if (layer->parent() != layer_.get()) { |
| 253 // Remove the clip parent layer. | 254 // Remove the clip parent layer. |
| 254 layer_->ReplaceChild(layer->parent(), layer); | 255 layer_->ReplaceChild(layer->parent(), layer); |
| 255 layer->SetPosition(gfx::Point()); | 256 layer->SetPosition(gfx::PointF()); |
| 256 } | 257 } |
| 257 | 258 |
| 258 if (new_layer->color) { | 259 if (new_layer->color) { |
| 259 layer->SetBackgroundColor(SkColorSetARGBMacro( | 260 layer->SetBackgroundColor(SkColorSetARGBMacro( |
| 260 new_layer->color->alpha * 255, | 261 new_layer->color->alpha * 255, |
| 261 new_layer->color->red * 255, | 262 new_layer->color->red * 255, |
| 262 new_layer->color->green * 255, | 263 new_layer->color->green * 255, |
| 263 new_layer->color->blue * 255)); | 264 new_layer->color->blue * 255)); |
| 264 return; | 265 return; |
| 265 } | 266 } |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 405 | 406 |
| 406 // If the host is not bound to the instance, return PP_OK immediately. | 407 // If the host is not bound to the instance, return PP_OK immediately. |
| 407 if (!bound_instance_) | 408 if (!bound_instance_) |
| 408 return PP_OK; | 409 return PP_OK; |
| 409 | 410 |
| 410 commit_layers_reply_context_ = context->MakeReplyMessageContext(); | 411 commit_layers_reply_context_ = context->MakeReplyMessageContext(); |
| 411 return PP_OK_COMPLETIONPENDING; | 412 return PP_OK_COMPLETIONPENDING; |
| 412 } | 413 } |
| 413 | 414 |
| 414 } // namespace content | 415 } // namespace content |
| OLD | NEW |