OLD | NEW |
1 /* Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 /* Copyright (c) 2010 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 #ifndef PPAPI_C_PPB_GRAPHICS_2D_H_ | 5 #ifndef PPAPI_C_PPB_GRAPHICS_2D_H_ |
6 #define PPAPI_C_PPB_GRAPHICS_2D_H_ | 6 #define PPAPI_C_PPB_GRAPHICS_2D_H_ |
7 | 7 |
8 #include "ppapi/c/pp_bool.h" | 8 #include "ppapi/c/pp_bool.h" |
9 #include "ppapi/c/pp_instance.h" | 9 #include "ppapi/c/pp_instance.h" |
10 #include "ppapi/c/pp_module.h" | 10 #include "ppapi/c/pp_module.h" |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 struct PP_Size* size, | 64 struct PP_Size* size, |
65 PP_Bool* is_always_opqaue); | 65 PP_Bool* is_always_opqaue); |
66 | 66 |
67 /** | 67 /** |
68 * Enqueues a paint of the given image into the context. THIS HAS NO EFFECT | 68 * Enqueues a paint of the given image into the context. THIS HAS NO EFFECT |
69 * UNTIL YOU CALL Flush(). As a result, what counts is the contents of the | 69 * UNTIL YOU CALL Flush(). As a result, what counts is the contents of the |
70 * bitmap when you call Flush, not when you call this function. | 70 * bitmap when you call Flush, not when you call this function. |
71 * | 71 * |
72 * The given image will be placed at |top_left| from the top left of the | 72 * The given image will be placed at |top_left| from the top left of the |
73 * context's internal backing store. Then the src_rect will be copied into the | 73 * context's internal backing store. Then the src_rect will be copied into the |
74 * backing store. This parameter may not be NULL. | 74 * backing store. This parameter may not be NULL. This means that the |
| 75 * rectangle being painted will be at src_rect offset by top_left. |
75 * | 76 * |
76 * The src_rect is specified in the coordinate system of the image being | 77 * The src_rect is specified in the coordinate system of the image being |
77 * painted, not the context. For the common case of copying the entire image, | 78 * painted, not the context. For the common case of copying the entire image, |
78 * you may specify a NULL |src_rect| pointer. If you are frequently updating | 79 * you may specify a NULL |src_rect| pointer. If you are frequently updating |
79 * the entire image, consider using ReplaceContents which will give slightly | 80 * the entire image, consider using ReplaceContents which will give slightly |
80 * higher performance. | 81 * higher performance. |
81 * | 82 * |
82 * The painted area of the source bitmap must fall entirely within the | 83 * The painted area of the source bitmap must fall entirely within the |
83 * context. Attempting to paint outside of the context will result in an | 84 * context. Attempting to paint outside of the context will result in an |
84 * error. However, the source bitmap may fall outside the context, as long | 85 * error. However, the source bitmap may fall outside the context, as long |
85 * as the src_rect subset of it falls entirely within the context. | 86 * as the src_rect subset of it falls entirely within the context. |
| 87 * |
| 88 * There are two modes most plugins may use for painting. The first is |
| 89 * that you will generate a new ImageData (possibly representing a subset of |
| 90 * your plugin) and then paint it. In this case, you'll set the location of |
| 91 * your painting to top_left and set src_rect to NULL. The second is that |
| 92 * you're generating small invalid regions out of a larger bitmap |
| 93 * representing your entire plugin. In this case, you would set the location |
| 94 * of your image to (0,0) and then set src_rect to the pixels you changed. |
86 */ | 95 */ |
87 void (*PaintImageData)(PP_Resource graphics_2d, | 96 void (*PaintImageData)(PP_Resource graphics_2d, |
88 PP_Resource image_data, | 97 PP_Resource image_data, |
89 const struct PP_Point* top_left, | 98 const struct PP_Point* top_left, |
90 const struct PP_Rect* src_rect); | 99 const struct PP_Rect* src_rect); |
91 | 100 |
92 /** | 101 /** |
93 * Enqueues a scroll of the context's backing store. THIS HAS NO EFFECT UNTIL | 102 * Enqueues a scroll of the context's backing store. THIS HAS NO EFFECT UNTIL |
94 * YOU CALL Flush(). The data within the given clip rect (you may specify | 103 * YOU CALL Flush(). The data within the given clip rect (you may specify |
95 * NULL to scroll the entire region) will be shifted by (dx, dy) pixels. | 104 * NULL to scroll the entire region) will be shifted by (dx, dy) pixels. |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 int32_t (*Flush)(PP_Resource graphics_2d, | 224 int32_t (*Flush)(PP_Resource graphics_2d, |
216 struct PP_CompletionCallback callback); | 225 struct PP_CompletionCallback callback); |
217 | 226 |
218 }; | 227 }; |
219 | 228 |
220 /** | 229 /** |
221 * @} | 230 * @} |
222 */ | 231 */ |
223 #endif /* PPAPI_C_PPB_GRAPHICS_2D_H_ */ | 232 #endif /* PPAPI_C_PPB_GRAPHICS_2D_H_ */ |
224 | 233 |
OLD | NEW |