OLD | NEW |
| (Empty) |
1 // Copyright 2010 The Native Client Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can | |
3 // be found in the LICENSE file. | |
4 | |
5 #ifndef C_SALT_GRAPHICS_2D_CONTEXT_H_ | |
6 #define C_SALT_GRAPHICS_2D_CONTEXT_H_ | |
7 | |
8 #include "c_salt/rect.h" | |
9 #include "boost/scoped_ptr.hpp" | |
10 | |
11 namespace c_salt { | |
12 class Image; | |
13 class Instance; | |
14 class Graphics2DContextImpl; | |
15 | |
16 // Manage a 2D graphics context associated with an instance. This class | |
17 // encapsulates the 2D rendering context. | |
18 // drawing. | |
19 class Graphics2DContext { | |
20 public: | |
21 // Constructor might not immediately create the underlying 2D graphics | |
22 // context. The context is not actually created until Init() is called. | |
23 Graphics2DContext(); | |
24 virtual ~Graphics2DContext(); | |
25 | |
26 // Called when the owning Instance is fully connected to the browser; at this | |
27 // point, implementations can safely make calls into the browser. | |
28 bool Init(const c_salt::Instance& instance); | |
29 | |
30 // Returns the size of the plugin image. | |
31 const Size& GetSize() const {return size_;} | |
32 | |
33 // Copy |img| pixels into graphics context and flush the contents of this | |
34 // context to the real device. | |
35 void Update(const Image& img); | |
36 | |
37 protected: | |
38 // Not implemented. | |
39 Graphics2DContext(const Graphics2DContext&); | |
40 Graphics2DContext& operator=(const Graphics2DContext&); | |
41 | |
42 boost::scoped_ptr<Graphics2DContextImpl> impl_; | |
43 Size size_; // size of the plugin image. | |
44 }; | |
45 } // namespace c_salt | |
46 | |
47 #endif // C_SALT_GRAPHICS_2D_CONTEXT_H_ | |
48 | |
OLD | NEW |