Bug 1262807 - Add logging support for TiledRegion classes. r?mstange
MozReview-Commit-ID: JIlMLkaRirg
--- a/gfx/layers/LayersLogging.h
+++ b/gfx/layers/LayersLogging.h
@@ -4,16 +4,17 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef GFX_LAYERSLOGGING_H
#define GFX_LAYERSLOGGING_H
#include "FrameMetrics.h" // for FrameMetrics, etc
#include "mozilla/gfx/Matrix.h" // for Matrix4x4
#include "mozilla/gfx/Point.h" // for IntSize, etc
+#include "mozilla/gfx/TiledRegion.h" // for TiledRegion
#include "mozilla/gfx/Types.h" // for SamplingFilter, SurfaceFormat
#include "mozilla/layers/CompositorTypes.h" // for TextureFlags
#include "nsAString.h"
#include "nsPrintfCString.h" // for nsPrintfCString
#include "nsRegion.h" // for nsRegion, nsIntRegion
#include "nscore.h" // for nsACString, etc
namespace mozilla {
@@ -105,16 +106,28 @@ AppendToString(std::stringstream& aStrea
AppendToString(aStream, iter.Get());
aStream << "; ";
}
aStream << ">";
aStream << sfx;
}
+template <typename T>
+void
+AppendToString(std::stringstream& aStream, const mozilla::gfx::TiledRegion<T>& r,
+ const char* pfx="", const char* sfx="")
+{
+ aStream << pfx;
+ AppendToString(aStream, r.GetRegion());
+ aStream << " (bounds=";
+ AppendToString(aStream, r.GetBounds());
+ aStream << ", covers=" << r.CoversBounds() << ")" << sfx;
+}
+
void
AppendToString(std::stringstream& aStream, const EventRegions& e,
const char* pfx="", const char* sfx="");
void
AppendToString(std::stringstream& aStream, const ScrollMetadata& m,
const char* pfx="", const char* sfx="");
--- a/gfx/src/TiledRegion.h
+++ b/gfx/src/TiledRegion.h
@@ -131,16 +131,17 @@ public:
void SetEmpty()
{
mBounds.SetEmpty();
mImpl.Clear();
mCoversBounds = false;
}
RectT GetBounds() const { return mBounds; }
+ bool CoversBounds() const { return mCoversBounds; }
bool Intersects(const RectT& aRect) const
{
if (!mBounds.Intersects(aRect)) {
return false;
}
if (mCoversBounds) {
return true;