Bug 1321412 - Add an operator<< to BaseSize. r=kats
☠☠ backed out by 3141d9e9e634 ☠ ☠
authorBotond Ballo <botond@mozilla.com>
Fri, 25 Nov 2016 20:46:58 -0500
changeset 372784 2f88a62520a4b1b0a8f29eddf5185af0fee052b9
parent 372783 31f15a3b5ce0e02ce66d7ed04fa6055853749d20
child 372785 c2b8107d846861bb1e32f2bcddb7edc45a0c2328
push id1419
push userjlund@mozilla.com
push dateMon, 10 Apr 2017 20:44:07 +0000
treeherdermozilla-release@5e6801b73ef6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskats
bugs1321412
milestone53.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1321412 - Add an operator<< to BaseSize. r=kats MozReview-Commit-ID: 4zVkyafxtfG
gfx/2d/BaseSize.h
--- a/gfx/2d/BaseSize.h
+++ b/gfx/2d/BaseSize.h
@@ -2,16 +2,18 @@
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef MOZILLA_GFX_BASESIZE_H_
 #define MOZILLA_GFX_BASESIZE_H_
 
 #include <algorithm>
+#include <ostream>
+
 #include "mozilla/Attributes.h"
 
 namespace mozilla {
 namespace gfx {
 
 /**
  * Do not use this class directly. Subclass it, pass that subclass as the
  * Sub parameter, and only use that subclass. This allows methods to safely
@@ -98,14 +100,19 @@ struct BaseSize {
     return Sub(std::min(aA.width, aB.width),
                std::min(aA.height, aB.height));
   }
 
   friend Sub Max(const Sub& aA, const Sub& aB) {
     return Sub(std::max(aA.width, aB.width),
                std::max(aA.height, aB.height));
   }
+
+  friend std::ostream& operator<<(std::ostream& aStream,
+      const BaseSize<T, Sub>& aSize) {
+    return aStream << aSize.width << " x " << aSize.height;
+  }
 };
 
 } // namespace gfx
 } // namespace mozilla
 
 #endif /* MOZILLA_GFX_BASESIZE_H_ */