| 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 "ppapi/cpp/graphics_2d.h" | 5 #include "ppapi/cpp/graphics_2d.h" |
| 6 | 6 |
| 7 #include "ppapi/c/pp_errors.h" | 7 #include "ppapi/c/pp_errors.h" |
| 8 #include "ppapi/c/ppb_graphics_2d.h" | 8 #include "ppapi/c/ppb_graphics_2d.h" |
| 9 #include "ppapi/cpp/common.h" | |
| 10 #include "ppapi/cpp/completion_callback.h" | 9 #include "ppapi/cpp/completion_callback.h" |
| 11 #include "ppapi/cpp/image_data.h" | 10 #include "ppapi/cpp/image_data.h" |
| 12 #include "ppapi/cpp/instance.h" | 11 #include "ppapi/cpp/instance.h" |
| 13 #include "ppapi/cpp/module.h" | 12 #include "ppapi/cpp/module.h" |
| 14 #include "ppapi/cpp/module_impl.h" | 13 #include "ppapi/cpp/module_impl.h" |
| 15 #include "ppapi/cpp/point.h" | 14 #include "ppapi/cpp/point.h" |
| 16 #include "ppapi/cpp/rect.h" | 15 #include "ppapi/cpp/rect.h" |
| 17 | 16 |
| 18 namespace pp { | 17 namespace pp { |
| 19 | 18 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 35 | 34 |
| 36 Graphics2D::Graphics2D(Instance* instance, | 35 Graphics2D::Graphics2D(Instance* instance, |
| 37 const Size& size, | 36 const Size& size, |
| 38 bool is_always_opaque) | 37 bool is_always_opaque) |
| 39 : Resource() { | 38 : Resource() { |
| 40 if (!has_interface<PPB_Graphics2D>()) | 39 if (!has_interface<PPB_Graphics2D>()) |
| 41 return; | 40 return; |
| 42 PassRefFromConstructor(get_interface<PPB_Graphics2D>()->Create( | 41 PassRefFromConstructor(get_interface<PPB_Graphics2D>()->Create( |
| 43 instance->pp_instance(), | 42 instance->pp_instance(), |
| 44 &size.pp_size(), | 43 &size.pp_size(), |
| 45 BoolToPPBool(is_always_opaque))); | 44 PP_FromBool(is_always_opaque))); |
| 46 if (!is_null()) { | 45 if (!is_null()) { |
| 47 // Only save the size if allocation succeeded. | 46 // Only save the size if allocation succeeded. |
| 48 size_ = size; | 47 size_ = size; |
| 49 } | 48 } |
| 50 } | 49 } |
| 51 | 50 |
| 52 Graphics2D::~Graphics2D() { | 51 Graphics2D::~Graphics2D() { |
| 53 } | 52 } |
| 54 | 53 |
| 55 Graphics2D& Graphics2D::operator=(const Graphics2D& other) { | 54 Graphics2D& Graphics2D::operator=(const Graphics2D& other) { |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 } | 98 } |
| 100 | 99 |
| 101 int32_t Graphics2D::Flush(const CompletionCallback& cc) { | 100 int32_t Graphics2D::Flush(const CompletionCallback& cc) { |
| 102 if (!has_interface<PPB_Graphics2D>()) | 101 if (!has_interface<PPB_Graphics2D>()) |
| 103 return cc.MayForce(PP_ERROR_NOINTERFACE); | 102 return cc.MayForce(PP_ERROR_NOINTERFACE); |
| 104 return get_interface<PPB_Graphics2D>()->Flush(pp_resource(), | 103 return get_interface<PPB_Graphics2D>()->Flush(pp_resource(), |
| 105 cc.pp_completion_callback()); | 104 cc.pp_completion_callback()); |
| 106 } | 105 } |
| 107 | 106 |
| 108 } // namespace pp | 107 } // namespace pp |
| OLD | NEW |