OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/npapi/webplugin_delegate_proxy.h" | 5 #include "content/renderer/npapi/webplugin_delegate_proxy.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 | 10 |
(...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
548 | 548 |
549 #if !defined(OS_WIN) | 549 #if !defined(OS_WIN) |
550 static size_t BitmapSizeForPluginRect(const gfx::Rect& plugin_rect) { | 550 static size_t BitmapSizeForPluginRect(const gfx::Rect& plugin_rect) { |
551 const size_t stride = | 551 const size_t stride = |
552 skia::PlatformCanvasStrideForWidth(plugin_rect.width()); | 552 skia::PlatformCanvasStrideForWidth(plugin_rect.width()); |
553 return stride * plugin_rect.height(); | 553 return stride * plugin_rect.height(); |
554 } | 554 } |
555 | 555 |
556 bool WebPluginDelegateProxy::CreateLocalBitmap( | 556 bool WebPluginDelegateProxy::CreateLocalBitmap( |
557 std::vector<uint8_t>* memory, | 557 std::vector<uint8_t>* memory, |
558 scoped_ptr<skia::PlatformCanvas>* canvas) { | 558 scoped_ptr<SkCanvas>* canvas) { |
559 const size_t size = BitmapSizeForPluginRect(plugin_rect_); | 559 const size_t size = BitmapSizeForPluginRect(plugin_rect_); |
560 memory->resize(size); | 560 memory->resize(size); |
561 if (memory->size() != size) | 561 if (memory->size() != size) |
562 return false; | 562 return false; |
563 canvas->reset(skia::CreatePlatformCanvas( | 563 canvas->reset(skia::CreatePlatformCanvas( |
564 plugin_rect_.width(), plugin_rect_.height(), true, &((*memory)[0]), | 564 plugin_rect_.width(), plugin_rect_.height(), true, &((*memory)[0]), |
565 skia::CRASH_ON_FAILURE)); | 565 skia::CRASH_ON_FAILURE)); |
566 return true; | 566 return true; |
567 } | 567 } |
568 #endif | 568 #endif |
569 | 569 |
570 bool WebPluginDelegateProxy::CreateSharedBitmap( | 570 bool WebPluginDelegateProxy::CreateSharedBitmap( |
571 scoped_ptr<SharedMemoryBitmap>* memory, | 571 scoped_ptr<SharedMemoryBitmap>* memory, |
572 scoped_ptr<skia::PlatformCanvas>* canvas) { | 572 scoped_ptr<SkCanvas>* canvas) { |
573 *memory = ChildThreadImpl::current() | 573 *memory = ChildThreadImpl::current() |
574 ->shared_bitmap_manager() | 574 ->shared_bitmap_manager() |
575 ->AllocateSharedMemoryBitmap(plugin_rect_.size()); | 575 ->AllocateSharedMemoryBitmap(plugin_rect_.size()); |
576 if (!memory->get()) | 576 if (!memory->get()) |
577 return false; | 577 return false; |
578 DCHECK((*memory)->shared_memory()); | 578 DCHECK((*memory)->shared_memory()); |
579 #if defined(OS_POSIX) | 579 #if defined(OS_POSIX) |
580 canvas->reset(skia::CreatePlatformCanvas( | 580 canvas->reset(skia::CreatePlatformCanvas( |
581 plugin_rect_.width(), plugin_rect_.height(), true, (*memory)->pixels(), | 581 plugin_rect_.width(), plugin_rect_.height(), true, (*memory)->pixels(), |
582 skia::RETURN_NULL_ON_FAILURE)); | 582 skia::RETURN_NULL_ON_FAILURE)); |
(...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1072 | 1072 |
1073 void WebPluginDelegateProxy::OnURLRedirectResponse(bool allow, | 1073 void WebPluginDelegateProxy::OnURLRedirectResponse(bool allow, |
1074 int resource_id) { | 1074 int resource_id) { |
1075 if (!plugin_) | 1075 if (!plugin_) |
1076 return; | 1076 return; |
1077 | 1077 |
1078 plugin_->URLRedirectResponse(allow, resource_id); | 1078 plugin_->URLRedirectResponse(allow, resource_id); |
1079 } | 1079 } |
1080 | 1080 |
1081 } // namespace content | 1081 } // namespace content |
OLD | NEW |