create bitmap

This commit is contained in:
anthony taranto
2011-04-19 15:45:03 -07:00
parent a30eeb1dcf
commit 287cc62ec8
2 changed files with 16 additions and 0 deletions
+13
View File
@@ -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);
}
+3
View File
@@ -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;