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/proxy/graphics_2d_resource.h" | 5 #include "ppapi/proxy/graphics_2d_resource.h" |
6 | 6 |
7 #include "ppapi/c/pp_bool.h" | 7 #include "ppapi/c/pp_bool.h" |
8 #include "ppapi/c/pp_point.h" | 8 #include "ppapi/c/pp_point.h" |
9 #include "ppapi/c/pp_rect.h" | 9 #include "ppapi/c/pp_rect.h" |
10 #include "ppapi/c/pp_resource.h" | 10 #include "ppapi/c/pp_resource.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 Graphics2DResource::Graphics2DResource(Connection connection, | 25 Graphics2DResource::Graphics2DResource(Connection connection, |
26 PP_Instance instance, | 26 PP_Instance instance, |
27 const PP_Size& size, | 27 const PP_Size& size, |
28 PP_Bool is_always_opaque) | 28 PP_Bool is_always_opaque) |
29 : PluginResource(connection, instance), | 29 : PluginResource(connection, instance), |
30 size_(size), | 30 size_(size), |
31 is_always_opaque_(is_always_opaque), | 31 is_always_opaque_(is_always_opaque), |
32 scale_(1.0f) { | 32 scale_(1.0f) { |
33 // These checks are copied from PPB_ImageData_Impl::Init to make tests passed. | 33 // These checks are copied from PPB_ImageData_Impl::Init to make tests passed. |
34 // Let's remove/refactor this when start to refactor ImageData. | 34 // Let's remove/refactor this when start to refactor ImageData. |
35 bool bad_args = size.width <= 0 || size.height <= 0 || | 35 bool bad_args = |
36 static_cast<int64>(size.width) * static_cast<int64>(size.height) >= | 36 size.width <= 0 || size.height <= 0 || |
37 std::numeric_limits<int32>::max() / 4; | 37 static_cast<int64_t>(size.width) * static_cast<int64_t>(size.height) >= |
| 38 std::numeric_limits<int32_t>::max() / 4; |
38 if (!bad_args && !sent_create_to_renderer()) { | 39 if (!bad_args && !sent_create_to_renderer()) { |
39 SendCreate(RENDERER, | 40 SendCreate(RENDERER, |
40 PpapiHostMsg_Graphics2D_Create(size, is_always_opaque)); | 41 PpapiHostMsg_Graphics2D_Create(size, is_always_opaque)); |
41 } | 42 } |
42 } | 43 } |
43 | 44 |
44 Graphics2DResource::~Graphics2DResource() { | 45 Graphics2DResource::~Graphics2DResource() { |
45 } | 46 } |
46 | 47 |
47 PP_Bool Graphics2DResource::Describe(PP_Size* size, PP_Bool* is_always_opaque) { | 48 PP_Bool Graphics2DResource::Describe(PP_Size* size, PP_Bool* is_always_opaque) { |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 return result == PP_OK; | 140 return result == PP_OK; |
140 } | 141 } |
141 | 142 |
142 void Graphics2DResource::OnPluginMsgFlushACK( | 143 void Graphics2DResource::OnPluginMsgFlushACK( |
143 const ResourceMessageReplyParams& params) { | 144 const ResourceMessageReplyParams& params) { |
144 current_flush_callback_->Run(params.result()); | 145 current_flush_callback_->Run(params.result()); |
145 } | 146 } |
146 | 147 |
147 } // namespace proxy | 148 } // namespace proxy |
148 } // namespace ppapi | 149 } // namespace ppapi |
OLD | NEW |