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.
4 
5 #ifndef PPAPI_THUNK_PPB_GRAPHICS_2D_API_H_
6 #define PPAPI_THUNK_PPB_GRAPHICS_2D_API_H_
7 
8 #include <stdint.h>
9 
10 #include "base/memory/ref_counted.h"
11 #include "ppapi/c/pp_bool.h"
12 #include "ppapi/c/pp_completion_callback.h"
13 #include "ppapi/c/pp_point.h"
14 #include "ppapi/c/pp_rect.h"
15 #include "ppapi/c/pp_resource.h"
16 #include "ppapi/c/pp_size.h"
17 #include "ppapi/thunk/ppapi_thunk_export.h"
18 
19 namespace ppapi {
20 
21 class TrackedCallback;
22 
23 namespace thunk {
24 
25 class PPAPI_THUNK_EXPORT PPB_Graphics2D_API {
26  public:
~PPB_Graphics2D_API()27   virtual ~PPB_Graphics2D_API() {}
28 
29   virtual PP_Bool Describe(PP_Size* size, PP_Bool* is_always_opaque) = 0;
30   virtual void PaintImageData(PP_Resource image_data,
31                               const PP_Point* top_left,
32                               const PP_Rect* src_rect) = 0;
33   virtual void Scroll(const PP_Rect* clip_rect,
34                       const PP_Point* amount) = 0;
35   virtual void ReplaceContents(PP_Resource image_data) = 0;
36   virtual int32_t Flush(scoped_refptr<TrackedCallback> callback) = 0;
37   virtual PP_Bool SetScale(float scale) = 0;
38   virtual float GetScale() = 0;
39   virtual PP_Bool SetLayerTransform(float scale,
40                                     const PP_Point* origin,
41                                     const PP_Point* translate) = 0;
42 
43   // Test only
44   virtual bool ReadImageData(PP_Resource image, const PP_Point* top_left) = 0;
45 };
46 
47 }  // namespace thunk
48 }  // namespace ppapi
49 
50 #endif  // PPAPI_THUNK_PPB_GRAPHICS_2D_API_H_
51