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 <stddef.h> | 7 #include <stddef.h> |
8 #include <limits> | 8 #include <limits> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 gfx::SizeF size(PP_ToGfxSize(new_layer->common.size)); | 226 gfx::SizeF size(PP_ToGfxSize(new_layer->common.size)); |
227 gfx::RectF clip_rect(PP_ToGfxRect(new_layer->common.clip_rect)); | 227 gfx::RectF clip_rect(PP_ToGfxRect(new_layer->common.clip_rect)); |
228 | 228 |
229 // Pepper API uses DIP, so we must scale the layer's coordinates to | 229 // Pepper API uses DIP, so we must scale the layer's coordinates to |
230 // viewport in use-zoom-for-dsf. | 230 // viewport in use-zoom-for-dsf. |
231 float dip_to_viewport_scale = 1 / viewport_to_dip_scale_; | 231 float dip_to_viewport_scale = 1 / viewport_to_dip_scale_; |
232 size.Scale(dip_to_viewport_scale); | 232 size.Scale(dip_to_viewport_scale); |
233 clip_rect.Scale(dip_to_viewport_scale); | 233 clip_rect.Scale(dip_to_viewport_scale); |
234 | 234 |
235 layer->SetIsDrawable(true); | 235 layer->SetIsDrawable(true); |
236 layer->SetBlendMode(SkXfermode::kSrcOver_Mode); | 236 layer->SetBlendMode(SkBlendMode::kSrcOver); |
237 layer->SetOpacity(new_layer->common.opacity); | 237 layer->SetOpacity(new_layer->common.opacity); |
238 | 238 |
239 layer->SetBounds(gfx::ToRoundedSize(size)); | 239 layer->SetBounds(gfx::ToRoundedSize(size)); |
240 layer->SetTransformOrigin( | 240 layer->SetTransformOrigin( |
241 gfx::Point3F(size.width() / 2, size.height() / 2, 0.0f)); | 241 gfx::Point3F(size.width() / 2, size.height() / 2, 0.0f)); |
242 gfx::Transform transform(gfx::Transform::kSkipInitialization); | 242 gfx::Transform transform(gfx::Transform::kSkipInitialization); |
243 transform.matrix().setColMajorf(new_layer->common.transform.matrix); | 243 transform.matrix().setColMajorf(new_layer->common.transform.matrix); |
244 layer->SetTransform(transform); | 244 layer->SetTransform(transform); |
245 | 245 |
246 // Consider a (0,0,0,0) rect as no clip rect. | 246 // Consider a (0,0,0,0) rect as no clip rect. |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
415 | 415 |
416 // If the host is not bound to the instance, return PP_OK immediately. | 416 // If the host is not bound to the instance, return PP_OK immediately. |
417 if (!bound_instance_) | 417 if (!bound_instance_) |
418 return PP_OK; | 418 return PP_OK; |
419 | 419 |
420 commit_layers_reply_context_ = context->MakeReplyMessageContext(); | 420 commit_layers_reply_context_ = context->MakeReplyMessageContext(); |
421 return PP_OK_COMPLETIONPENDING; | 421 return PP_OK_COMPLETIONPENDING; |
422 } | 422 } |
423 | 423 |
424 } // namespace content | 424 } // namespace content |
OLD | NEW |