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/WebCompositorAnimation.h" | 41 #include "public/platform/WebAnimation.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::WebCompositorAnimation; | 62 using blink::WebAnimation; |
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 872 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
945 RefPtr<NativeImageSkia> nativeImage = image ? image->nativeImageForCurrentFr
ame() : nullptr; | 945 RefPtr<NativeImageSkia> nativeImage = image ? image->nativeImageForCurrentFr
ame() : nullptr; |
946 if (nativeImage) { | 946 if (nativeImage) { |
947 m_ninePatchLayer = adoptPtr(Platform::current()->compositorSupport()->cr
eateNinePatchLayer()); | 947 m_ninePatchLayer = adoptPtr(Platform::current()->compositorSupport()->cr
eateNinePatchLayer()); |
948 m_ninePatchLayer->setBitmap(nativeImage->bitmap(), aperture); | 948 m_ninePatchLayer->setBitmap(nativeImage->bitmap(), aperture); |
949 m_ninePatchLayer->layer()->setOpaque(image->currentFrameKnownToBeOpaque(
)); | 949 m_ninePatchLayer->layer()->setOpaque(image->currentFrameKnownToBeOpaque(
)); |
950 registerContentsLayer(m_ninePatchLayer->layer()); | 950 registerContentsLayer(m_ninePatchLayer->layer()); |
951 } | 951 } |
952 setContentsTo(m_ninePatchLayer ? m_ninePatchLayer->layer() : 0); | 952 setContentsTo(m_ninePatchLayer ? m_ninePatchLayer->layer() : 0); |
953 } | 953 } |
954 | 954 |
955 bool GraphicsLayer::addAnimation(PassOwnPtr<WebCompositorAnimation> popAnimation
) | 955 bool GraphicsLayer::addAnimation(PassOwnPtr<WebAnimation> popAnimation) |
956 { | 956 { |
957 OwnPtr<WebCompositorAnimation> animation(popAnimation); | 957 OwnPtr<WebAnimation> animation(popAnimation); |
958 ASSERT(animation); | 958 ASSERT(animation); |
959 platformLayer()->setAnimationDelegate(this); | 959 platformLayer()->setAnimationDelegate(this); |
960 | 960 |
961 // Remove any existing animations with the same animation id and target prop
erty. | 961 // Remove any existing animations with the same animation id and target prop
erty. |
962 platformLayer()->removeAnimation(animation->id(), animation->targetProperty(
)); | 962 platformLayer()->removeAnimation(animation->id(), animation->targetProperty(
)); |
963 return platformLayer()->addAnimation(animation.leakPtr()); | 963 return platformLayer()->addAnimation(animation.leakPtr()); |
964 } | 964 } |
965 | 965 |
966 void GraphicsLayer::pauseAnimation(int animationId, double timeOffset) | 966 void GraphicsLayer::pauseAnimation(int animationId, double timeOffset) |
967 { | 967 { |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1026 else | 1026 else |
1027 m_layer->layer()->setScrollClient(this); | 1027 m_layer->layer()->setScrollClient(this); |
1028 } | 1028 } |
1029 | 1029 |
1030 void GraphicsLayer::paint(GraphicsContext& context, const IntRect& clip) | 1030 void GraphicsLayer::paint(GraphicsContext& context, const IntRect& clip) |
1031 { | 1031 { |
1032 paintGraphicsLayerContents(context, clip); | 1032 paintGraphicsLayerContents(context, clip); |
1033 } | 1033 } |
1034 | 1034 |
1035 | 1035 |
1036 void GraphicsLayer::notifyAnimationStarted(double monotonicTime, WebCompositorAn
imation::TargetProperty) | 1036 void GraphicsLayer::notifyAnimationStarted(double monotonicTime, WebAnimation::T
argetProperty) |
1037 { | 1037 { |
1038 if (m_client) | 1038 if (m_client) |
1039 m_client->notifyAnimationStarted(this, monotonicTime); | 1039 m_client->notifyAnimationStarted(this, monotonicTime); |
1040 } | 1040 } |
1041 | 1041 |
1042 void GraphicsLayer::notifyAnimationFinished(double, WebCompositorAnimation::Targ
etProperty) | 1042 void GraphicsLayer::notifyAnimationFinished(double, WebAnimation::TargetProperty
) |
1043 { | 1043 { |
1044 // Do nothing. | 1044 // Do nothing. |
1045 } | 1045 } |
1046 | 1046 |
1047 void GraphicsLayer::didScroll() | 1047 void GraphicsLayer::didScroll() |
1048 { | 1048 { |
1049 if (m_scrollableArea) | 1049 if (m_scrollableArea) |
1050 m_scrollableArea->scrollToOffsetWithoutAnimation(m_scrollableArea->minim
umScrollPosition() + toIntSize(m_layer->layer()->scrollPosition())); | 1050 m_scrollableArea->scrollToOffsetWithoutAnimation(m_scrollableArea->minim
umScrollPosition() + toIntSize(m_layer->layer()->scrollPosition())); |
1051 } | 1051 } |
1052 | 1052 |
1053 } // namespace blink | 1053 } // namespace blink |
1054 | 1054 |
1055 #ifndef NDEBUG | 1055 #ifndef NDEBUG |
1056 void showGraphicsLayerTree(const blink::GraphicsLayer* layer) | 1056 void showGraphicsLayerTree(const blink::GraphicsLayer* layer) |
1057 { | 1057 { |
1058 if (!layer) | 1058 if (!layer) |
1059 return; | 1059 return; |
1060 | 1060 |
1061 String output = layer->layerTreeAsText(blink::LayerTreeIncludesDebugInfo); | 1061 String output = layer->layerTreeAsText(blink::LayerTreeIncludesDebugInfo); |
1062 fprintf(stderr, "%s\n", output.utf8().data()); | 1062 fprintf(stderr, "%s\n", output.utf8().data()); |
1063 } | 1063 } |
1064 #endif | 1064 #endif |
OLD | NEW |