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

Side by Side Diff: Source/core/animation/CompositorAnimations.h

Issue 51943004: Creating a helper class for reversing timing functions. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fixing "control reaches end of non-void function" issues. Created 7 years, 1 month 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
« no previous file with comments | « no previous file | Source/core/animation/CompositorAnimations.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google 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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 21 matching lines...) Expand all
32 #define CompositorAnimations_h 32 #define CompositorAnimations_h
33 33
34 #include "core/animation/Timing.h" 34 #include "core/animation/Timing.h"
35 #include "wtf/Vector.h" 35 #include "wtf/Vector.h"
36 36
37 namespace WebCore { 37 namespace WebCore {
38 38
39 class Element; 39 class Element;
40 class AnimationEffect; 40 class AnimationEffect;
41 41
42 // Given an input timing function between keyframe at 0 and keyframe at 1.0, we
43 // need a timing function such that the behavior with the keyframes swapped is
44 // equivalent to reversing time with the input timing function and keyframes.
45 // This means flipping the timing function about x=0.5 and about y=0.5.
46 // FIXME: Remove once the Compositor natively understands reversing time.
47 class CompositorAnimationsTimingFunctionReverser {
48 public:
49 static PassRefPtr<TimingFunction> reverse(const LinearTimingFunction* timefu nc);
50 static PassRefPtr<TimingFunction> reverse(const CubicBezierTimingFunction* t imefunc);
51 static PassRefPtr<TimingFunction> reverse(const ChainedTimingFunction* timef unc);
52 static PassRefPtr<TimingFunction> reverse(const TimingFunction* timefunc);
53 };
54
42 class CompositorAnimations { 55 class CompositorAnimations {
43 56
44 public: 57 public:
45 static CompositorAnimations* instance() { return instance(0); } 58 static CompositorAnimations* instance() { return instance(0); }
46 static void setInstanceForTesting(CompositorAnimations* newInstance) { insta nce(newInstance); } 59 static void setInstanceForTesting(CompositorAnimations* newInstance) { insta nce(newInstance); }
47 60
48 virtual bool isCandidateForCompositorAnimation(const Timing&, const Animatio nEffect*); 61 virtual bool isCandidateForCompositorAnimation(const Timing&, const Animatio nEffect*);
49 virtual bool canStartCompositorAnimation(const Element*); 62 virtual bool canStartCompositorAnimation(const Element*);
50 virtual void startCompositorAnimation(const Element*, const Timing&, const A nimationEffect*, Vector<int>& startedAnimationIds); 63 virtual void startCompositorAnimation(const Element*, const Timing&, const A nimationEffect*, Vector<int>& startedAnimationIds);
51 virtual void cancelCompositorAnimation(const Element*, int id); 64 virtual void cancelCompositorAnimation(const Element*, int id);
52 65
53 protected: 66 protected:
54 CompositorAnimations() { } 67 CompositorAnimations() { }
55 68
56 private: 69 private:
57 static CompositorAnimations* instance(CompositorAnimations* newInstance = 0) 70 static CompositorAnimations* instance(CompositorAnimations* newInstance = 0)
58 { 71 {
59 static CompositorAnimations* instance = new CompositorAnimations(); 72 static CompositorAnimations* instance = new CompositorAnimations();
60 if (newInstance) { 73 if (newInstance) {
61 instance = newInstance; 74 instance = newInstance;
62 } 75 }
63 return instance; 76 return instance;
64 } 77 }
65 }; 78 };
66 79
67 } // namespace WebCore 80 } // namespace WebCore
68 81
69 #endif 82 #endif
OLDNEW
« no previous file with comments | « no previous file | Source/core/animation/CompositorAnimations.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698