Separate Simple Backend creation from initialization.
[chromium-blink-merge.git] / ppapi / thunk / ppb_graphics_2d_api.h
blobe6357c3e4d2293b58fe3221acf16732d4823bb53
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
3 // found in the LICENSE file.
5 #ifndef PPAPI_THUNK_PPB_GRAPHICS_2D_API_H_
6 #define PPAPI_THUNK_PPB_GRAPHICS_2D_API_H_
8 #include "base/memory/ref_counted.h"
9 #include "ppapi/c/pp_bool.h"
10 #include "ppapi/c/pp_completion_callback.h"
11 #include "ppapi/c/pp_point.h"
12 #include "ppapi/c/pp_rect.h"
13 #include "ppapi/c/pp_resource.h"
14 #include "ppapi/c/pp_size.h"
15 #include "ppapi/thunk/ppapi_thunk_export.h"
17 namespace ppapi {
19 class TrackedCallback;
21 namespace thunk {
23 class PPAPI_THUNK_EXPORT PPB_Graphics2D_API {
24 public:
25 virtual ~PPB_Graphics2D_API() {}
27 virtual PP_Bool Describe(PP_Size* size, PP_Bool* is_always_opaque) = 0;
28 virtual void PaintImageData(PP_Resource image_data,
29 const PP_Point* top_left,
30 const PP_Rect* src_rect) = 0;
31 virtual void Scroll(const PP_Rect* clip_rect,
32 const PP_Point* amount) = 0;
33 virtual void ReplaceContents(PP_Resource image_data) = 0;
34 virtual bool SetScale(float scale) = 0;
35 virtual float GetScale() = 0;
37 // When |old_image_data| is non-null and the flush is executing a replace
38 // contents (which leaves the "old" ImageData unowned), the resource ID of
39 // the old image data will be placed into |*old_image_data| synchronously
40 // (not when the flush callback completes).
42 // When this happens, a reference to this resource will be transferred to the
43 // caller. If there is no replace contents operation, old_image_data will be
44 // ignored. If |*old_image_data| is null, then the old image data will be
45 // destroyed if there was one.
46 virtual int32_t Flush(scoped_refptr<TrackedCallback> callback,
47 PP_Resource* old_image_data) = 0;
49 // Test only
50 virtual bool ReadImageData(PP_Resource image, const PP_Point* top_left) = 0;
53 } // namespace thunk
54 } // namespace ppapi
56 #endif // PPAPI_THUNK_PPB_GRAPHICS_2D_API_H_