1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/gfx/layers/LayersLogging.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,118 @@ 1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- 1.5 + * This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 +#ifndef GFX_LAYERSLOGGING_H 1.10 +#define GFX_LAYERSLOGGING_H 1.11 + 1.12 +#include "FrameMetrics.h" // for FrameMetrics, etc 1.13 +#include "GraphicsFilter.h" // for GraphicsFilter 1.14 +#include "mozilla/gfx/Point.h" // for IntSize, etc 1.15 +#include "mozilla/gfx/Types.h" // for Filter, SurfaceFormat 1.16 +#include "mozilla/layers/CompositorTypes.h" // for TextureFlags 1.17 +#include "nsAString.h" 1.18 +#include "nsPrintfCString.h" // for nsPrintfCString 1.19 +#include "nsRegion.h" // for nsIntRegion 1.20 +#include "nscore.h" // for nsACString, etc 1.21 + 1.22 +class gfx3DMatrix; 1.23 +struct gfxRGBA; 1.24 +struct nsIntPoint; 1.25 +struct nsIntRect; 1.26 +struct nsIntSize; 1.27 + 1.28 +namespace mozilla { 1.29 +namespace gfx { 1.30 +class Matrix4x4; 1.31 +template <class units> struct RectTyped; 1.32 +} 1.33 + 1.34 +namespace layers { 1.35 + 1.36 +nsACString& 1.37 +AppendToString(nsACString& s, const void* p, 1.38 + const char* pfx="", const char* sfx=""); 1.39 + 1.40 +nsACString& 1.41 +AppendToString(nsACString& s, const GraphicsFilter& f, 1.42 + const char* pfx="", const char* sfx=""); 1.43 + 1.44 +nsACString& 1.45 +AppendToString(nsACString& s, FrameMetrics::ViewID n, 1.46 + const char* pfx="", const char* sfx=""); 1.47 + 1.48 +nsACString& 1.49 +AppendToString(nsACString& s, const gfxRGBA& c, 1.50 + const char* pfx="", const char* sfx=""); 1.51 + 1.52 +nsACString& 1.53 +AppendToString(nsACString& s, const gfx3DMatrix& m, 1.54 + const char* pfx="", const char* sfx=""); 1.55 + 1.56 +nsACString& 1.57 +AppendToString(nsACString& s, const nsIntPoint& p, 1.58 + const char* pfx="", const char* sfx=""); 1.59 + 1.60 +template<class T> 1.61 +nsACString& 1.62 +AppendToString(nsACString& s, const mozilla::gfx::PointTyped<T>& p, 1.63 + const char* pfx="", const char* sfx="") 1.64 +{ 1.65 + s += pfx; 1.66 + s += nsPrintfCString("(x=%f, y=%f)", p.x, p.y); 1.67 + return s += sfx; 1.68 +} 1.69 + 1.70 +nsACString& 1.71 +AppendToString(nsACString& s, const nsIntRect& r, 1.72 + const char* pfx="", const char* sfx=""); 1.73 + 1.74 +template<class T> 1.75 +nsACString& 1.76 +AppendToString(nsACString& s, const mozilla::gfx::RectTyped<T>& r, 1.77 + const char* pfx="", const char* sfx="") 1.78 +{ 1.79 + s += pfx; 1.80 + s.AppendPrintf( 1.81 + "(x=%f, y=%f, w=%f, h=%f)", 1.82 + r.x, r.y, r.width, r.height); 1.83 + return s += sfx; 1.84 +} 1.85 + 1.86 +nsACString& 1.87 +AppendToString(nsACString& s, const nsIntRegion& r, 1.88 + const char* pfx="", const char* sfx=""); 1.89 + 1.90 +nsACString& 1.91 +AppendToString(nsACString& s, const nsIntSize& sz, 1.92 + const char* pfx="", const char* sfx=""); 1.93 + 1.94 +nsACString& 1.95 +AppendToString(nsACString& s, const FrameMetrics& m, 1.96 + const char* pfx="", const char* sfx=""); 1.97 + 1.98 +nsACString& 1.99 +AppendToString(nsACString& s, const mozilla::gfx::IntSize& size, 1.100 + const char* pfx="", const char* sfx=""); 1.101 + 1.102 +nsACString& 1.103 +AppendToString(nsACString& s, const mozilla::gfx::Matrix4x4& m, 1.104 + const char* pfx="", const char* sfx=""); 1.105 + 1.106 +nsACString& 1.107 +AppendToString(nsACString& s, const mozilla::gfx::Filter filter, 1.108 + const char* pfx="", const char* sfx=""); 1.109 + 1.110 +nsACString& 1.111 +AppendToString(nsACString& s, mozilla::layers::TextureFlags flags, 1.112 + const char* pfx="", const char* sfx=""); 1.113 + 1.114 +nsACString& 1.115 +AppendToString(nsACString& s, mozilla::gfx::SurfaceFormat format, 1.116 + const char* pfx="", const char* sfx=""); 1.117 + 1.118 +} // namespace 1.119 +} // namespace 1.120 + 1.121 +#endif /* GFX_LAYERSLOGGING_H */