-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAwesomiumPanel.cpp
59 lines (46 loc) · 1.04 KB
/
AwesomiumPanel.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#include "AwesomiumPanel.h"
#include <Awesomium/WebCore.h>
AwesomiumPanel::AwesomiumPanel(int width, int height)
{
m_width = width;
m_height = height;
//m_webCore = Awesomium::WebCore::GetPointer(); //Get the webcore singleton
m_webCore = new Awesomium::WebCore();
m_webView = m_webCore->createWebView(m_width, m_height);
}
AwesomiumPanel::~AwesomiumPanel()
{
m_webView->destroy();
delete m_webCore;
}
void AwesomiumPanel::LoadURL(const std::string &url)
{
m_webView->loadURL(url.c_str());
}
void AwesomiumPanel::Update()
{
m_webCore->update();
}
bool AwesomiumPanel::IsDirty()
{
return m_webView->isDirty();
}
const unsigned char *AwesomiumPanel::GetBuffer()
{
const Awesomium::RenderBuffer *rBuffer = m_webView->render();
return rBuffer->buffer;
}
int AwesomiumPanel::GetWidth()
{
return m_width;
}
int AwesomiumPanel::GetHeight()
{
return m_height;
}
void AwesomiumPanel::Resize(int width, int height)
{
m_width = width;
m_height = height;
m_webView->resize(m_width, m_height);
}