Bug 1401069 - Part 4. Change argument type from 'const RECT *' to reference type in WindowsEMF::Playback. draft
authorcku <cku@mozilla.com>
Mon, 18 Sep 2017 23:25:34 +0800
changeset 668138 4b117ec1d90c141749d597f4e9f0e63cfea3f36c
parent 667473 749b4f86c6de51fca2652e3571bf8682ab65956a
child 668139 be26488180377be845111cbac6bcd1929cd7e6dc
push id80936
push usercku@mozilla.com
push dateThu, 21 Sep 2017 04:54:21 +0000
bugs1401069
milestone57.0a1
Bug 1401069 - Part 4. Change argument type from 'const RECT *' to reference type in WindowsEMF::Playback. MozReview-Commit-ID: 4StsIm9sqeC
widget/windows/PDFViaEMFPrintHelper.cpp
widget/windows/WindowsEMF.cpp
widget/windows/WindowsEMF.h
--- a/widget/windows/PDFViaEMFPrintHelper.cpp
+++ b/widget/windows/PDFViaEMFPrintHelper.cpp
@@ -137,17 +137,17 @@ PDFViaEMFPrintHelper::DrawPage(HDC aPrin
   WindowsEMF emf;
   bool result = emf.InitForDrawing();
   NS_ENSURE_TRUE(result, false);
 
   result = RenderPageToDC(emf.GetDC(), aPageIndex, aPageWidth, aPageHeight);
   NS_ENSURE_TRUE(result, false);
 
   RECT printRect = {0, 0, aPageWidth, aPageHeight};
-  result = emf.Playback(aPrinterDC, &printRect);
+  result = emf.Playback(aPrinterDC, printRect);
   return result;
 }
 
 bool
 PDFViaEMFPrintHelper::DrawPageToFile(const wchar_t* aFilePath,
                                      unsigned int aPageIndex,
                                      int aPageWidth, int aPageHeight)
 {
--- a/widget/windows/WindowsEMF.cpp
+++ b/widget/windows/WindowsEMF.cpp
@@ -61,24 +61,23 @@ WindowsEMF::ReleaseEMFHandle()
 void
 WindowsEMF::ReleaseAllResource()
 {
   FinishDocument();
   ReleaseEMFHandle();
 }
 
 bool
-WindowsEMF::Playback(HDC aDeviceContext, const RECT* aRect)
+WindowsEMF::Playback(HDC aDeviceContext, const RECT& aRect)
 {
-  MOZ_ASSERT(aRect);
   if (!FinishDocument()) {
     return false;
   }
 
-  return ::PlayEnhMetaFile(aDeviceContext, mEmf, aRect) != 0;
+  return ::PlayEnhMetaFile(aDeviceContext, mEmf, &aRect) != 0;
 }
 
 bool
 WindowsEMF::SaveToFile()
 {
   if (!FinishDocument()) {
     return false;
   }
--- a/widget/windows/WindowsEMF.h
+++ b/widget/windows/WindowsEMF.h
@@ -56,17 +56,17 @@ public:
                     "InitForDrawing/ InitFromFileContents and before"
                     "Playback/ SaveToFile");
     return mDC;
   }
 
   /**
    * Play the EMF's drawing commands onto the given DC.
    */
-  bool Playback(HDC aDeviceContext, const RECT* aRect);
+  bool Playback(HDC aDeviceContext, const RECT& aRect);
 
   /**
    * Called to generate the EMF file once a consumer has finished drawing to
    * the HDC returned by GetDC(), if initializes the object with the path of a
    * file.
    */
   bool SaveToFile();