Skip to content

Commit

Permalink
[cc] Rename all cc/ filenames to Chromium style
Browse files Browse the repository at this point in the history
BUG=155413

Review URL: https://codereview.chromium.org/11122003

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@161671 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
enne@chromium.org committed Oct 12, 2012
1 parent 3fe7ba0 commit cd57cc5
Show file tree
Hide file tree
Showing 360 changed files with 10,502 additions and 10,109 deletions.
57 changes: 3 additions & 54 deletions cc/BitmapCanvasLayerTextureUpdater.h
Original file line number Diff line number Diff line change
@@ -1,57 +1,6 @@
// Copyright 2011 The Chromium Authors. All rights reserved.
// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.


#ifndef BitmapCanvasLayerTextureUpdater_h
#define BitmapCanvasLayerTextureUpdater_h

#if USE(ACCELERATED_COMPOSITING)

#include "CanvasLayerTextureUpdater.h"

class SkCanvas;

namespace cc {

class LayerPainterChromium;

// This class rasterizes the contentRect into a skia bitmap canvas. It then updates
// textures by copying from the canvas into the texture, using MapSubImage if
// possible.
class BitmapCanvasLayerTextureUpdater : public CanvasLayerTextureUpdater {
public:
class Texture : public LayerTextureUpdater::Texture {
public:
Texture(BitmapCanvasLayerTextureUpdater*, scoped_ptr<CCPrioritizedTexture>);
virtual ~Texture();

virtual void updateRect(CCResourceProvider*, const IntRect& sourceRect, const IntSize& destOffset) OVERRIDE;

private:
BitmapCanvasLayerTextureUpdater* textureUpdater() { return m_textureUpdater; }

BitmapCanvasLayerTextureUpdater* m_textureUpdater;
};

static PassRefPtr<BitmapCanvasLayerTextureUpdater> create(PassOwnPtr<LayerPainterChromium>);
virtual ~BitmapCanvasLayerTextureUpdater();

virtual PassOwnPtr<LayerTextureUpdater::Texture> createTexture(CCPrioritizedTextureManager*) OVERRIDE;
virtual SampledTexelFormat sampledTexelFormat(GC3Denum textureFormat) OVERRIDE;
virtual void prepareToUpdate(const IntRect& contentRect, const IntSize& tileSize, float contentsWidthScale, float contentsHeightScale, IntRect& resultingOpaqueRect, CCRenderingStats&) OVERRIDE;
void updateTextureRect(CCResourceProvider*, CCPrioritizedTexture*, const IntRect& sourceRect, const IntSize& destOffset);

virtual void setOpaque(bool) OVERRIDE;

protected:
explicit BitmapCanvasLayerTextureUpdater(PassOwnPtr<LayerPainterChromium>);

OwnPtr<SkCanvas> m_canvas;
IntSize m_canvasSize;
bool m_opaque;
};

} // namespace cc
#endif // USE(ACCELERATED_COMPOSITING)
#endif // BitmapCanvasLayerTextureUpdater_h
// Temporary forwarding header
#include "cc/bitmap_canvas_layer_texture_updater.h"
45 changes: 3 additions & 42 deletions cc/BitmapSkPictureCanvasLayerTextureUpdater.h
Original file line number Diff line number Diff line change
@@ -1,45 +1,6 @@
// Copyright 2011 The Chromium Authors. All rights reserved.
// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.


#ifndef BitmapSkPictureCanvasLayerTextureUpdater_h
#define BitmapSkPictureCanvasLayerTextureUpdater_h

#if USE(ACCELERATED_COMPOSITING)
#include "SkBitmap.h"
#include "SkPictureCanvasLayerTextureUpdater.h"

namespace cc {

// This class records the contentRect into an SkPicture, then software rasterizes
// the SkPicture into bitmaps for each tile. This implements CCSettings::perTilePainting.
class BitmapSkPictureCanvasLayerTextureUpdater : public SkPictureCanvasLayerTextureUpdater {
public:
class Texture : public CanvasLayerTextureUpdater::Texture {
public:
Texture(BitmapSkPictureCanvasLayerTextureUpdater*, scoped_ptr<CCPrioritizedTexture>);

virtual void prepareRect(const IntRect& sourceRect, CCRenderingStats&) OVERRIDE;
virtual void updateRect(CCResourceProvider*, const IntRect& sourceRect, const IntSize& destOffset) OVERRIDE;

private:
BitmapSkPictureCanvasLayerTextureUpdater* textureUpdater() { return m_textureUpdater; }

SkBitmap m_bitmap;
BitmapSkPictureCanvasLayerTextureUpdater* m_textureUpdater;
};

static PassRefPtr<BitmapSkPictureCanvasLayerTextureUpdater> create(PassOwnPtr<LayerPainterChromium>);
virtual ~BitmapSkPictureCanvasLayerTextureUpdater();

virtual PassOwnPtr<LayerTextureUpdater::Texture> createTexture(CCPrioritizedTextureManager*) OVERRIDE;
virtual SampledTexelFormat sampledTexelFormat(GC3Denum textureFormat) OVERRIDE;
void paintContentsRect(SkCanvas*, const IntRect& sourceRect, CCRenderingStats&);

private:
explicit BitmapSkPictureCanvasLayerTextureUpdater(PassOwnPtr<LayerPainterChromium>);
};
} // namespace cc
#endif // USE(ACCELERATED_COMPOSITING)
#endif // BitmapSkPictureCanvasLayerTextureUpdater_h
// Temporary forwarding header
#include "cc/bitmap_skpicture_canvas_layer_texture_updater.h"
159 changes: 2 additions & 157 deletions cc/CCActiveAnimation.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,160 +2,5 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CCActiveAnimation_h
#define CCActiveAnimation_h

#include "base/basictypes.h"
#include "base/memory/scoped_ptr.h"

namespace cc {

class CCAnimationCurve;

// A CCActiveAnimation, contains all the state required to play a CCAnimationCurve.
// Specifically, the affected property, the run state (paused, finished, etc.),
// loop count, last pause time, and the total time spent paused.
class CCActiveAnimation {
public:
// Animations begin in one of the 'waiting' states. Animations waiting for the next tick
// will start the next time the controller animates. Animations waiting for target
// availibility will run as soon as their target property is free (and all the animations
// animating with it are also able to run). Animations waiting for their start time to
// come have be scheduled to run at a particular point in time. When this time arrives,
// the controller will move the animations into the Running state. Running animations
// may toggle between Running and Paused, and may be stopped by moving into either the
// Aborted or Finished states. A Finished animation was allowed to run to completion, but
// an Aborted animation was not.
enum RunState {
WaitingForNextTick = 0,
WaitingForTargetAvailability,
WaitingForStartTime,
WaitingForDeletion,
Running,
Paused,
Finished,
Aborted,
// This sentinel must be last.
RunStateEnumSize
};

enum TargetProperty {
Transform = 0,
Opacity,
// This sentinel must be last.
TargetPropertyEnumSize
};

static scoped_ptr<CCActiveAnimation> create(scoped_ptr<CCAnimationCurve>, int animationId, int groupId, TargetProperty);

virtual ~CCActiveAnimation();

int id() const { return m_id; }
int group() const { return m_group; }
TargetProperty targetProperty() const { return m_targetProperty; }

RunState runState() const { return m_runState; }
void setRunState(RunState, double monotonicTime);

// This is the number of times that the animation will play. If this
// value is zero the animation will not play. If it is negative, then
// the animation will loop indefinitely.
int iterations() const { return m_iterations; }
void setIterations(int n) { m_iterations = n; }

double startTime() const { return m_startTime; }
void setStartTime(double monotonicTime) { m_startTime = monotonicTime; }
bool hasSetStartTime() const { return m_startTime; }

double timeOffset() const { return m_timeOffset; }
void setTimeOffset(double monotonicTime) { m_timeOffset = monotonicTime; }

void suspend(double monotonicTime);
void resume(double monotonicTime);

// If alternatesDirection is true, on odd numbered iterations we reverse the curve.
bool alternatesDirection() const { return m_alternatesDirection; }
void setAlternatesDirection(bool alternates) { m_alternatesDirection = alternates; }

bool isFinishedAt(double monotonicTime) const;
bool isFinished() const { return m_runState == Finished
|| m_runState == Aborted
|| m_runState == WaitingForDeletion; }

CCAnimationCurve* curve() { return m_curve.get(); }
const CCAnimationCurve* curve() const { return m_curve.get(); }

// If this is true, even if the animation is running, it will not be tickable until
// it is given a start time. This is true for animations running on the main thread.
bool needsSynchronizedStartTime() const { return m_needsSynchronizedStartTime; }
void setNeedsSynchronizedStartTime(bool needsSynchronizedStartTime) { m_needsSynchronizedStartTime = needsSynchronizedStartTime; }

// Takes the given absolute time, and using the start time and the number
// of iterations, returns the relative time in the current iteration.
double trimTimeToCurrentIteration(double monotonicTime) const;

enum InstanceType {
ControllingInstance = 0,
NonControllingInstance
};

scoped_ptr<CCActiveAnimation> clone(InstanceType) const;
scoped_ptr<CCActiveAnimation> cloneAndInitialize(InstanceType, RunState initialRunState, double startTime) const;
bool isControllingInstance() const { return m_isControllingInstance; }

void pushPropertiesTo(CCActiveAnimation*) const;

private:
CCActiveAnimation(scoped_ptr<CCAnimationCurve>, int animationId, int groupId, TargetProperty);

scoped_ptr<CCAnimationCurve> m_curve;

// IDs are not necessarily unique.
int m_id;

// Animations that must be run together are called 'grouped' and have the same group id
// Grouped animations are guaranteed to start at the same time and no other animations
// may animate any of the group's target properties until all animations in the
// group have finished animating. Note: an active animation's group id and target
// property uniquely identify that animation.
int m_group;

TargetProperty m_targetProperty;
RunState m_runState;
int m_iterations;
double m_startTime;
bool m_alternatesDirection;

// The time offset effectively pushes the start of the animation back in time. This is
// used for resuming paused animations -- an animation is added with a non-zero time
// offset, causing the animation to skip ahead to the desired point in time.
double m_timeOffset;

bool m_needsSynchronizedStartTime;

// When an animation is suspended, it behaves as if it is paused and it also ignores
// all run state changes until it is resumed. This is used for testing purposes.
bool m_suspended;

// These are used in trimTimeToCurrentIteration to account for time
// spent while paused. This is not included in AnimationState since it
// there is absolutely no need for clients of this controller to know
// about these values.
double m_pauseTime;
double m_totalPausedTime;

// Animations lead dual lives. An active animation will be conceptually owned by
// two controllers, one on the impl thread and one on the main. In reality, there
// will be two separate CCActiveAnimation instances for the same animation. They
// will have the same group id and the same target property (these two values
// uniquely identify an animation). The instance on the impl thread is the instance
// that ultimately controls the values of the animating layer and so we will refer
// to it as the 'controlling instance'.
bool m_isControllingInstance;

DISALLOW_COPY_AND_ASSIGN(CCActiveAnimation);
};

} // namespace cc

#endif // CCActiveAnimation_h
// Temporary forwarding header
#include "cc/active_animation.h"
54 changes: 2 additions & 52 deletions cc/CCAnimationCurve.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,55 +2,5 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CCAnimationCurve_h
#define CCAnimationCurve_h

#include "base/memory/scoped_ptr.h"
#include <public/WebTransformationMatrix.h>

namespace cc {

class CCFloatAnimationCurve;
class CCTransformAnimationCurve;
class IntSize;
class TransformOperations;

// An animation curve is a function that returns a value given a time.
// There are currently only two types of curve, float and transform.
class CCAnimationCurve {
public:
enum Type { Float, Transform };

virtual ~CCAnimationCurve() { }

virtual double duration() const = 0;
virtual Type type() const = 0;
virtual scoped_ptr<CCAnimationCurve> clone() const = 0;

const CCFloatAnimationCurve* toFloatAnimationCurve() const;
const CCTransformAnimationCurve* toTransformAnimationCurve() const;
};

class CCFloatAnimationCurve : public CCAnimationCurve {
public:
virtual ~CCFloatAnimationCurve() { }

virtual float getValue(double t) const = 0;

// Partial CCAnimation implementation.
virtual Type type() const OVERRIDE;
};

class CCTransformAnimationCurve : public CCAnimationCurve {
public:
virtual ~CCTransformAnimationCurve() { }

virtual WebKit::WebTransformationMatrix getValue(double t) const = 0;

// Partial CCAnimation implementation.
virtual Type type() const OVERRIDE;
};

} // namespace cc

#endif // CCAnimation_h
// Temporary forwarding header
#include "cc/animation_curve.h"
35 changes: 2 additions & 33 deletions cc/CCAnimationEvents.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,36 +2,5 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CCAnimationEvents_h
#define CCAnimationEvents_h

#include <vector>

#include "CCActiveAnimation.h"

namespace cc {

struct CCAnimationEvent {
enum Type { Started, Finished };

CCAnimationEvent(Type type, int layerId, int groupId, CCActiveAnimation::TargetProperty targetProperty, double monotonicTime)
: type(type)
, layerId(layerId)
, groupId(groupId)
, targetProperty(targetProperty)
, monotonicTime(monotonicTime)
{
}

Type type;
int layerId;
int groupId;
CCActiveAnimation::TargetProperty targetProperty;
double monotonicTime;
};

typedef std::vector<CCAnimationEvent> CCAnimationEventsVector;

} // namespace cc

#endif // CCAnimationEvents_h
// Temporary forwarding header
#include "cc/animation_events.h"
Loading

0 comments on commit cd57cc5

Please sign in to comment.