| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2009 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 #include "SkMatrix44.h" | 31 #include "SkMatrix44.h" |
| 32 #include "platform/geometry/FloatRect.h" | 32 #include "platform/geometry/FloatRect.h" |
| 33 #include "platform/geometry/LayoutRect.h" | 33 #include "platform/geometry/LayoutRect.h" |
| 34 #include "platform/graphics/GraphicsLayerFactory.h" | 34 #include "platform/graphics/GraphicsLayerFactory.h" |
| 35 #include "platform/graphics/Image.h" | 35 #include "platform/graphics/Image.h" |
| 36 #include "platform/graphics/filters/SkiaImageFilterBuilder.h" | 36 #include "platform/graphics/filters/SkiaImageFilterBuilder.h" |
| 37 #include "platform/graphics/skia/NativeImageSkia.h" | 37 #include "platform/graphics/skia/NativeImageSkia.h" |
| 38 #include "platform/scroll/ScrollableArea.h" | 38 #include "platform/scroll/ScrollableArea.h" |
| 39 #include "platform/text/TextStream.h" | 39 #include "platform/text/TextStream.h" |
| 40 #include "public/platform/Platform.h" | 40 #include "public/platform/Platform.h" |
| 41 #include "public/platform/WebAnimation.h" | 41 #include "public/platform/WebCompositorAnimation.h" |
| 42 #include "public/platform/WebCompositorSupport.h" | 42 #include "public/platform/WebCompositorSupport.h" |
| 43 #include "public/platform/WebFilterOperations.h" | 43 #include "public/platform/WebFilterOperations.h" |
| 44 #include "public/platform/WebFloatPoint.h" | 44 #include "public/platform/WebFloatPoint.h" |
| 45 #include "public/platform/WebFloatRect.h" | 45 #include "public/platform/WebFloatRect.h" |
| 46 #include "public/platform/WebGraphicsLayerDebugInfo.h" | 46 #include "public/platform/WebGraphicsLayerDebugInfo.h" |
| 47 #include "public/platform/WebLayer.h" | 47 #include "public/platform/WebLayer.h" |
| 48 #include "public/platform/WebPoint.h" | 48 #include "public/platform/WebPoint.h" |
| 49 #include "public/platform/WebSize.h" | 49 #include "public/platform/WebSize.h" |
| 50 #include "wtf/CurrentTime.h" | 50 #include "wtf/CurrentTime.h" |
| 51 #include "wtf/HashMap.h" | 51 #include "wtf/HashMap.h" |
| 52 #include "wtf/HashSet.h" | 52 #include "wtf/HashSet.h" |
| 53 #include "wtf/text/WTFString.h" | 53 #include "wtf/text/WTFString.h" |
| 54 | 54 |
| 55 #include <algorithm> | 55 #include <algorithm> |
| 56 | 56 |
| 57 #ifndef NDEBUG | 57 #ifndef NDEBUG |
| 58 #include <stdio.h> | 58 #include <stdio.h> |
| 59 #endif | 59 #endif |
| 60 | 60 |
| 61 using blink::Platform; | 61 using blink::Platform; |
| 62 using blink::WebAnimation; | 62 using blink::WebCompositorAnimation; |
| 63 using blink::WebFilterOperations; | 63 using blink::WebFilterOperations; |
| 64 using blink::WebLayer; | 64 using blink::WebLayer; |
| 65 using blink::WebPoint; | 65 using blink::WebPoint; |
| 66 | 66 |
| 67 namespace blink { | 67 namespace blink { |
| 68 | 68 |
| 69 typedef HashMap<const GraphicsLayer*, Vector<FloatRect> > RepaintMap; | 69 typedef HashMap<const GraphicsLayer*, Vector<FloatRect> > RepaintMap; |
| 70 static RepaintMap& repaintRectMap() | 70 static RepaintMap& repaintRectMap() |
| 71 { | 71 { |
| 72 DEFINE_STATIC_LOCAL(RepaintMap, map, ()); | 72 DEFINE_STATIC_LOCAL(RepaintMap, map, ()); |
| (...skipping 945 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1018 RefPtr<NativeImageSkia> nativeImage = image ? image->nativeImageForCurrentFr
ame() : nullptr; | 1018 RefPtr<NativeImageSkia> nativeImage = image ? image->nativeImageForCurrentFr
ame() : nullptr; |
| 1019 if (nativeImage) { | 1019 if (nativeImage) { |
| 1020 m_ninePatchLayer = adoptPtr(Platform::current()->compositorSupport()->cr
eateNinePatchLayer()); | 1020 m_ninePatchLayer = adoptPtr(Platform::current()->compositorSupport()->cr
eateNinePatchLayer()); |
| 1021 m_ninePatchLayer->setBitmap(nativeImage->bitmap(), aperture); | 1021 m_ninePatchLayer->setBitmap(nativeImage->bitmap(), aperture); |
| 1022 m_ninePatchLayer->layer()->setOpaque(image->currentFrameKnownToBeOpaque(
)); | 1022 m_ninePatchLayer->layer()->setOpaque(image->currentFrameKnownToBeOpaque(
)); |
| 1023 registerContentsLayer(m_ninePatchLayer->layer()); | 1023 registerContentsLayer(m_ninePatchLayer->layer()); |
| 1024 } | 1024 } |
| 1025 setContentsTo(m_ninePatchLayer ? m_ninePatchLayer->layer() : 0); | 1025 setContentsTo(m_ninePatchLayer ? m_ninePatchLayer->layer() : 0); |
| 1026 } | 1026 } |
| 1027 | 1027 |
| 1028 bool GraphicsLayer::addAnimation(PassOwnPtr<WebAnimation> popAnimation) | 1028 bool GraphicsLayer::addAnimation(PassOwnPtr<WebCompositorAnimation> popAnimation
) |
| 1029 { | 1029 { |
| 1030 OwnPtr<WebAnimation> animation(popAnimation); | 1030 OwnPtr<WebCompositorAnimation> animation(popAnimation); |
| 1031 ASSERT(animation); | 1031 ASSERT(animation); |
| 1032 platformLayer()->setAnimationDelegate(this); | 1032 platformLayer()->setAnimationDelegate(this); |
| 1033 | 1033 |
| 1034 // Remove any existing animations with the same animation id and target prop
erty. | 1034 // Remove any existing animations with the same animation id and target prop
erty. |
| 1035 platformLayer()->removeAnimation(animation->id(), animation->targetProperty(
)); | 1035 platformLayer()->removeAnimation(animation->id(), animation->targetProperty(
)); |
| 1036 return platformLayer()->addAnimation(animation.leakPtr()); | 1036 return platformLayer()->addAnimation(animation.leakPtr()); |
| 1037 } | 1037 } |
| 1038 | 1038 |
| 1039 void GraphicsLayer::pauseAnimation(int animationId, double timeOffset) | 1039 void GraphicsLayer::pauseAnimation(int animationId, double timeOffset) |
| 1040 { | 1040 { |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1100 else | 1100 else |
| 1101 m_layer->layer()->setScrollClient(this); | 1101 m_layer->layer()->setScrollClient(this); |
| 1102 } | 1102 } |
| 1103 | 1103 |
| 1104 void GraphicsLayer::paint(GraphicsContext& context, const IntRect& clip) | 1104 void GraphicsLayer::paint(GraphicsContext& context, const IntRect& clip) |
| 1105 { | 1105 { |
| 1106 paintGraphicsLayerContents(context, clip); | 1106 paintGraphicsLayerContents(context, clip); |
| 1107 } | 1107 } |
| 1108 | 1108 |
| 1109 | 1109 |
| 1110 void GraphicsLayer::notifyAnimationStarted(double monotonicTime, WebAnimation::T
argetProperty) | 1110 void GraphicsLayer::notifyAnimationStarted(double monotonicTime, WebCompositorAn
imation::TargetProperty) |
| 1111 { | 1111 { |
| 1112 if (m_client) | 1112 if (m_client) |
| 1113 m_client->notifyAnimationStarted(this, monotonicTime); | 1113 m_client->notifyAnimationStarted(this, monotonicTime); |
| 1114 } | 1114 } |
| 1115 | 1115 |
| 1116 void GraphicsLayer::notifyAnimationFinished(double, WebAnimation::TargetProperty
) | 1116 void GraphicsLayer::notifyAnimationFinished(double, WebCompositorAnimation::Targ
etProperty) |
| 1117 { | 1117 { |
| 1118 // Do nothing. | 1118 // Do nothing. |
| 1119 } | 1119 } |
| 1120 | 1120 |
| 1121 void GraphicsLayer::didScroll() | 1121 void GraphicsLayer::didScroll() |
| 1122 { | 1122 { |
| 1123 if (m_scrollableArea) | 1123 if (m_scrollableArea) |
| 1124 m_scrollableArea->scrollToOffsetWithoutAnimation(m_scrollableArea->minim
umScrollPosition() + toIntSize(m_layer->layer()->scrollPosition())); | 1124 m_scrollableArea->scrollToOffsetWithoutAnimation(m_scrollableArea->minim
umScrollPosition() + toIntSize(m_layer->layer()->scrollPosition())); |
| 1125 } | 1125 } |
| 1126 | 1126 |
| 1127 } // namespace blink | 1127 } // namespace blink |
| 1128 | 1128 |
| 1129 #ifndef NDEBUG | 1129 #ifndef NDEBUG |
| 1130 void showGraphicsLayerTree(const blink::GraphicsLayer* layer) | 1130 void showGraphicsLayerTree(const blink::GraphicsLayer* layer) |
| 1131 { | 1131 { |
| 1132 if (!layer) | 1132 if (!layer) |
| 1133 return; | 1133 return; |
| 1134 | 1134 |
| 1135 String output = layer->layerTreeAsText(blink::LayerTreeIncludesDebugInfo); | 1135 String output = layer->layerTreeAsText(blink::LayerTreeIncludesDebugInfo); |
| 1136 fprintf(stderr, "%s\n", output.utf8().data()); | 1136 fprintf(stderr, "%s\n", output.utf8().data()); |
| 1137 } | 1137 } |
| 1138 #endif | 1138 #endif |
| OLD | NEW |