Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(469)

Side by Side Diff: Source/platform/graphics/GraphicsLayer.cpp

Issue 412123002: Rename WebAnimation to WebCompositorAnimation (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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;
62 using blink::WebCompositorAnimation;
63 using blink::WebFilterOperations;
64 using blink::WebLayer;
65 using blink::WebPoint;
66
61 namespace blink { 67 namespace blink {
62 68
63 typedef HashMap<const GraphicsLayer*, Vector<FloatRect> > RepaintMap; 69 typedef HashMap<const GraphicsLayer*, Vector<FloatRect> > RepaintMap;
64 static RepaintMap& repaintRectMap() 70 static RepaintMap& repaintRectMap()
65 { 71 {
66 DEFINE_STATIC_LOCAL(RepaintMap, map, ()); 72 DEFINE_STATIC_LOCAL(RepaintMap, map, ());
67 return map; 73 return map;
68 } 74 }
69 75
70 PassOwnPtr<GraphicsLayer> GraphicsLayer::create(GraphicsLayerFactory* factory, G raphicsLayerClient* client) 76 PassOwnPtr<GraphicsLayer> GraphicsLayer::create(GraphicsLayerFactory* factory, G raphicsLayerClient* client)
(...skipping 868 matching lines...) Expand 10 before | Expand all | Expand 10 after
939 RefPtr<NativeImageSkia> nativeImage = image ? image->nativeImageForCurrentFr ame() : nullptr; 945 RefPtr<NativeImageSkia> nativeImage = image ? image->nativeImageForCurrentFr ame() : nullptr;
940 if (nativeImage) { 946 if (nativeImage) {
941 m_ninePatchLayer = adoptPtr(Platform::current()->compositorSupport()->cr eateNinePatchLayer()); 947 m_ninePatchLayer = adoptPtr(Platform::current()->compositorSupport()->cr eateNinePatchLayer());
942 m_ninePatchLayer->setBitmap(nativeImage->bitmap(), aperture); 948 m_ninePatchLayer->setBitmap(nativeImage->bitmap(), aperture);
943 m_ninePatchLayer->layer()->setOpaque(image->currentFrameKnownToBeOpaque( )); 949 m_ninePatchLayer->layer()->setOpaque(image->currentFrameKnownToBeOpaque( ));
944 registerContentsLayer(m_ninePatchLayer->layer()); 950 registerContentsLayer(m_ninePatchLayer->layer());
945 } 951 }
946 setContentsTo(m_ninePatchLayer ? m_ninePatchLayer->layer() : 0); 952 setContentsTo(m_ninePatchLayer ? m_ninePatchLayer->layer() : 0);
947 } 953 }
948 954
949 bool GraphicsLayer::addAnimation(PassOwnPtr<WebAnimation> popAnimation) 955 bool GraphicsLayer::addAnimation(PassOwnPtr<WebCompositorAnimation> popAnimation )
950 { 956 {
951 OwnPtr<WebAnimation> animation(popAnimation); 957 OwnPtr<WebCompositorAnimation> animation(popAnimation);
952 ASSERT(animation); 958 ASSERT(animation);
953 platformLayer()->setAnimationDelegate(this); 959 platformLayer()->setAnimationDelegate(this);
954 960
955 // 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.
956 platformLayer()->removeAnimation(animation->id(), animation->targetProperty( )); 962 platformLayer()->removeAnimation(animation->id(), animation->targetProperty( ));
957 return platformLayer()->addAnimation(animation.leakPtr()); 963 return platformLayer()->addAnimation(animation.leakPtr());
958 } 964 }
959 965
960 void GraphicsLayer::pauseAnimation(int animationId, double timeOffset) 966 void GraphicsLayer::pauseAnimation(int animationId, double timeOffset)
961 { 967 {
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
1020 else 1026 else
1021 m_layer->layer()->setScrollClient(this); 1027 m_layer->layer()->setScrollClient(this);
1022 } 1028 }
1023 1029
1024 void GraphicsLayer::paint(GraphicsContext& context, const IntRect& clip) 1030 void GraphicsLayer::paint(GraphicsContext& context, const IntRect& clip)
1025 { 1031 {
1026 paintGraphicsLayerContents(context, clip); 1032 paintGraphicsLayerContents(context, clip);
1027 } 1033 }
1028 1034
1029 1035
1030 void GraphicsLayer::notifyAnimationStarted(double monotonicTime, WebAnimation::T argetProperty) 1036 void GraphicsLayer::notifyAnimationStarted(double monotonicTime, WebCompositorAn imation::TargetProperty)
1031 { 1037 {
1032 if (m_client) 1038 if (m_client)
1033 m_client->notifyAnimationStarted(this, monotonicTime); 1039 m_client->notifyAnimationStarted(this, monotonicTime);
1034 } 1040 }
1035 1041
1036 void GraphicsLayer::notifyAnimationFinished(double, WebAnimation::TargetProperty ) 1042 void GraphicsLayer::notifyAnimationFinished(double, WebCompositorAnimation::Targ etProperty)
1037 { 1043 {
1038 // Do nothing. 1044 // Do nothing.
1039 } 1045 }
1040 1046
1041 void GraphicsLayer::didScroll() 1047 void GraphicsLayer::didScroll()
1042 { 1048 {
1043 if (m_scrollableArea) 1049 if (m_scrollableArea)
1044 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()));
1045 } 1051 }
1046 1052
1047 } // namespace blink 1053 } // namespace blink
1048 1054
1049 #ifndef NDEBUG 1055 #ifndef NDEBUG
1050 void showGraphicsLayerTree(const blink::GraphicsLayer* layer) 1056 void showGraphicsLayerTree(const blink::GraphicsLayer* layer)
1051 { 1057 {
1052 if (!layer) 1058 if (!layer)
1053 return; 1059 return;
1054 1060
1055 String output = layer->layerTreeAsText(blink::LayerTreeIncludesDebugInfo); 1061 String output = layer->layerTreeAsText(blink::LayerTreeIncludesDebugInfo);
1056 fprintf(stderr, "%s\n", output.utf8().data()); 1062 fprintf(stderr, "%s\n", output.utf8().data());
1057 } 1063 }
1058 #endif 1064 #endif
OLDNEW
« no previous file with comments | « Source/platform/graphics/GraphicsLayer.h ('k') | Source/platform/graphics/GraphicsLayerTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698