mirror of
https://github.com/electron/electron.git
synced 2026-01-24 14:57:58 -05:00
Return NativeImage in BrowserWindow.capturePage
This commit is contained in:
@@ -52,15 +52,11 @@ namespace {
|
||||
|
||||
void OnCapturePageDone(
|
||||
v8::Isolate* isolate,
|
||||
const base::Callback<void(v8::Handle<v8::Value>)>& callback,
|
||||
const base::Callback<void(const gfx::Image&)>& callback,
|
||||
const std::vector<unsigned char>& data) {
|
||||
v8::Locker locker(isolate);
|
||||
v8::HandleScope handle_scope(isolate);
|
||||
|
||||
v8::Local<v8::Value> buffer = node::Buffer::New(
|
||||
reinterpret_cast<const char*>(data.data()),
|
||||
data.size());
|
||||
callback.Run(buffer);
|
||||
callback.Run(gfx::Image::CreateFrom1xPNGBytes(&data.front(), data.size()));
|
||||
}
|
||||
|
||||
} // namespace
|
||||
@@ -374,7 +370,7 @@ bool Window::IsDocumentEdited() {
|
||||
|
||||
void Window::CapturePage(mate::Arguments* args) {
|
||||
gfx::Rect rect;
|
||||
base::Callback<void(v8::Handle<v8::Value>)> callback;
|
||||
base::Callback<void(const gfx::Image&)> callback;
|
||||
|
||||
if (!(args->Length() == 1 && args->GetNext(&callback)) &&
|
||||
!(args->Length() == 2 && args->GetNext(&rect)
|
||||
|
||||
2
vendor/native_mate
vendored
2
vendor/native_mate
vendored
Submodule vendor/native_mate updated: 3387f33a8e...8d537ee2b6
Reference in New Issue
Block a user