Bug 1401069 - Part 3. Declare WindowsEMF::GetDC as const member function. draft
authorcku <cku@mozilla.com>
Mon, 18 Sep 2017 23:19:31 +0800
changeset 667473 749b4f86c6de51fca2652e3571bf8682ab65956a
parent 667472 2d8ccf84a002cb0d74ac1a9465adb75d7cc5db18
child 667474 372569da4485c1f5b7a1f07bdd52dd15257ddbae
child 667999 1149a67f051ac6b46896af9490c0e1875dde0f6b
child 668138 4b117ec1d90c141749d597f4e9f0e63cfea3f36c
push id80721
push usercku@mozilla.com
push dateWed, 20 Sep 2017 04:22:29 +0000
bugs1401069
milestone57.0a1
Bug 1401069 - Part 3. Declare WindowsEMF::GetDC as const member function. MozReview-Commit-ID: BX7ahnIok2T
widget/windows/WindowsEMF.h
--- a/widget/windows/WindowsEMF.h
+++ b/widget/windows/WindowsEMF.h
@@ -45,17 +45,23 @@ public:
 
   /**
    * If this object was initiaziled using InitForDrawing() then this function
    * returns an HDC that can be drawn to generate the EMF output. Otherwise it
    * returns null. After finishing with the HDC, consumers could call Playback()
    * to draw EMF onto the given DC or call SaveToFile() to finish writing the
    * EMF file.
    */
-  HDC GetDC() { return mDC; }
+  HDC GetDC() const
+  {
+    MOZ_ASSERT(mDC, "GetDC can be used only after "
+                    "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);
 
   /**
    * Called to generate the EMF file once a consumer has finished drawing to