| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 PP_Bool is_always_opaque) { | 167 PP_Bool is_always_opaque) { |
| 168 scoped_refptr<PPB_Graphics2D_Impl> graphics_2d( | 168 scoped_refptr<PPB_Graphics2D_Impl> graphics_2d( |
| 169 new PPB_Graphics2D_Impl(instance)); | 169 new PPB_Graphics2D_Impl(instance)); |
| 170 if (!graphics_2d->Init(size.width, size.height, | 170 if (!graphics_2d->Init(size.width, size.height, |
| 171 PPBoolToBool(is_always_opaque))) { | 171 PPBoolToBool(is_always_opaque))) { |
| 172 return 0; | 172 return 0; |
| 173 } | 173 } |
| 174 return graphics_2d->GetReference(); | 174 return graphics_2d->GetReference(); |
| 175 } | 175 } |
| 176 | 176 |
| 177 // static | |
| 178 const PPB_Graphics2D* PPB_Graphics2D_Impl::GetInterface() { | |
| 179 return ::ppapi::thunk::GetPPB_Graphics2D_Thunk(); | |
| 180 } | |
| 181 | |
| 182 bool PPB_Graphics2D_Impl::Init(int width, int height, bool is_always_opaque) { | 177 bool PPB_Graphics2D_Impl::Init(int width, int height, bool is_always_opaque) { |
| 183 // The underlying PPB_ImageData_Impl will validate the dimensions. | 178 // The underlying PPB_ImageData_Impl will validate the dimensions. |
| 184 image_data_ = new PPB_ImageData_Impl(instance()); | 179 image_data_ = new PPB_ImageData_Impl(instance()); |
| 185 if (!image_data_->Init(PPB_ImageData_Impl::GetNativeImageDataFormat(), | 180 if (!image_data_->Init(PPB_ImageData_Impl::GetNativeImageDataFormat(), |
| 186 width, height, true) || | 181 width, height, true) || |
| 187 !image_data_->Map()) { | 182 !image_data_->Map()) { |
| 188 image_data_ = NULL; | 183 image_data_ = NULL; |
| 189 return false; | 184 return false; |
| 190 } | 185 } |
| 191 is_always_opaque_ = is_always_opaque; | 186 is_always_opaque_ = is_always_opaque; |
| (...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 642 } | 637 } |
| 643 | 638 |
| 644 bool PPB_Graphics2D_Impl::HasPendingFlush() const { | 639 bool PPB_Graphics2D_Impl::HasPendingFlush() const { |
| 645 return !unpainted_flush_callback_.is_null() || | 640 return !unpainted_flush_callback_.is_null() || |
| 646 !painted_flush_callback_.is_null() || | 641 !painted_flush_callback_.is_null() || |
| 647 offscreen_flush_pending_; | 642 offscreen_flush_pending_; |
| 648 } | 643 } |
| 649 | 644 |
| 650 } // namespace ppapi | 645 } // namespace ppapi |
| 651 } // namespace webkit | 646 } // namespace webkit |
| OLD | NEW |