Bug 1399787 - Part 2.c. Rename DrawPageToFile to SavePageToFile.
This is to make the naming more consistent with SavePageToBuffer.
MozReview-Commit-ID: 5miYvv9yFFR
--- a/widget/windows/PDFViaEMFPrintHelper.cpp
+++ b/widget/windows/PDFViaEMFPrintHelper.cpp
@@ -178,17 +178,17 @@ PDFViaEMFPrintHelper::DrawPage(HDC aPrin
NS_ENSURE_TRUE(result, false);
RECT printRect = {0, 0, aPageWidth, aPageHeight};
result = emf.Playback(aPrinterDC, printRect);
return result;
}
bool
-PDFViaEMFPrintHelper::DrawPageToFile(const wchar_t* aFilePath,
+PDFViaEMFPrintHelper::SavePageToFile(const wchar_t* aFilePath,
unsigned int aPageIndex,
int aPageWidth, int aPageHeight)
{
MOZ_ASSERT(aFilePath);
// OpenDocument might fail.
if (!mPDFDoc) {
MOZ_ASSERT_UNREACHABLE("Make sure OpenDocument return true before"
--- a/widget/windows/PDFViaEMFPrintHelper.h
+++ b/widget/windows/PDFViaEMFPrintHelper.h
@@ -50,17 +50,17 @@ public:
int GetPageCount() const { return mPDFiumEngine->GetPageCount(mPDFDoc); }
/** Convert specified PDF page to EMF and draw the EMF onto the given DC. */
bool DrawPage(HDC aPrinterDC, unsigned int aPageIndex,
int aPageWidth, int aPageHeight);
/** Convert a specified PDF page to EMF and save it to file. */
- bool DrawPageToFile(const wchar_t* aFilePath, unsigned int aPageIndex,
+ bool SavePageToFile(const wchar_t* aFilePath, unsigned int aPageIndex,
int aPageWidth, int aPageHeight);
/** Create a share memory and serialize the EMF content into it. */
bool SavePageToBuffer(unsigned int aPageIndex, int aPageWidth,
int aPageHeight, ipc::Shmem& aMem,
mozilla::ipc::IShmemAllocator* aAllocator);
protected:
--- a/widget/windows/gtest/TestEMFConversion.cpp
+++ b/widget/windows/gtest/TestEMFConversion.cpp
@@ -147,31 +147,31 @@ TEST(TestEMFConversion, CompareEMFWithRe
const int pageWidth = 4961;
const int pageHeight = 7016;
// Convert a PDF file to an EMF file(PrinterTestPage.pdf -> gtest.emf)
nsAutoString emfPath;
ASSERT_TRUE(NS_SUCCEEDED(GetFilePathViaSpecialDirectory(NS_OS_TEMP_DIR,
"gtest.emf",
emfPath)));
- ASSERT_TRUE(PDFHelper->DrawPageToFile(emfPath.get(), 0,
+ ASSERT_TRUE(PDFHelper->SavePageToFile(emfPath.get(), 0,
pageWidth, pageHeight));
PDFHelper->CloseDocument();
#ifdef _WIN64
// Convert a PDF file to an EMF file by external library.
// (PrinterTestPage.pdf -> gtestRef.emf)
UniquePtr<EMFViaExtDLLHelper> ExtHelper = MakeUnique<EMFViaExtDLLHelper>();
ASSERT_TRUE(SetupPrintHelper("PrinterTestPage.pdf", ExtHelper.get()));
nsAutoString emfPathRef;
ASSERT_TRUE(NS_SUCCEEDED(GetFilePathViaSpecialDirectory(NS_OS_TEMP_DIR,
"gtestRef.emf",
emfPathRef)));
- ASSERT_TRUE(ExtHelper->DrawPageToFile(emfPathRef.get(), 0,
+ ASSERT_TRUE(ExtHelper->SavePageToFile(emfPathRef.get(), 0,
pageWidth, pageHeight));
ExtHelper->CloseDocument();
CompareTwoFiles(emfPath, emfPathRef);
#endif
}
// Input a PDF file which does not exist
@@ -189,16 +189,16 @@ TEST(TestEMFConversion, TestInsufficient
MakeUnique<PDFViaEMFPrintHelper>();
ASSERT_TRUE(SetupPrintHelper("PrinterTestPage.pdf", PDFHelper.get()));
nsAutoString emfPath;
ASSERT_TRUE(NS_SUCCEEDED(GetFilePathViaSpecialDirectory(NS_OS_TEMP_DIR,
"gtest.emf",
emfPath)));
- ASSERT_FALSE(PDFHelper->DrawPageToFile(emfPath.get(), 0, 0, 0));
- ASSERT_FALSE(PDFHelper->PageToFile(emfPath.get(), 0, 100, -1));
+ ASSERT_FALSE(PDFHelper->SavePageToFile(emfPath.get(), 0, 0, 0));
+ ASSERT_FALSE(PDFHelper->SavePageToFile(emfPath.get(), 0, 100, -1));
PDFHelper->CloseDocument();
}
} // namespace widget
} // namespace mozilla
\ No newline at end of file