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, | |
118 const PP_Point* translate) { | |
119 if (scale <= 0.0f) | |
120 return PP_FALSE; | |
121 | |
122 Post(RENDERER, PpapiHostMsg_Graphics2D_SetLayerTransform(scale, | |
wjmaclean
2016/04/14 20:14:17
Post(RENDERER,
PpapiHostMsg_Graphics2D_SetL
alessandroa
2016/04/21 15:39:22
Done.
alessandroa
2016/04/21 15:39:22
Done.
| |
123 *origin, | |
124 *translate)); | |
125 return PP_TRUE; | |
126 } | |
127 | |
116 int32_t Graphics2DResource::Flush(scoped_refptr<TrackedCallback> callback) { | 128 int32_t Graphics2DResource::Flush(scoped_refptr<TrackedCallback> callback) { |
117 // If host is not even created, return failure immediately. This can happen | 129 // If host is not even created, return failure immediately. This can happen |
118 // when failed to initialize (in constructor). | 130 // when failed to initialize (in constructor). |
119 if (!sent_create_to_renderer()) | 131 if (!sent_create_to_renderer()) |
120 return PP_ERROR_FAILED; | 132 return PP_ERROR_FAILED; |
121 | 133 |
122 if (TrackedCallback::IsPending(current_flush_callback_)) | 134 if (TrackedCallback::IsPending(current_flush_callback_)) |
123 return PP_ERROR_INPROGRESS; // Can't have >1 flush pending. | 135 return PP_ERROR_INPROGRESS; // Can't have >1 flush pending. |
124 current_flush_callback_ = callback; | 136 current_flush_callback_ = callback; |
125 | 137 |
(...skipping 14 matching lines...) Expand all Loading... | |
140 return result == PP_OK; | 152 return result == PP_OK; |
141 } | 153 } |
142 | 154 |
143 void Graphics2DResource::OnPluginMsgFlushACK( | 155 void Graphics2DResource::OnPluginMsgFlushACK( |
144 const ResourceMessageReplyParams& params) { | 156 const ResourceMessageReplyParams& params) { |
145 current_flush_callback_->Run(params.result()); | 157 current_flush_callback_->Run(params.result()); |
146 } | 158 } |
147 | 159 |
148 } // namespace proxy | 160 } // namespace proxy |
149 } // namespace ppapi | 161 } // namespace ppapi |
OLD | NEW |