summaryrefslogtreecommitdiffstats
path: root/Source/WebCore/platform/graphics/android/DumpLayer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebCore/platform/graphics/android/DumpLayer.cpp')
-rw-r--r--Source/WebCore/platform/graphics/android/DumpLayer.cpp83
1 files changed, 83 insertions, 0 deletions
diff --git a/Source/WebCore/platform/graphics/android/DumpLayer.cpp b/Source/WebCore/platform/graphics/android/DumpLayer.cpp
new file mode 100644
index 0000000..5551965
--- /dev/null
+++ b/Source/WebCore/platform/graphics/android/DumpLayer.cpp
@@ -0,0 +1,83 @@
+#include "config.h"
+#include "DumpLayer.h"
+
+#if USE(ACCELERATED_COMPOSITING)
+
+namespace WebCore {
+
+void lwrite(FILE* file, const char* str)
+{
+ fwrite(str, sizeof(char), strlen(str), file);
+}
+
+void writeIndent(FILE* file, int indentLevel)
+{
+ if (indentLevel)
+ fprintf(file, "%*s", indentLevel*2, " ");
+}
+
+void writeln(FILE* file, int indentLevel, const char* str)
+{
+ writeIndent(file, indentLevel);
+ lwrite(file, str);
+ lwrite(file, "\n");
+}
+
+void writeIntVal(FILE* file, int indentLevel, const char* str, int value)
+{
+ writeIndent(file, indentLevel);
+ fprintf(file, "%s = %d;\n", str, value);
+}
+
+void writeHexVal(FILE* file, int indentLevel, const char* str, int value)
+{
+ writeIndent(file, indentLevel);
+ fprintf(file, "%s = %x;\n", str, value);
+}
+
+void writeFloatVal(FILE* file, int indentLevel, const char* str, float value)
+{
+ writeIndent(file, indentLevel);
+ fprintf(file, "%s = %.3f;\n", str, value);
+}
+
+void writePoint(FILE* file, int indentLevel, const char* str, SkPoint point)
+{
+ writeIndent(file, indentLevel);
+ fprintf(file, "%s = { x = %.3f; y = %.3f; };\n", str, point.fX, point.fY);
+}
+
+void writeIntPoint(FILE* file, int indentLevel, const char* str, IntPoint point)
+{
+ writeIndent(file, indentLevel);
+ fprintf(file, "%s = { x = %d; y = %d; };\n", str, point.x(), point.y());
+}
+
+void writeSize(FILE* file, int indentLevel, const char* str, SkSize size)
+{
+ writeIndent(file, indentLevel);
+ fprintf(file, "%s = { w = %.3f; h = %.3f; };\n", str, size.width(), size.height());
+}
+
+void writeRect(FILE* file, int indentLevel, const char* str, SkRect rect)
+{
+ writeIndent(file, indentLevel);
+ fprintf(file, "%s = { x = %.3f; y = %.3f; w = %.3f; h = %.3f; };\n",
+ str, rect.fLeft, rect.fTop, rect.width(), rect.height());
+}
+
+void writeMatrix(FILE* file, int indentLevel, const char* str, const TransformationMatrix& matrix)
+{
+ writeIndent(file, indentLevel);
+ fprintf(file, "%s = { (%.2f,%.2f,%.2f,%.2f),(%.2f,%.2f,%.2f,%.2f),"
+ "(%.2f,%.2f,%.2f,%.2f),(%.2f,%.2f,%.2f,%.2f) };\n",
+ str,
+ matrix.m11(), matrix.m12(), matrix.m13(), matrix.m14(),
+ matrix.m21(), matrix.m22(), matrix.m23(), matrix.m24(),
+ matrix.m31(), matrix.m32(), matrix.m33(), matrix.m34(),
+ matrix.m41(), matrix.m42(), matrix.m43(), matrix.m44());
+}
+
+} // namespace WebCore
+
+#endif // USE(ACCELERATED_COMPOSITING)