Bug 1399787 - Part 11.d. Using PrintTargetEMF on windows if skia-pdf is enable. r=jwatt

MozReview-Commit-ID: Hx94fqGJFz6

--HG--
extra : rebase_source : 400292b58c8af2ad9e1bcd5b5c17e1293c3d849b
extra : source : 564351eb834faef9c2363edd690d80e7b24a2c41
This commit is contained in:
cku 2017-11-14 13:57:11 +08:00
parent 9d58eb170e
commit 5ea0bb1b75

View File

@ -36,6 +36,7 @@
#ifdef MOZ_ENABLE_SKIA_PDF
#include "mozilla/gfx/PrintTargetSkPDF.h"
#include "mozilla/gfx/PrintTargetEMF.h"
#include "nsIUUIDGenerator.h"
#include "nsDirectoryServiceDefs.h"
#include "nsPrintfCString.h"
@ -227,7 +228,14 @@ already_AddRefed<PrintTarget> nsDeviceContextSpecWin::MakePrintTarget()
}
if (mDevMode) {
// TBD: Implement a new PrintTarget to serve EMF OOP.
NS_WARNING_ASSERTION(!mDriverName.IsEmpty(), "No driver!");
HDC dc = ::CreateDCW(mDriverName.get(), mDeviceName.get(), nullptr, mDevMode);
if (!dc) {
gfxCriticalError(gfxCriticalError::DefaultOptions(false))
<< "Failed to create device context in GetSurfaceForPrinter";
return nullptr;
}
return PrintTargetEMF::CreateOrNull(dc, size);
}
}
#endif