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

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

Issue 1390123002: (WIP) Paint property hierarchy approach 1 of 2 (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
« no previous file with comments | « third_party/WebKit/Source/platform/testing/PaintPrinters.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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(transformIndex=" << properties.transformIndex << ")" ;
28 }
29
30 // TODO(pdr): Create and move this to TransformPrinters.cpp.
31 static void PrintTo(const TransformationMatrix& matrix, std::ostream* os)
32 {
33 TransformationMatrix::DecomposedType decomposition;
34 if (!matrix.decompose(decomposition)) {
35 *os << "TransformationMatrix(degenerate)";
36 return;
37 }
38
39 if (matrix.isIdentityOrTranslation()) {
40 *os << "TransformationMatrix(translation=(" << decomposition.translateX << "," << decomposition.translateY << "," << decomposition.translateZ << "))";
41 return;
42 }
43
44 *os << "TransformationMatrix("
45 << "translation=(" << decomposition.translateX << "," << decomposition.t ranslateY << "," << decomposition.translateZ << ")"
46 << ", scale=(" << decomposition.scaleX << "," << decomposition.scaleY << "," << decomposition.scaleZ << ")"
47 << ", skew=(" << decomposition.skewXY << "," << decomposition.skewXZ << "," << decomposition.skewYZ << ")"
48 << ", quaternion=(" << decomposition.quaternionX << "," << decomposition .quaternionY << "," << decomposition.quaternionZ << "," << decomposition.quatern ionW << ")"
49 << ", perspective=(" << decomposition.perspectiveX << "," << decompositi on.perspectiveY << "," << decomposition.perspectiveZ << "," << decomposition.per spectiveW << ")"
50 << ")";
51 }
52
53 void PrintTo(const TransformPaintProperty& transformPaintProperty, std::ostream* os)
54 {
55 *os << "TransformPaintProperty(matrix=";
56 PrintTo(transformPaintProperty.matrix(), os);
57 *os << ", origin=";
58 PrintTo(transformPaintProperty.origin(), os);
59 *os << ")";
26 } 60 }
27 61
28 } // namespace blink 62 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/testing/PaintPrinters.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698