| 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/compositing/PaintArtifactCompositor.h" | 5 #include "platform/graphics/compositing/PaintArtifactCompositor.h" |
| 6 | 6 |
| 7 #include "cc/layers/content_layer_client.h" | 7 #include "cc/layers/content_layer_client.h" |
| 8 #include "cc/layers/layer.h" | 8 #include "cc/layers/layer.h" |
| 9 #include "cc/layers/picture_layer.h" | 9 #include "cc/layers/picture_layer.h" |
| 10 #include "cc/playback/display_item_list.h" | 10 #include "cc/playback/display_item_list.h" |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 // TODO(jbroman): This assumes that the transform space of this node's | 174 // TODO(jbroman): This assumes that the transform space of this node's |
| 175 // parent is an ancestor of this node's transform space. That's not | 175 // parent is an ancestor of this node's transform space. That's not |
| 176 // necessarily true, and this should be fixed. | 176 // necessarily true, and this should be fixed. |
| 177 gfx::Transform transform = transformToTransformSpace(localTransformSpace(nod
e), localTransformSpace(node->parent())); | 177 gfx::Transform transform = transformToTransformSpace(localTransformSpace(nod
e), localTransformSpace(node->parent())); |
| 178 gfx::Vector2dF offset = clipRect.OffsetFromOrigin(); | 178 gfx::Vector2dF offset = clipRect.OffsetFromOrigin(); |
| 179 transform.Translate(offset.x(), offset.y()); | 179 transform.Translate(offset.x(), offset.y()); |
| 180 if (node->parent()) { | 180 if (node->parent()) { |
| 181 FloatPoint offsetDueToParentClipOffset = node->parent()->clipRect().rect
().location(); | 181 FloatPoint offsetDueToParentClipOffset = node->parent()->clipRect().rect
().location(); |
| 182 gfx::Transform undoClipOffset; | 182 gfx::Transform undoClipOffset; |
| 183 undoClipOffset.Translate(-offsetDueToParentClipOffset.x(), -offsetDueToP
arentClipOffset.y()); | 183 undoClipOffset.Translate(-offsetDueToParentClipOffset.x(), -offsetDueToP
arentClipOffset.y()); |
| 184 transform.PreconcatTransform(undoClipOffset); | 184 transform.ConcatTransform(undoClipOffset); |
| 185 } | 185 } |
| 186 | 186 |
| 187 scoped_refptr<cc::Layer> layer = cc::Layer::Create(); | 187 scoped_refptr<cc::Layer> layer = cc::Layer::Create(); |
| 188 layer->SetIsDrawable(false); | 188 layer->SetIsDrawable(false); |
| 189 layer->SetMasksToBounds(true); | 189 layer->SetMasksToBounds(true); |
| 190 layer->SetPosition(gfx::PointF()); | 190 layer->SetPosition(gfx::PointF()); |
| 191 layer->SetBounds(gfx::ToRoundedSize(clipRect.size())); | 191 layer->SetBounds(gfx::ToRoundedSize(clipRect.size())); |
| 192 layer->SetTransform(transform); | 192 layer->SetTransform(transform); |
| 193 return layer; | 193 return layer; |
| 194 } | 194 } |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 // parent's transform space). | 295 // parent's transform space). |
| 296 gfx::Vector2dF offset = gfx::PointF(combinedBounds.origin()).OffsetFromOrigi
n(); | 296 gfx::Vector2dF offset = gfx::PointF(combinedBounds.origin()).OffsetFromOrigi
n(); |
| 297 transform.Translate(offset.x(), offset.y()); | 297 transform.Translate(offset.x(), offset.y()); |
| 298 | 298 |
| 299 // If a clip was applied, its origin needs to be cancelled out in | 299 // If a clip was applied, its origin needs to be cancelled out in |
| 300 // this transform. | 300 // this transform. |
| 301 if (const auto* clip = paintChunk.properties.clip.get()) { | 301 if (const auto* clip = paintChunk.properties.clip.get()) { |
| 302 FloatPoint offsetDueToClipOffset = clip->clipRect().rect().location(); | 302 FloatPoint offsetDueToClipOffset = clip->clipRect().rect().location(); |
| 303 gfx::Transform undoClipOffset; | 303 gfx::Transform undoClipOffset; |
| 304 undoClipOffset.Translate(-offsetDueToClipOffset.x(), -offsetDueToClipOff
set.y()); | 304 undoClipOffset.Translate(-offsetDueToClipOffset.x(), -offsetDueToClipOff
set.y()); |
| 305 transform.PreconcatTransform(undoClipOffset); | 305 transform.ConcatTransform(undoClipOffset); |
| 306 } | 306 } |
| 307 | 307 |
| 308 scoped_refptr<cc::PictureLayer> layer = cc::PictureLayer::Create(contentLaye
rClient.get()); | 308 scoped_refptr<cc::PictureLayer> layer = cc::PictureLayer::Create(contentLaye
rClient.get()); |
| 309 layer->SetBounds(combinedBounds.size()); | 309 layer->SetBounds(combinedBounds.size()); |
| 310 layer->SetTransform(transform); | 310 layer->SetTransform(transform); |
| 311 layer->SetIsDrawable(true); | 311 layer->SetIsDrawable(true); |
| 312 layer->SetDoubleSided(!paintChunk.properties.backfaceHidden); | 312 layer->SetDoubleSided(!paintChunk.properties.backfaceHidden); |
| 313 if (paintChunk.knownToBeOpaque) | 313 if (paintChunk.knownToBeOpaque) |
| 314 layer->SetContentsOpaque(true); | 314 layer->SetContentsOpaque(true); |
| 315 m_contentLayerClients.append(contentLayerClient.release()); | 315 m_contentLayerClients.append(contentLayerClient.release()); |
| 316 return layer; | 316 return layer; |
| 317 } | 317 } |
| 318 | 318 |
| 319 | 319 |
| 320 } // namespace blink | 320 } // namespace blink |
| OLD | NEW |