blob: 00dd9f7e0281885786903d4376668b3da80456d3 [file] [log] [blame]
[email protected]08e65c12012-11-29 18:53:291// 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_PROXY_GRAPHICS_2D_RESOURCE_H_
6#define PPAPI_PROXY_GRAPHICS_2D_RESOURCE_H_
7
avie029c4132015-12-23 06:45:228#include <stdint.h>
9
[email protected]08e65c12012-11-29 18:53:2910#include "base/compiler_specific.h"
11#include "ppapi/proxy/plugin_resource.h"
12#include "ppapi/proxy/ppapi_proxy_export.h"
13#include "ppapi/thunk/ppb_graphics_2d_api.h"
14
15namespace ppapi {
16
17class TrackedCallback;
18
19namespace proxy {
20
Nico Weber43ddd7a32017-08-15 19:19:2721class PPAPI_PROXY_EXPORT Graphics2DResource : public PluginResource,
22 public thunk::PPB_Graphics2D_API {
[email protected]08e65c12012-11-29 18:53:2923 public:
24 Graphics2DResource(Connection connection,
25 PP_Instance instance,
26 const PP_Size& size,
27 PP_Bool is_always_opaque);
28
Peter Boström3d5b3cb2021-09-23 21:35:4529 Graphics2DResource(const Graphics2DResource&) = delete;
30 Graphics2DResource& operator=(const Graphics2DResource&) = delete;
31
nicke4784432015-04-23 14:01:4832 ~Graphics2DResource() override;
[email protected]08e65c12012-11-29 18:53:2933
34 // Resource overrides.
nicke4784432015-04-23 14:01:4835 thunk::PPB_Graphics2D_API* AsPPB_Graphics2D_API() override;
[email protected]08e65c12012-11-29 18:53:2936
37 // PPB_Graphics2D_API overrides.
nicke4784432015-04-23 14:01:4838 PP_Bool Describe(PP_Size* size, PP_Bool* is_always_opaque) override;
39 void PaintImageData(PP_Resource image_data,
40 const PP_Point* top_left,
41 const PP_Rect* src_rect) override;
42 void Scroll(const PP_Rect* clip_rect, const PP_Point* amount) override;
43 void ReplaceContents(PP_Resource image_data) override;
44 PP_Bool SetScale(float scale) override;
45 float GetScale() override;
alessandroad55efd02016-04-21 19:35:2546 PP_Bool SetLayerTransform(float scale,
47 const PP_Point* origin,
48 const PP_Point* translate) override;
nicke4784432015-04-23 14:01:4849 int32_t Flush(scoped_refptr<TrackedCallback> callback) override;
50 bool ReadImageData(PP_Resource image, const PP_Point* top_left) override;
[email protected]08e65c12012-11-29 18:53:2951
52 private:
53 void OnPluginMsgFlushACK(const ResourceMessageReplyParams& params);
54
55 const PP_Size size_;
56 const PP_Bool is_always_opaque_;
57 float scale_;
58
59 scoped_refptr<TrackedCallback> current_flush_callback_;
[email protected]08e65c12012-11-29 18:53:2960};
61
62} // namespace proxy
63} // namespace ppapi
64
65#endif // PPAPI_PROXY_GRAPHICS_2D_RESOURCE_H_