| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "webkit/plugins/ppapi/ppb_graphics_2d_impl.h" | 5 #include "webkit/plugins/ppapi/ppb_graphics_2d_impl.h" |
| 6 | 6 |
| 7 #include <iterator> | 7 #include <iterator> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 ConvertBetweenBGRAandRGBA( | 105 ConvertBetweenBGRAandRGBA( |
| 106 src_bitmap->getAddr32(static_cast<int>(src_rect.fLeft), | 106 src_bitmap->getAddr32(static_cast<int>(src_rect.fLeft), |
| 107 static_cast<int>(src_rect.fTop + y)), | 107 static_cast<int>(src_rect.fTop + y)), |
| 108 src_rect.width(), | 108 src_rect.width(), |
| 109 dest_bitmap->getAddr32(static_cast<int>(dest_rect.fLeft), | 109 dest_bitmap->getAddr32(static_cast<int>(dest_rect.fLeft), |
| 110 static_cast<int>(dest_rect.fTop + y))); | 110 static_cast<int>(dest_rect.fTop + y))); |
| 111 } | 111 } |
| 112 } | 112 } |
| 113 } | 113 } |
| 114 | 114 |
| 115 PP_Resource Create(PP_Module module_id, | 115 PP_Resource Create(PP_Instance instance_id, |
| 116 const PP_Size* size, | 116 const PP_Size* size, |
| 117 PP_Bool is_always_opaque) { | 117 PP_Bool is_always_opaque) { |
| 118 PluginModule* module = ResourceTracker::Get()->GetModule(module_id); | 118 PluginInstance* instance = ResourceTracker::Get()->GetInstance(instance_id); |
| 119 if (!module) | 119 if (!instance) |
| 120 return 0; | 120 return 0; |
| 121 | 121 |
| 122 scoped_refptr<PPB_Graphics2D_Impl> context(new PPB_Graphics2D_Impl(module)); | 122 scoped_refptr<PPB_Graphics2D_Impl> context(new PPB_Graphics2D_Impl( |
| 123 instance->module())); |
| 123 if (!context->Init(size->width, size->height, PPBoolToBool(is_always_opaque))) | 124 if (!context->Init(size->width, size->height, PPBoolToBool(is_always_opaque))) |
| 124 return 0; | 125 return 0; |
| 125 return context->GetReference(); | 126 return context->GetReference(); |
| 126 } | 127 } |
| 127 | 128 |
| 128 PP_Bool IsGraphics2D(PP_Resource resource) { | 129 PP_Bool IsGraphics2D(PP_Resource resource) { |
| 129 return BoolToPPBool(!!Resource::GetAs<PPB_Graphics2D_Impl>(resource)); | 130 return BoolToPPBool(!!Resource::GetAs<PPB_Graphics2D_Impl>(resource)); |
| 130 } | 131 } |
| 131 | 132 |
| 132 PP_Bool Describe(PP_Resource graphics_2d, | 133 PP_Bool Describe(PP_Resource graphics_2d, |
| (...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 644 | 645 |
| 645 bool PPB_Graphics2D_Impl::HasPendingFlush() const { | 646 bool PPB_Graphics2D_Impl::HasPendingFlush() const { |
| 646 return !unpainted_flush_callback_.is_null() || | 647 return !unpainted_flush_callback_.is_null() || |
| 647 !painted_flush_callback_.is_null() || | 648 !painted_flush_callback_.is_null() || |
| 648 offscreen_flush_pending_; | 649 offscreen_flush_pending_; |
| 649 } | 650 } |
| 650 | 651 |
| 651 } // namespace ppapi | 652 } // namespace ppapi |
| 652 } // namespace webkit | 653 } // namespace webkit |
| 653 | 654 |
| OLD | NEW |