mirror of
https://github.com/cefsharp/CefSharp.git
synced 2026-12-06 04:00:07 +00:00
create bitmap
This commit is contained in:
@@ -11,7 +11,20 @@ namespace CefSharp
|
||||
|
||||
Size CefWpfWebBrowser::ArrangeOverride(Size size)
|
||||
{
|
||||
Matrix transform = PresentationSource::FromVisual(this)->CompositionTarget->TransformToDevice;
|
||||
|
||||
int w = size.Width * transform.M11;
|
||||
int h = size.Height * transform.M22;
|
||||
|
||||
if (!_bitmap ||
|
||||
_bitmap->PixelWidth != w ||
|
||||
_bitmap->PixelHeight != h)
|
||||
{
|
||||
_bitmap = gcnew WriteableBitmap(w, h, 96 * transform.M11, 96 * transform.M22, PixelFormats::Bgr32, nullptr);
|
||||
}
|
||||
|
||||
_handlerAdapter->GetCefBrowser()->SetSize(PET_VIEW, size.Width, size.Height);
|
||||
|
||||
return Image::ArrangeOverride(size);
|
||||
}
|
||||
|
||||
|
||||
@@ -4,9 +4,12 @@
|
||||
#include "CefSharp.h"
|
||||
#include "WpfHandlerAdapter.h"
|
||||
|
||||
using namespace System;
|
||||
using namespace System::Runtime::InteropServices;
|
||||
using namespace System::Windows;
|
||||
using namespace System::Windows::Controls;
|
||||
using namespace System::Windows::Interop;
|
||||
using namespace System::Windows::Media;
|
||||
using namespace System::Windows::Media::Imaging;
|
||||
using namespace System::Threading;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user