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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 * | 115 * |
116 * The new image must be the exact same size as this graphics context. If the | 116 * The new image must be the exact same size as this graphics context. If the |
117 * new image uses a different image format than the browser's native bitmap | 117 * new image uses a different image format than the browser's native bitmap |
118 * format (use PPB_ImageData.GetNativeImageDataFormat to retrieve this), then | 118 * format (use PPB_ImageData.GetNativeImageDataFormat to retrieve this), then |
119 * a conversion will be done inside the browser which may slow the performance | 119 * a conversion will be done inside the browser which may slow the performance |
120 * a little bit. | 120 * a little bit. |
121 * | 121 * |
122 * THE NEW IMAGE WILL NOT BE PAINTED UNTIL YOU CALL FLUSH. | 122 * THE NEW IMAGE WILL NOT BE PAINTED UNTIL YOU CALL FLUSH. |
123 * | 123 * |
124 * After this call, you should take care to release your references to the | 124 * After this call, you should take care to release your references to the |
125 * image. If you paint to the image after a Swap, there is the possibility of | 125 * image. If you paint to the image after ReplaceContents, there is the |
126 * significant painting artifacts because the page might use partially- | 126 * possibility of significant painting artifacts because the page might use |
127 * rendered data when copying out of the backing store. | 127 * partially-rendered data when copying out of the backing store. |
128 * | 128 * |
129 * In the case of an animation, you will want to allocate a new image for the | 129 * In the case of an animation, you will want to allocate a new image for the |
130 * next frame. It is best if you wait until the flush callback has executed | 130 * next frame. It is best if you wait until the flush callback has executed |
131 * before allocating this bitmap. This gives the browser the option of | 131 * before allocating this bitmap. This gives the browser the option of |
132 * caching the previous backing store and handing it back to you (assuming | 132 * caching the previous backing store and handing it back to you (assuming |
133 * the sizes match). In the optimal case, this means no bitmaps are allocated | 133 * the sizes match). In the optimal case, this means no bitmaps are allocated |
134 * during the animation, and the backing store and "front buffer" (which the | 134 * during the animation, and the backing store and "front buffer" (which the |
135 * plugin is painting into) are just being swapped back and forth. | 135 * plugin is painting into) are just being swapped back and forth. |
136 */ | 136 */ |
137 void (*ReplaceContents)(PP_Resource graphics_2d, PP_Resource image_data); | 137 void (*ReplaceContents)(PP_Resource graphics_2d, PP_Resource image_data); |
138 | 138 |
139 /** | 139 /** |
140 * Flushes any enqueued paint, scroll, and swap commands for the backing | 140 * Flushes any enqueued paint, scroll, and replace commands for the backing |
141 * store. This actually executes the updates, and causes a repaint of the | 141 * store. This actually executes the updates, and causes a repaint of the |
142 * webpage, assuming this graphics context is bound to a plugin instance. This | 142 * webpage, assuming this graphics context is bound to a plugin instance. This |
143 * can run in two modes: | 143 * can run in two modes: |
144 * | 144 * |
145 * - In synchronous mode, you specify NULL for the callback and the callback | 145 * - In synchronous mode, you specify NULL for the callback and the callback |
146 * data. This function will block the calling thread until the image has | 146 * data. This function will block the calling thread until the image has |
147 * been painted to the screen. It is not legal to block the main thread of | 147 * been painted to the screen. It is not legal to block the main thread of |
148 * the plugin, you can use synchronous mode only from background threads. | 148 * the plugin, you can use synchronous mode only from background threads. |
149 * | 149 * |
150 * - In asynchronous mode, you specify a callback function and the argument | 150 * - In asynchronous mode, you specify a callback function and the argument |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 struct PP_CompletionCallback callback); | 216 struct PP_CompletionCallback callback); |
217 | 217 |
218 }; | 218 }; |
219 | 219 |
220 /** | 220 /** |
221 * @} | 221 * @} |
222 * End addtogroup PPB | 222 * End addtogroup PPB |
223 */ | 223 */ |
224 #endif /* PPAPI_C_PPB_GRAPHICS_2D_H_ */ | 224 #endif /* PPAPI_C_PPB_GRAPHICS_2D_H_ */ |
225 | 225 |
OLD | NEW |