Chromium Code Reviews| 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 "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/memory/shared_memory.h" | 8 #include "base/memory/shared_memory.h" |
| 9 #include "cc/layers/layer.h" | 9 #include "cc/layers/layer.h" |
| 10 #include "cc/layers/solid_color_layer.h" | 10 #include "cc/layers/solid_color_layer.h" |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 251 static_cast<cc::TextureLayer*>(layer.get())); | 251 static_cast<cc::TextureLayer*>(layer.get())); |
| 252 if (!old_layer || | 252 if (!old_layer || |
| 253 new_layer->common.resource_id != old_layer->common.resource_id) { | 253 new_layer->common.resource_id != old_layer->common.resource_id) { |
| 254 cc::TextureMailbox mailbox(new_layer->texture->mailbox, | 254 cc::TextureMailbox mailbox(new_layer->texture->mailbox, |
| 255 new_layer->texture->target, | 255 new_layer->texture->target, |
| 256 new_layer->texture->sync_point); | 256 new_layer->texture->sync_point); |
| 257 texture_layer->SetTextureMailbox(mailbox, | 257 texture_layer->SetTextureMailbox(mailbox, |
| 258 cc::SingleReleaseCallback::Create( | 258 cc::SingleReleaseCallback::Create( |
| 259 base::Bind(&PepperCompositorHost::ResourceReleased, | 259 base::Bind(&PepperCompositorHost::ResourceReleased, |
| 260 weak_factory_.GetWeakPtr(), | 260 weak_factory_.GetWeakPtr(), |
| 261 new_layer->common.resource_id)));; | 261 new_layer->common.resource_id))); |
| 262 texture_layer->SetNeedsDisplay(); | |
|
danakj
2014/09/25 20:25:20
Can you add a TODO that you should get a damage re
Peng
2014/09/25 20:37:52
Done.
| |
| 262 } | 263 } |
| 263 texture_layer->SetPremultipliedAlpha(new_layer->texture->premult_alpha); | 264 texture_layer->SetPremultipliedAlpha(new_layer->texture->premult_alpha); |
| 264 gfx::RectF rect = PP_ToGfxRectF(new_layer->texture->source_rect); | 265 gfx::RectF rect = PP_ToGfxRectF(new_layer->texture->source_rect); |
| 265 texture_layer->SetUV(rect.origin(), rect.bottom_right()); | 266 texture_layer->SetUV(rect.origin(), rect.bottom_right()); |
| 266 return; | 267 return; |
| 267 } | 268 } |
| 268 | 269 |
| 269 if (new_layer->image) { | 270 if (new_layer->image) { |
| 270 if (!old_layer || | 271 if (!old_layer || |
| 271 new_layer->common.resource_id != old_layer->common.resource_id) { | 272 new_layer->common.resource_id != old_layer->common.resource_id) { |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 283 DCHECK_EQ(desc.format, PP_IMAGEDATAFORMAT_RGBA_PREMUL); | 284 DCHECK_EQ(desc.format, PP_IMAGEDATAFORMAT_RGBA_PREMUL); |
| 284 | 285 |
| 285 cc::TextureMailbox mailbox(image_shm.get(), | 286 cc::TextureMailbox mailbox(image_shm.get(), |
| 286 PP_ToGfxSize(desc.size)); | 287 PP_ToGfxSize(desc.size)); |
| 287 image_layer->SetTextureMailbox(mailbox, | 288 image_layer->SetTextureMailbox(mailbox, |
| 288 cc::SingleReleaseCallback::Create( | 289 cc::SingleReleaseCallback::Create( |
| 289 base::Bind(&PepperCompositorHost::ImageReleased, | 290 base::Bind(&PepperCompositorHost::ImageReleased, |
| 290 weak_factory_.GetWeakPtr(), | 291 weak_factory_.GetWeakPtr(), |
| 291 new_layer->common.resource_id, | 292 new_layer->common.resource_id, |
| 292 base::Passed(&image_shm)))); | 293 base::Passed(&image_shm)))); |
| 294 image_layer->SetNeedsDisplay(); | |
|
danakj
2014/09/25 20:25:20
Can you add a TODO that you should get a damage re
Peng
2014/09/25 20:37:52
Done.
| |
| 293 | 295 |
| 294 // ImageData is always premultiplied alpha. | 296 // ImageData is always premultiplied alpha. |
| 295 image_layer->SetPremultipliedAlpha(true); | 297 image_layer->SetPremultipliedAlpha(true); |
| 296 } | 298 } |
| 297 return; | 299 return; |
| 298 } | 300 } |
| 299 // Should not be reached. | 301 // Should not be reached. |
| 300 NOTREACHED(); | 302 NOTREACHED(); |
| 301 } | 303 } |
| 302 | 304 |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 376 | 378 |
| 377 // If the host is not bound to the instance, return PP_OK immediately. | 379 // If the host is not bound to the instance, return PP_OK immediately. |
| 378 if (!bound_instance_) | 380 if (!bound_instance_) |
| 379 return PP_OK; | 381 return PP_OK; |
| 380 | 382 |
| 381 commit_layers_reply_context_ = context->MakeReplyMessageContext(); | 383 commit_layers_reply_context_ = context->MakeReplyMessageContext(); |
| 382 return PP_OK_COMPLETIONPENDING; | 384 return PP_OK_COMPLETIONPENDING; |
| 383 } | 385 } |
| 384 | 386 |
| 385 } // namespace content | 387 } // namespace content |
| OLD | NEW |