• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 "base/memory/ref_counted.h"
9 #include "ppapi/c/dev/ppb_graphics_2d_dev.h"
10 #include "ppapi/c/pp_bool.h"
11 #include "ppapi/c/pp_completion_callback.h"
12 #include "ppapi/c/pp_point.h"
13 #include "ppapi/c/pp_rect.h"
14 #include "ppapi/c/pp_resource.h"
15 #include "ppapi/c/pp_size.h"
16 #include "ppapi/thunk/ppapi_thunk_export.h"
17 
18 namespace ppapi {
19 
20 class TrackedCallback;
21 
22 namespace thunk {
23 
24 class PPAPI_THUNK_EXPORT PPB_Graphics2D_API {
25  public:
~PPB_Graphics2D_API()26   virtual ~PPB_Graphics2D_API() {}
27 
28   virtual PP_Bool Describe(PP_Size* size, PP_Bool* is_always_opaque) = 0;
29   virtual void PaintImageData(PP_Resource image_data,
30                               const PP_Point* top_left,
31                               const PP_Rect* src_rect) = 0;
32   virtual void Scroll(const PP_Rect* clip_rect,
33                       const PP_Point* amount) = 0;
34   virtual void ReplaceContents(PP_Resource image_data) = 0;
35   virtual int32_t Flush(scoped_refptr<TrackedCallback> callback) = 0;
36 
37   // Dev interface.
38   virtual PP_Bool SetScale(float scale) = 0;
39   virtual float GetScale() = 0;
40   virtual void SetOffset(const PP_Point* offset) = 0;
41   virtual void SetResizeMode(PP_Graphics2D_Dev_ResizeMode resize_mode) = 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