OLD | NEW |
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/graphics/paint/PaintArtifactToSkCanvas.h" | 6 #include "platform/graphics/paint/PaintArtifactToSkCanvas.h" |
7 | 7 |
8 #include "platform/graphics/paint/DisplayItem.h" | 8 #include "platform/graphics/paint/DisplayItem.h" |
9 #include "platform/graphics/paint/DrawingDisplayItem.h" | 9 #include "platform/graphics/paint/DrawingDisplayItem.h" |
10 #include "platform/graphics/paint/PaintArtifact.h" | 10 #include "platform/graphics/paint/PaintArtifact.h" |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 EXPECT_CALL(canvas, onDrawRect(client1.rect(), Property(&SkPaint::getCol
or, client1.color()), | 118 EXPECT_CALL(canvas, onDrawRect(client1.rect(), Property(&SkPaint::getCol
or, client1.color()), |
119 Pointee(Property(&SkCanvas::getTotalMatrix, adjustedScale)))); | 119 Pointee(Property(&SkCanvas::getTotalMatrix, adjustedScale)))); |
120 EXPECT_CALL(canvas, onDrawRect(client2.rect(), Property(&SkPaint::getCol
or, client2.color()), | 120 EXPECT_CALL(canvas, onDrawRect(client2.rect(), Property(&SkPaint::getCol
or, client2.color()), |
121 Pointee(Property(&SkCanvas::getTotalMatrix, combinedMatrix)))); | 121 Pointee(Property(&SkCanvas::getTotalMatrix, combinedMatrix)))); |
122 } | 122 } |
123 | 123 |
124 // Build the transform tree. | 124 // Build the transform tree. |
125 TransformationMatrix matrix1; | 125 TransformationMatrix matrix1; |
126 matrix1.scale(2); | 126 matrix1.scale(2); |
127 FloatPoint3D origin1(10, 10, 0); | 127 FloatPoint3D origin1(10, 10, 0); |
128 RefPtr<TransformPaintPropertyNode> transform1 = adoptRef(new TransformPaintP
ropertyNode(matrix1, origin1)); | 128 RefPtr<TransformPaintPropertyNode> transform1 = TransformPaintPropertyNode::
create(matrix1, origin1); |
129 TransformationMatrix matrix2; | 129 TransformationMatrix matrix2; |
130 matrix2.translate(5, 5); | 130 matrix2.translate(5, 5); |
131 RefPtr<TransformPaintPropertyNode> transform2 = adoptRef(new TransformPaintP
ropertyNode(matrix2, FloatPoint3D(), transform1.get())); | 131 RefPtr<TransformPaintPropertyNode> transform2 = TransformPaintPropertyNode::
create(matrix2, FloatPoint3D(), transform1.get()); |
132 | 132 |
133 // Build a two-chunk artifact directly. | 133 // Build a two-chunk artifact directly. |
134 PaintArtifact artifact; | 134 PaintArtifact artifact; |
135 | 135 |
136 artifact.displayItemList().allocateAndConstruct<DrawingDisplayItem>( | 136 artifact.displayItemList().allocateAndConstruct<DrawingDisplayItem>( |
137 client1, DisplayItem::DrawingFirst, client1.makePicture()); | 137 client1, DisplayItem::DrawingFirst, client1.makePicture()); |
138 PaintChunk chunk1(0, 1, PaintChunkProperties()); | 138 PaintChunk chunk1(0, 1, PaintChunkProperties()); |
139 chunk1.properties.transform = transform1.get(); | 139 chunk1.properties.transform = transform1.get(); |
140 artifact.paintChunks().append(chunk1); | 140 artifact.paintChunks().append(chunk1); |
141 | 141 |
142 artifact.displayItemList().allocateAndConstruct<DrawingDisplayItem>( | 142 artifact.displayItemList().allocateAndConstruct<DrawingDisplayItem>( |
143 client2, DisplayItem::DrawingFirst, client2.makePicture()); | 143 client2, DisplayItem::DrawingFirst, client2.makePicture()); |
144 PaintChunk chunk2(1, 2, PaintChunkProperties()); | 144 PaintChunk chunk2(1, 2, PaintChunkProperties()); |
145 chunk2.properties.transform = transform2.get(); | 145 chunk2.properties.transform = transform2.get(); |
146 artifact.paintChunks().append(chunk2); | 146 artifact.paintChunks().append(chunk2); |
147 | 147 |
148 paintArtifactToSkCanvas(artifact, &canvas); | 148 paintArtifactToSkCanvas(artifact, &canvas); |
149 } | 149 } |
150 | 150 |
151 } // namespace | 151 } // namespace |
152 } // namespace blink | 152 } // namespace blink |
OLD | NEW |