Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(59)

Side by Side Diff: third_party/WebKit/Source/platform/testing/PaintPrinters.cpp

Issue 1390933003: Implement the framework for the paint property hierarchy (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "config.h" 5 #include "config.h"
6 #include "platform/testing/PaintPrinters.h" 6 #include "platform/testing/PaintPrinters.h"
7 7
8 #include "platform/graphics/paint/PaintChunk.h" 8 #include "platform/graphics/paint/PaintChunk.h"
9 #include "platform/graphics/paint/PaintProperties.h" 9 #include "platform/graphics/paint/PaintProperties.h"
10 #include "platform/graphics/paint/TransformPaintProperty.h"
11
10 #include <ostream> // NOLINT 12 #include <ostream> // NOLINT
11 13
12 namespace blink { 14 namespace blink {
13 15
14 void PrintTo(const PaintChunk& chunk, std::ostream* os) 16 void PrintTo(const PaintChunk& chunk, std::ostream* os)
15 { 17 {
16 *os << "PaintChunk(begin=" << chunk.beginIndex 18 *os << "PaintChunk(begin=" << chunk.beginIndex
17 << ", end=" << chunk.endIndex 19 << ", end=" << chunk.endIndex
18 << ", props="; 20 << ", props=";
19 PrintTo(chunk.properties, os); 21 PrintTo(chunk.properties, os);
20 *os << ")"; 22 *os << ")";
21 } 23 }
22 24
23 void PrintTo(const PaintProperties& properties, std::ostream* os) 25 void PrintTo(const PaintProperties& properties, std::ostream* os)
24 { 26 {
25 *os << "PaintProperties()"; 27 *os << "PaintProperties(";
28 if (properties.transform) {
29 *os << "transform=";
30 PrintTo(*properties.transform, os);
31 }
32 *os << ")";
33 }
34
35 // TODO(pdr): Create and move this to TransformPrinters.cpp.
36 static void PrintTo(const TransformationMatrix& matrix, std::ostream* os)
37 {
38 TransformationMatrix::DecomposedType decomposition;
39 if (!matrix.decompose(decomposition)) {
40 *os << "TransformationMatrix(degenerate)";
41 return;
42 }
43
44 if (matrix.isIdentityOrTranslation()) {
45 *os << "TransformationMatrix(translation=(" << decomposition.translateX << "," << decomposition.translateY << "," << decomposition.translateZ << "))";
46 return;
47 }
48
49 *os << "TransformationMatrix("
50 << "translation=(" << decomposition.translateX << "," << decomposition.t ranslateY << "," << decomposition.translateZ << ")"
51 << ", scale=(" << decomposition.scaleX << "," << decomposition.scaleY << "," << decomposition.scaleZ << ")"
52 << ", skew=(" << decomposition.skewXY << "," << decomposition.skewXZ << "," << decomposition.skewYZ << ")"
53 << ", quaternion=(" << decomposition.quaternionX << "," << decomposition .quaternionY << "," << decomposition.quaternionZ << "," << decomposition.quatern ionW << ")"
54 << ", perspective=(" << decomposition.perspectiveX << "," << decompositi on.perspectiveY << "," << decomposition.perspectiveZ << "," << decomposition.per spectiveW << ")"
55 << ")";
56 }
57
58 void PrintTo(const TransformPaintProperty& transformPaintProperty, std::ostream* os)
59 {
60 *os << "TransformPaintProperty(matrix=";
61 PrintTo(transformPaintProperty.matrix(), os);
62 *os << ", origin=";
63 PrintTo(transformPaintProperty.origin(), os);
64 *os << ")";
26 } 65 }
27 66
28 } // namespace blink 67 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698