FireBreath  1.4.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Pages
D3d10AsyncDrawService.h
1 /**********************************************************\
2 Original Author: Gil Gonen
3 
4 Created: Jan 28, 2013
5 License: Dual license model; choose one of two:
6 New BSD License
7 http://www.opensource.org/licenses/bsd-license.php
8 - or -
9 GNU Lesser General Public License, version 2.1
10 http://www.gnu.org/licenses/lgpl-2.1.html
11 
12 Copyright 2013 Gil Gonen and the Firebreath development team
13 \**********************************************************/
14 
15 #pragma once
16 #ifndef H_FB_D3D10ASYNCDRAWSERVICE
17 #define H_FB_D3D10ASYNCDRAWSERVICE
18 
19 #include "win_common.h"
20 #include <d3d10_1.h>
21 #include <boost/function.hpp>
22 #include <boost/thread.hpp>
23 #include "FBPointers.h"
24 #include "AsyncDrawService.h"
25 
26 namespace FB
27 {
28  FB_FORWARD_PTR(BrowserHost);
29  FB_FORWARD_PTR(D3d10DeviceContext);
30  FB_FORWARD_PTR(D3d10AsyncDrawService);
31 
32  class D3d10AsyncDrawService
33  : public AsyncDrawService
34  {
35  public:
36  typedef boost::function<bool(ID3D10Device1*, ID3D10RenderTargetView*, uint32_t, uint32_t)> RenderCallback;
37 
38  D3d10AsyncDrawService(BrowserHostPtr);
39  ~D3d10AsyncDrawService();
40 
41  void resized(uint32_t width, uint32_t height);
42  virtual void render(RenderCallback cb);
43 
44  protected:
45  virtual void present(bool init) = 0;
46  ID3D10Device1* device() const;
47 
48  BrowserHostWeakPtr m_weakHost;
49  D3d10DeviceContextPtr m_dc;
50 
51  unsigned m_width, m_height;
52  bool m_dimsChanged; // since last call to present()
53 
54  boost::mutex m_mut;
55  boost::condition_variable m_cond;
56  CComPtr<ID3D10Texture2D> m_pBackBuffer;
57  CComPtr<IDXGIKeyedMutex> m_pBufferMutex;
58  };
59 }
60 
61 #endif
boost::shared_ptr< FB::BrowserHost > BrowserHostPtr
Defines an alias representing a BrowserHost shared_ptr (you should never use a BrowserHost* directly)...
Definition: APITypes.h:117