| 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 "ppapi/c/dev/ppb_graphics_2d_dev.h" |
| 5 #include "ppapi/c/pp_completion_callback.h" | 6 #include "ppapi/c/pp_completion_callback.h" |
| 6 #include "ppapi/c/pp_errors.h" | 7 #include "ppapi/c/pp_errors.h" |
| 7 #include "ppapi/c/ppb_graphics_2d.h" | 8 #include "ppapi/c/ppb_graphics_2d.h" |
| 8 #include "ppapi/thunk/enter.h" | 9 #include "ppapi/thunk/enter.h" |
| 9 #include "ppapi/thunk/ppb_graphics_2d_api.h" | 10 #include "ppapi/thunk/ppb_graphics_2d_api.h" |
| 10 #include "ppapi/thunk/resource_creation_api.h" | 11 #include "ppapi/thunk/resource_creation_api.h" |
| 11 #include "ppapi/thunk/thunk.h" | 12 #include "ppapi/thunk/thunk.h" |
| 12 | 13 |
| 13 namespace ppapi { | 14 namespace ppapi { |
| 14 namespace thunk { | 15 namespace thunk { |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 } | 72 } |
| 72 | 73 |
| 73 int32_t Flush(PP_Resource graphics_2d, | 74 int32_t Flush(PP_Resource graphics_2d, |
| 74 PP_CompletionCallback callback) { | 75 PP_CompletionCallback callback) { |
| 75 EnterGraphics2D enter(graphics_2d, callback, true); | 76 EnterGraphics2D enter(graphics_2d, callback, true); |
| 76 if (enter.failed()) | 77 if (enter.failed()) |
| 77 return enter.retval(); | 78 return enter.retval(); |
| 78 return enter.SetResult(enter.object()->Flush(callback)); | 79 return enter.SetResult(enter.object()->Flush(callback)); |
| 79 } | 80 } |
| 80 | 81 |
| 82 PP_Bool SetScale(PP_Resource graphics_2d, float scale) { |
| 83 EnterGraphics2D enter(graphics_2d, true); |
| 84 if (enter.failed()) |
| 85 return PP_FALSE; |
| 86 return PP_FromBool(enter.object()->SetScale(scale)); |
| 87 } |
| 88 |
| 89 float GetScale(PP_Resource graphics_2d) { |
| 90 EnterGraphics2D enter(graphics_2d, true); |
| 91 if (enter.failed()) |
| 92 return 0.0f; |
| 93 return enter.object()->GetScale(); |
| 94 } |
| 95 |
| 81 const PPB_Graphics2D g_ppb_graphics_2d_thunk = { | 96 const PPB_Graphics2D g_ppb_graphics_2d_thunk = { |
| 82 &Create, | 97 &Create, |
| 83 &IsGraphics2D, | 98 &IsGraphics2D, |
| 84 &Describe, | 99 &Describe, |
| 85 &PaintImageData, | 100 &PaintImageData, |
| 86 &Scroll, | 101 &Scroll, |
| 87 &ReplaceContents, | 102 &ReplaceContents, |
| 88 &Flush | 103 &Flush |
| 89 }; | 104 }; |
| 90 | 105 |
| 106 const PPB_Graphics2D_Dev g_ppb_graphics_2d_dev_thunk = { |
| 107 &SetScale, |
| 108 &GetScale |
| 109 }; |
| 110 |
| 91 } // namespace | 111 } // namespace |
| 92 | 112 |
| 93 const PPB_Graphics2D_1_0* GetPPB_Graphics2D_1_0_Thunk() { | 113 const PPB_Graphics2D_1_0* GetPPB_Graphics2D_1_0_Thunk() { |
| 94 return &g_ppb_graphics_2d_thunk; | 114 return &g_ppb_graphics_2d_thunk; |
| 95 } | 115 } |
| 96 | 116 |
| 117 const PPB_Graphics2D_Dev_0_1* GetPPB_Graphics2D_Dev_0_1_Thunk() { |
| 118 return &g_ppb_graphics_2d_dev_thunk; |
| 119 } |
| 120 |
| 97 } // namespace thunk | 121 } // namespace thunk |
| 98 } // namespace ppapi | 122 } // namespace ppapi |
| OLD | NEW |