| 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 "platform/graphics/paint/PaintArtifactToSkCanvas.h" | 5 #include "platform/graphics/paint/PaintArtifactToSkCanvas.h" |
| 6 | 6 |
| 7 #include "platform/graphics/paint/ClipPaintPropertyNode.h" | 7 #include "platform/graphics/paint/ClipPaintPropertyNode.h" |
| 8 #include "platform/graphics/paint/DrawingDisplayItem.h" | 8 #include "platform/graphics/paint/DrawingDisplayItem.h" |
| 9 #include "platform/graphics/paint/EffectPaintPropertyNode.h" | 9 #include "platform/graphics/paint/EffectPaintPropertyNode.h" |
| 10 #include "platform/graphics/paint/PaintArtifact.h" | 10 #include "platform/graphics/paint/PaintArtifact.h" |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 TransformationMatrix localMatrix = currentSpace->matrix(); | 101 TransformationMatrix localMatrix = currentSpace->matrix(); |
| 102 localMatrix.applyTransformOrigin(currentSpace->origin()); | 102 localMatrix.applyTransformOrigin(currentSpace->origin()); |
| 103 matrix = localMatrix * matrix; | 103 matrix = localMatrix * matrix; |
| 104 } | 104 } |
| 105 return matrix; | 105 return matrix; |
| 106 } | 106 } |
| 107 | 107 |
| 108 void paintArtifactToSkCanvas(const PaintArtifact& artifact, SkCanvas* canvas) | 108 void paintArtifactToSkCanvas(const PaintArtifact& artifact, SkCanvas* canvas) |
| 109 { | 109 { |
| 110 SkAutoCanvasRestore restore(canvas, true); | 110 SkAutoCanvasRestore restore(canvas, true); |
| 111 const DisplayItemList& displayItems = artifact.displayItemList(); | 111 const DisplayItemList& displayItems = artifact.getDisplayItemList(); |
| 112 const EffectPaintPropertyNode* previousEffect = nullptr; | 112 const EffectPaintPropertyNode* previousEffect = nullptr; |
| 113 for (const PaintChunk& chunk : artifact.paintChunks()) { | 113 for (const PaintChunk& chunk : artifact.paintChunks()) { |
| 114 // Setup the canvas clip state first because it clobbers matrix state. | 114 // Setup the canvas clip state first because it clobbers matrix state. |
| 115 for (const ClipPaintPropertyNode* currentClipNode = chunk.properties.cli
p.get(); | 115 for (const ClipPaintPropertyNode* currentClipNode = chunk.properties.cli
p.get(); |
| 116 currentClipNode; currentClipNode = currentClipNode->parent()) { | 116 currentClipNode; currentClipNode = currentClipNode->parent()) { |
| 117 canvas->setMatrix(TransformationMatrix::toSkMatrix44(totalTransform(
currentClipNode->localTransformSpace()))); | 117 canvas->setMatrix(TransformationMatrix::toSkMatrix44(totalTransform(
currentClipNode->localTransformSpace()))); |
| 118 canvas->clipRRect(currentClipNode->clipRect()); | 118 canvas->clipRRect(currentClipNode->clipRect()); |
| 119 } | 119 } |
| 120 | 120 |
| 121 // Set the canvas state to match the paint properties. | 121 // Set the canvas state to match the paint properties. |
| (...skipping 16 matching lines...) Expand all Loading... |
| 138 | 138 |
| 139 PassRefPtr<SkPicture> paintArtifactToSkPicture(const PaintArtifact& artifact, co
nst SkRect& bounds) | 139 PassRefPtr<SkPicture> paintArtifactToSkPicture(const PaintArtifact& artifact, co
nst SkRect& bounds) |
| 140 { | 140 { |
| 141 SkPictureRecorder recorder; | 141 SkPictureRecorder recorder; |
| 142 SkCanvas* canvas = recorder.beginRecording(bounds); | 142 SkCanvas* canvas = recorder.beginRecording(bounds); |
| 143 paintArtifactToSkCanvas(artifact, canvas); | 143 paintArtifactToSkCanvas(artifact, canvas); |
| 144 return adoptRef(recorder.endRecordingAsPicture()); | 144 return adoptRef(recorder.endRecordingAsPicture()); |
| 145 } | 145 } |
| 146 | 146 |
| 147 } // namespace blink | 147 } // namespace blink |
| OLD | NEW |