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 | 5 |
6 /** | 6 /** |
7 * Defines the <code>PPB_Graphics2D</code> struct representing a 2D graphics | 7 * Defines the <code>PPB_Graphics2D</code> struct representing a 2D graphics |
8 * context within the browser. | 8 * context within the browser. |
9 */ | 9 */ |
10 | 10 |
11 label Chrome { | 11 label Chrome { |
12 M14 = 1.0 | 12 M14 = 1.0, |
| 13 M27 = 1.1 |
13 }; | 14 }; |
14 | 15 |
15 /** | 16 /** |
16 * <code>PPB_Graphics2D</code> defines the interface for a 2D graphics context. | 17 * <code>PPB_Graphics2D</code> defines the interface for a 2D graphics context. |
17 */ | 18 */ |
18 [macro="PPB_GRAPHICS_2D_INTERFACE"] | 19 [macro="PPB_GRAPHICS_2D_INTERFACE"] |
19 interface PPB_Graphics2D { | 20 interface PPB_Graphics2D { |
20 /** | 21 /** |
21 * Create() creates a 2D graphics context. The returned graphics context will | 22 * Create() creates a 2D graphics context. The returned graphics context will |
22 * not be bound to the module instance on creation (call BindGraphics() on | 23 * not be bound to the module instance on creation (call BindGraphics() on |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 * <code>PP_ERROR_BADRESOURCE</code> if the graphics context is invalid, | 236 * <code>PP_ERROR_BADRESOURCE</code> if the graphics context is invalid, |
236 * <code>PP_ERROR_BADARGUMENT</code> if the callback is null and flush is | 237 * <code>PP_ERROR_BADARGUMENT</code> if the callback is null and flush is |
237 * being called from the main thread of the module, or | 238 * being called from the main thread of the module, or |
238 * <code>PP_ERROR_INPROGRESS</code> if a flush is already pending that has | 239 * <code>PP_ERROR_INPROGRESS</code> if a flush is already pending that has |
239 * not issued its callback yet. In the failure case, nothing will be updated | 240 * not issued its callback yet. In the failure case, nothing will be updated |
240 * and no callback will be scheduled. | 241 * and no callback will be scheduled. |
241 */ | 242 */ |
242 int32_t Flush( | 243 int32_t Flush( |
243 [in] PP_Resource graphics_2d, | 244 [in] PP_Resource graphics_2d, |
244 [in] PP_CompletionCallback callback); | 245 [in] PP_CompletionCallback callback); |
| 246 |
| 247 /** |
| 248 * SetScale() sets the scale factor that will be applied when painting the |
| 249 * graphics context onto the output device. Typically, if rendering at device |
| 250 * resolution is desired, the context would be created with the width and |
| 251 * height scaled up by the view's GetDeviceScale and SetScale called with a |
| 252 * scale of 1.0 / GetDeviceScale(). For example, if the view resource passed |
| 253 * to DidChangeView has a rectangle of (w=200, h=100) and a device scale of |
| 254 * 2.0, one would call Create with a size of (w=400, h=200) and then call |
| 255 * SetScale with 0.5. One would then treat each pixel in the context as a |
| 256 * single device pixel. |
| 257 * |
| 258 * @param[in] resource A <code>Graphics2D</code> context resource. |
| 259 * @param[in] scale The scale to apply when painting. |
| 260 * |
| 261 * @return Returns <code>PP_TRUE</code> on success or <code>PP_FALSE</code> if |
| 262 * the resource is invalid or the scale factor is 0 or less. |
| 263 */ |
| 264 [version=1.1] |
| 265 PP_Bool SetScale( |
| 266 [in] PP_Resource resource, |
| 267 [in] float_t scale); |
| 268 |
| 269 /*** |
| 270 * GetScale() gets the scale factor that will be applied when painting the |
| 271 * graphics context onto the output device. |
| 272 * |
| 273 * @param[in] resource A <code>Graphics2D</code> context resource. |
| 274 * |
| 275 * @return Returns the scale factor for the graphics context. If the resource |
| 276 * is not a valid <code>Graphics2D</code> context, this will return 0.0. |
| 277 */ |
| 278 [version=1.1] |
| 279 float_t GetScale( |
| 280 [in] PP_Resource resource); |
| 281 |
245 }; | 282 }; |
246 | 283 |
OLD | NEW |