| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/Transform3DDisplayItem.h" | 5 #include "platform/graphics/paint/Transform3DDisplayItem.h" |
| 6 | 6 |
| 7 #include "platform/graphics/GraphicsContext.h" | 7 #include "platform/graphics/GraphicsContext.h" |
| 8 #include "platform/transforms/AffineTransform.h" | 8 #include "platform/transforms/AffineTransform.h" |
| 9 #include "public/platform/WebDisplayItemList.h" | 9 #include "public/platform/WebDisplayItemList.h" |
| 10 | 10 |
| 11 namespace blink { | 11 namespace blink { |
| 12 | 12 |
| 13 void BeginTransform3DDisplayItem::Replay(GraphicsContext& context) const { | 13 void BeginTransform3DDisplayItem::Replay(GraphicsContext& context) const { |
| 14 TransformationMatrix transform(transform_); | 14 TransformationMatrix transform(transform_); |
| 15 transform.ApplyTransformOrigin(transform_origin_); | 15 transform.ApplyTransformOrigin(transform_origin_); |
| 16 context.Save(); | 16 context.Save(); |
| 17 context.ConcatCTM(transform.ToAffineTransform()); | 17 context.ConcatCTM(transform.ToAffineTransform()); |
| 18 } | 18 } |
| 19 | 19 |
| 20 void BeginTransform3DDisplayItem::AppendToWebDisplayItemList( | 20 void BeginTransform3DDisplayItem::AppendToWebDisplayItemList( |
| 21 const LayoutSize&, | 21 const IntRect& visual_rect, |
| 22 WebDisplayItemList* list) const { | 22 WebDisplayItemList* list) const { |
| 23 // TODO(jbroman): The compositor will need the transform origin separately. | 23 // TODO(jbroman): The compositor will need the transform origin separately. |
| 24 TransformationMatrix transform(transform_); | 24 TransformationMatrix transform(transform_); |
| 25 transform.ApplyTransformOrigin(transform_origin_); | 25 transform.ApplyTransformOrigin(transform_origin_); |
| 26 list->AppendTransformItem(TransformationMatrix::ToSkMatrix44(transform)); | 26 list->AppendTransformItem(TransformationMatrix::ToSkMatrix44(transform)); |
| 27 } | 27 } |
| 28 | 28 |
| 29 #ifndef NDEBUG | 29 #ifndef NDEBUG |
| 30 void BeginTransform3DDisplayItem::DumpPropertiesAsDebugString( | 30 void BeginTransform3DDisplayItem::DumpPropertiesAsDebugString( |
| 31 StringBuilder& string_builder) const { | 31 StringBuilder& string_builder) const { |
| (...skipping 17 matching lines...) Expand all Loading... |
| 49 String::Format(", transformOrigin: [%f,%f,%f]", transform_origin_.X(), | 49 String::Format(", transformOrigin: [%f,%f,%f]", transform_origin_.X(), |
| 50 transform_origin_.Y(), transform_origin_.Z())); | 50 transform_origin_.Y(), transform_origin_.Z())); |
| 51 } | 51 } |
| 52 #endif | 52 #endif |
| 53 | 53 |
| 54 void EndTransform3DDisplayItem::Replay(GraphicsContext& context) const { | 54 void EndTransform3DDisplayItem::Replay(GraphicsContext& context) const { |
| 55 context.Restore(); | 55 context.Restore(); |
| 56 } | 56 } |
| 57 | 57 |
| 58 void EndTransform3DDisplayItem::AppendToWebDisplayItemList( | 58 void EndTransform3DDisplayItem::AppendToWebDisplayItemList( |
| 59 const LayoutSize&, | 59 const IntRect& visual_rect, |
| 60 WebDisplayItemList* list) const { | 60 WebDisplayItemList* list) const { |
| 61 list->AppendEndTransformItem(); | 61 list->AppendEndTransformItem(); |
| 62 } | 62 } |
| 63 | 63 |
| 64 } // namespace blink | 64 } // namespace blink |
| OLD | NEW |