Roll src/third_party/WebKit 05e9c31:d6595eb (svn 198725:198727)
[chromium-blink-merge.git] / ppapi / proxy / graphics_2d_resource.h
blobefd7d760877b4894bb7c4ef792cc902fa2a8adbe
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_PROXY_GRAPHICS_2D_RESOURCE_H_
6 #define PPAPI_PROXY_GRAPHICS_2D_RESOURCE_H_
8 #include "base/compiler_specific.h"
9 #include "ppapi/proxy/plugin_resource.h"
10 #include "ppapi/proxy/ppapi_proxy_export.h"
11 #include "ppapi/thunk/ppb_graphics_2d_api.h"
13 namespace ppapi {
15 class TrackedCallback;
17 namespace proxy {
19 class PPAPI_PROXY_EXPORT Graphics2DResource
20 : public PluginResource,
21 public NON_EXPORTED_BASE(thunk::PPB_Graphics2D_API) {
22 public:
23 Graphics2DResource(Connection connection,
24 PP_Instance instance,
25 const PP_Size& size,
26 PP_Bool is_always_opaque);
28 ~Graphics2DResource() override;
30 // Resource overrides.
31 thunk::PPB_Graphics2D_API* AsPPB_Graphics2D_API() override;
33 // PPB_Graphics2D_API overrides.
34 PP_Bool Describe(PP_Size* size, PP_Bool* is_always_opaque) override;
35 void PaintImageData(PP_Resource image_data,
36 const PP_Point* top_left,
37 const PP_Rect* src_rect) override;
38 void Scroll(const PP_Rect* clip_rect, const PP_Point* amount) override;
39 void ReplaceContents(PP_Resource image_data) override;
40 PP_Bool SetScale(float scale) override;
41 float GetScale() override;
42 int32_t Flush(scoped_refptr<TrackedCallback> callback) override;
43 bool ReadImageData(PP_Resource image, const PP_Point* top_left) override;
45 private:
46 void OnPluginMsgFlushACK(const ResourceMessageReplyParams& params);
48 const PP_Size size_;
49 const PP_Bool is_always_opaque_;
50 float scale_;
52 scoped_refptr<TrackedCallback> current_flush_callback_;
54 DISALLOW_COPY_AND_ASSIGN(Graphics2DResource);
57 } // namespace proxy
58 } // namespace ppapi
60 #endif // PPAPI_PROXY_GRAPHICS_2D_RESOURCE_H_