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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
106 return PP_FALSE; | 106 return PP_FALSE; |
107 Post(RENDERER, PpapiHostMsg_Graphics2D_SetScale(scale)); | 107 Post(RENDERER, PpapiHostMsg_Graphics2D_SetScale(scale)); |
108 scale_ = scale; | 108 scale_ = scale; |
109 return PP_TRUE; | 109 return PP_TRUE; |
110 } | 110 } |
111 | 111 |
112 float Graphics2DResource::GetScale() { | 112 float Graphics2DResource::GetScale() { |
113 return scale_; | 113 return scale_; |
114 } | 114 } |
115 | 115 |
116 PP_Bool Graphics2DResource::SetLayerTransform(float scale, | |
117 const PP_Point* origin, | |
wjmaclean
2016/04/13 14:47:19
Indenting is wrong here.
alessandroa
2016/04/21 15:39:21
Acknowledged.
| |
118 const PP_Point* transform) { | |
119 if (scale <= 0.0f) | |
120 return PP_FALSE; | |
wjmaclean
2016/04/13 14:47:19
nit: Add blank line after this line.
alessandroa
2016/04/21 15:39:21
Done.
| |
121 Post(RENDERER, PpapiHostMsg_Graphics2D_SetLayerTransform(scale, | |
122 *origin, | |
123 *transform)); | |
124 return PP_TRUE; | |
125 } | |
126 | |
116 int32_t Graphics2DResource::Flush(scoped_refptr<TrackedCallback> callback) { | 127 int32_t Graphics2DResource::Flush(scoped_refptr<TrackedCallback> callback) { |
117 // If host is not even created, return failure immediately. This can happen | 128 // If host is not even created, return failure immediately. This can happen |
118 // when failed to initialize (in constructor). | 129 // when failed to initialize (in constructor). |
119 if (!sent_create_to_renderer()) | 130 if (!sent_create_to_renderer()) |
120 return PP_ERROR_FAILED; | 131 return PP_ERROR_FAILED; |
121 | 132 |
122 if (TrackedCallback::IsPending(current_flush_callback_)) | 133 if (TrackedCallback::IsPending(current_flush_callback_)) |
123 return PP_ERROR_INPROGRESS; // Can't have >1 flush pending. | 134 return PP_ERROR_INPROGRESS; // Can't have >1 flush pending. |
124 current_flush_callback_ = callback; | 135 current_flush_callback_ = callback; |
125 | 136 |
(...skipping 14 matching lines...) Expand all Loading... | |
140 return result == PP_OK; | 151 return result == PP_OK; |
141 } | 152 } |
142 | 153 |
143 void Graphics2DResource::OnPluginMsgFlushACK( | 154 void Graphics2DResource::OnPluginMsgFlushACK( |
144 const ResourceMessageReplyParams& params) { | 155 const ResourceMessageReplyParams& params) { |
145 current_flush_callback_->Run(params.result()); | 156 current_flush_callback_->Run(params.result()); |
146 } | 157 } |
147 | 158 |
148 } // namespace proxy | 159 } // namespace proxy |
149 } // namespace ppapi | 160 } // namespace ppapi |
OLD | NEW |