cc: Remove unused arguments from CalculateContentsScale
Layer::CalculateContentsScale and its overrides never use device_scale_factor, page_scale_factor, maximum_animation_contents_scale, or animating_transform_to_screen. This CL removes these arguments. BUG=None Review URL: https://codereview.chromium.org/453533002 Cr-Commit-Position: refs/heads/master@{#288197} git-svn-id: svn://svn.chromium.org/chrome/trunk/src@288197 0039d316-1c4b-4281-b951-d872f2087c98
This commit is contained in:
@ -22,10 +22,6 @@ ContentsScalingLayer::~ContentsScalingLayer() {
|
||||
|
||||
void ContentsScalingLayer::CalculateContentsScale(
|
||||
float ideal_contents_scale,
|
||||
float device_scale_factor,
|
||||
float page_scale_factor,
|
||||
float maximum_animation_contents_scale,
|
||||
bool animating_transform_to_screen,
|
||||
float* contents_scale_x,
|
||||
float* contents_scale_y,
|
||||
gfx::Size* content_bounds) {
|
||||
|
@ -15,10 +15,6 @@ namespace cc {
|
||||
class CC_EXPORT ContentsScalingLayer : public Layer {
|
||||
public:
|
||||
virtual void CalculateContentsScale(float ideal_contents_scale,
|
||||
float device_scale_factor,
|
||||
float page_scale_factor,
|
||||
float maximum_animation_contents_scale,
|
||||
bool animating_transform_to_screen,
|
||||
float* contents_scale_x,
|
||||
float* contents_scale_y,
|
||||
gfx::Size* content_bounds) OVERRIDE;
|
||||
|
@ -65,10 +65,6 @@ LayerUpdater* ImageLayer::Updater() const {
|
||||
}
|
||||
|
||||
void ImageLayer::CalculateContentsScale(float ideal_contents_scale,
|
||||
float device_scale_factor,
|
||||
float page_scale_factor,
|
||||
float maximum_animation_contents_scale,
|
||||
bool animating_transform_to_screen,
|
||||
float* contents_scale_x,
|
||||
float* contents_scale_y,
|
||||
gfx::Size* content_bounds) {
|
||||
|
@ -25,10 +25,6 @@ class CC_EXPORT ImageLayer : public TiledLayer {
|
||||
virtual bool Update(ResourceUpdateQueue* queue,
|
||||
const OcclusionTracker<Layer>* occlusion) OVERRIDE;
|
||||
virtual void CalculateContentsScale(float ideal_contents_scale,
|
||||
float device_scale_factor,
|
||||
float page_scale_factor,
|
||||
float maximum_animation_contents_scale,
|
||||
bool animating_transform_to_screen,
|
||||
float* contents_scale_x,
|
||||
float* contents_scale_y,
|
||||
gfx::Size* content_bounds) OVERRIDE;
|
||||
|
@ -396,10 +396,6 @@ SkColor Layer::SafeOpaqueBackgroundColor() const {
|
||||
}
|
||||
|
||||
void Layer::CalculateContentsScale(float ideal_contents_scale,
|
||||
float device_scale_factor,
|
||||
float page_scale_factor,
|
||||
float maximum_animation_contents_scale,
|
||||
bool animating_transform_to_screen,
|
||||
float* contents_scale_x,
|
||||
float* contents_scale_y,
|
||||
gfx::Size* content_bounds) {
|
||||
|
@ -381,10 +381,6 @@ class CC_EXPORT Layer : public base::RefCounted<Layer>,
|
||||
gfx::Size content_bounds() const { return draw_properties_.content_bounds; }
|
||||
|
||||
virtual void CalculateContentsScale(float ideal_contents_scale,
|
||||
float device_scale_factor,
|
||||
float page_scale_factor,
|
||||
float maximum_animation_contents_scale,
|
||||
bool animating_transform_to_screen,
|
||||
float* contents_scale_x,
|
||||
float* contents_scale_y,
|
||||
gfx::Size* content_bounds);
|
||||
|
@ -98,19 +98,11 @@ float PaintedScrollbarLayer::ClampScaleToMaxTextureSize(float scale) {
|
||||
|
||||
void PaintedScrollbarLayer::CalculateContentsScale(
|
||||
float ideal_contents_scale,
|
||||
float device_scale_factor,
|
||||
float page_scale_factor,
|
||||
float maximum_animation_contents_scale,
|
||||
bool animating_transform_to_screen,
|
||||
float* contents_scale_x,
|
||||
float* contents_scale_y,
|
||||
gfx::Size* content_bounds) {
|
||||
ContentsScalingLayer::CalculateContentsScale(
|
||||
ClampScaleToMaxTextureSize(ideal_contents_scale),
|
||||
device_scale_factor,
|
||||
page_scale_factor,
|
||||
maximum_animation_contents_scale,
|
||||
animating_transform_to_screen,
|
||||
contents_scale_x,
|
||||
contents_scale_y,
|
||||
content_bounds);
|
||||
|
@ -43,10 +43,6 @@ class CC_EXPORT PaintedScrollbarLayer : public ScrollbarLayerInterface,
|
||||
virtual void PushPropertiesTo(LayerImpl* layer) OVERRIDE;
|
||||
virtual void PushScrollClipPropertiesTo(LayerImpl* layer) OVERRIDE;
|
||||
virtual void CalculateContentsScale(float ideal_contents_scale,
|
||||
float device_scale_factor,
|
||||
float page_scale_factor,
|
||||
float maximum_animation_contents_scale,
|
||||
bool animating_transform_to_screen,
|
||||
float* contents_scale_x,
|
||||
float* contents_scale_y,
|
||||
gfx::Size* content_bounds) OVERRIDE;
|
||||
|
@ -114,10 +114,6 @@ PrioritizedResourceManager* FakeTiledLayer::ResourceManager() {
|
||||
|
||||
void FakeTiledLayer::UpdateContentsScale(float ideal_contents_scale) {
|
||||
CalculateContentsScale(ideal_contents_scale,
|
||||
1.f,
|
||||
1.f,
|
||||
1.f,
|
||||
false, // animating_transform_to_screen
|
||||
&draw_properties().contents_scale_x,
|
||||
&draw_properties().contents_scale_y,
|
||||
&draw_properties().content_bounds);
|
||||
@ -155,10 +151,6 @@ void FakeTiledLayerWithScaledBounds::SetContentBounds(
|
||||
|
||||
void FakeTiledLayerWithScaledBounds::CalculateContentsScale(
|
||||
float ideal_contents_scale,
|
||||
float device_scale_factor,
|
||||
float page_scale_factor,
|
||||
float maximum_animation_contents_scale,
|
||||
bool animating_transform_to_screen,
|
||||
float* contents_scale_x,
|
||||
float* contents_scale_y,
|
||||
gfx::Size* content_bounds) {
|
||||
|
@ -140,10 +140,6 @@ class FakeTiledLayerWithScaledBounds : public FakeTiledLayer {
|
||||
|
||||
void SetContentBounds(const gfx::Size& content_bounds);
|
||||
virtual void CalculateContentsScale(float ideal_contents_scale,
|
||||
float device_scale_factor,
|
||||
float page_scale_factor,
|
||||
float maximum_animation_contents_scale,
|
||||
bool animating_transform_to_screen,
|
||||
float* contents_scale_x,
|
||||
float* contents_scale_y,
|
||||
gfx::Size* content_bounds) OVERRIDE;
|
||||
|
@ -932,29 +932,14 @@ static inline void UpdateLayerScaleDrawProperties(
|
||||
layer->draw_properties().device_scale_factor = device_scale_factor;
|
||||
}
|
||||
|
||||
static inline void CalculateContentsScale(
|
||||
LayerImpl* layer,
|
||||
float contents_scale,
|
||||
float device_scale_factor,
|
||||
float page_scale_factor,
|
||||
float maximum_animation_contents_scale,
|
||||
bool animating_transform_to_screen) {
|
||||
static inline void CalculateContentsScale(LayerImpl* layer,
|
||||
float contents_scale) {
|
||||
// LayerImpl has all of its content scales and bounds pushed from the Main
|
||||
// thread during commit and just uses those values as-is.
|
||||
}
|
||||
|
||||
static inline void CalculateContentsScale(
|
||||
Layer* layer,
|
||||
float contents_scale,
|
||||
float device_scale_factor,
|
||||
float page_scale_factor,
|
||||
float maximum_animation_contents_scale,
|
||||
bool animating_transform_to_screen) {
|
||||
static inline void CalculateContentsScale(Layer* layer, float contents_scale) {
|
||||
layer->CalculateContentsScale(contents_scale,
|
||||
device_scale_factor,
|
||||
page_scale_factor,
|
||||
maximum_animation_contents_scale,
|
||||
animating_transform_to_screen,
|
||||
&layer->draw_properties().contents_scale_x,
|
||||
&layer->draw_properties().contents_scale_y,
|
||||
&layer->draw_properties().content_bounds);
|
||||
@ -963,10 +948,6 @@ static inline void CalculateContentsScale(
|
||||
if (mask_layer) {
|
||||
mask_layer->CalculateContentsScale(
|
||||
contents_scale,
|
||||
device_scale_factor,
|
||||
page_scale_factor,
|
||||
maximum_animation_contents_scale,
|
||||
animating_transform_to_screen,
|
||||
&mask_layer->draw_properties().contents_scale_x,
|
||||
&mask_layer->draw_properties().contents_scale_y,
|
||||
&mask_layer->draw_properties().content_bounds);
|
||||
@ -977,10 +958,6 @@ static inline void CalculateContentsScale(
|
||||
if (replica_mask_layer) {
|
||||
replica_mask_layer->CalculateContentsScale(
|
||||
contents_scale,
|
||||
device_scale_factor,
|
||||
page_scale_factor,
|
||||
maximum_animation_contents_scale,
|
||||
animating_transform_to_screen,
|
||||
&replica_mask_layer->draw_properties().contents_scale_x,
|
||||
&replica_mask_layer->draw_properties().contents_scale_y,
|
||||
&replica_mask_layer->draw_properties().content_bounds);
|
||||
@ -993,14 +970,8 @@ static inline void UpdateLayerContentsScale(
|
||||
float ideal_contents_scale,
|
||||
float device_scale_factor,
|
||||
float page_scale_factor,
|
||||
float maximum_animation_contents_scale,
|
||||
bool animating_transform_to_screen) {
|
||||
CalculateContentsScale(layer,
|
||||
ideal_contents_scale,
|
||||
device_scale_factor,
|
||||
page_scale_factor,
|
||||
maximum_animation_contents_scale,
|
||||
animating_transform_to_screen);
|
||||
CalculateContentsScale(layer, ideal_contents_scale);
|
||||
}
|
||||
|
||||
static inline void UpdateLayerContentsScale(
|
||||
@ -1009,7 +980,6 @@ static inline void UpdateLayerContentsScale(
|
||||
float ideal_contents_scale,
|
||||
float device_scale_factor,
|
||||
float page_scale_factor,
|
||||
float maximum_animation_contents_scale,
|
||||
bool animating_transform_to_screen) {
|
||||
if (can_adjust_raster_scale) {
|
||||
float ideal_raster_scale =
|
||||
@ -1042,12 +1012,7 @@ static inline void UpdateLayerContentsScale(
|
||||
float old_contents_scale_y = layer->contents_scale_y();
|
||||
|
||||
float contents_scale = raster_scale * device_scale_factor * page_scale_factor;
|
||||
CalculateContentsScale(layer,
|
||||
contents_scale,
|
||||
device_scale_factor,
|
||||
page_scale_factor,
|
||||
maximum_animation_contents_scale,
|
||||
animating_transform_to_screen);
|
||||
CalculateContentsScale(layer, contents_scale);
|
||||
|
||||
if (layer->content_bounds() != old_content_bounds ||
|
||||
layer->contents_scale_x() != old_contents_scale_x ||
|
||||
@ -1781,7 +1746,6 @@ static void CalculateDrawPropertiesInternal(
|
||||
data_from_ancestor.in_subtree_of_page_scale_application_layer
|
||||
? globals.page_scale_factor
|
||||
: 1.f,
|
||||
combined_maximum_animation_contents_scale,
|
||||
animating_transform_to_screen);
|
||||
|
||||
UpdateLayerScaleDrawProperties(
|
||||
|
@ -38,49 +38,16 @@ namespace {
|
||||
|
||||
class LayerWithForcedDrawsContent : public Layer {
|
||||
public:
|
||||
LayerWithForcedDrawsContent() : Layer(), last_device_scale_factor_(0.f) {}
|
||||
LayerWithForcedDrawsContent() {}
|
||||
|
||||
virtual bool DrawsContent() const OVERRIDE;
|
||||
virtual void CalculateContentsScale(float ideal_contents_scale,
|
||||
float device_scale_factor,
|
||||
float page_scale_factor,
|
||||
float maximum_animation_contents_scale,
|
||||
bool animating_transform_to_screen,
|
||||
float* contents_scale_x,
|
||||
float* contents_scale_y,
|
||||
gfx::Size* content_bounds) OVERRIDE;
|
||||
|
||||
float last_device_scale_factor() const { return last_device_scale_factor_; }
|
||||
|
||||
private:
|
||||
virtual ~LayerWithForcedDrawsContent() {}
|
||||
|
||||
// Parameters from last CalculateContentsScale.
|
||||
float last_device_scale_factor_;
|
||||
};
|
||||
|
||||
bool LayerWithForcedDrawsContent::DrawsContent() const { return true; }
|
||||
|
||||
void LayerWithForcedDrawsContent::CalculateContentsScale(
|
||||
float ideal_contents_scale,
|
||||
float device_scale_factor,
|
||||
float page_scale_factor,
|
||||
float maximum_animation_contents_scale,
|
||||
bool animating_transform_to_screen,
|
||||
float* contents_scale_x,
|
||||
float* contents_scale_y,
|
||||
gfx::Size* content_bounds) {
|
||||
last_device_scale_factor_ = device_scale_factor;
|
||||
Layer::CalculateContentsScale(ideal_contents_scale,
|
||||
device_scale_factor,
|
||||
page_scale_factor,
|
||||
maximum_animation_contents_scale,
|
||||
animating_transform_to_screen,
|
||||
contents_scale_x,
|
||||
contents_scale_y,
|
||||
content_bounds);
|
||||
}
|
||||
|
||||
class MockContentLayerClient : public ContentLayerClient {
|
||||
public:
|
||||
MockContentLayerClient() {}
|
||||
@ -1198,8 +1165,8 @@ TEST_F(LayerTreeHostCommonTest, TransformAboveRootLayer) {
|
||||
EXPECT_EQ(translate, root->draw_properties().target_space_transform);
|
||||
EXPECT_EQ(translate, child->draw_properties().target_space_transform);
|
||||
EXPECT_EQ(identity_matrix, root->render_surface()->draw_transform());
|
||||
EXPECT_EQ(1.f, root->last_device_scale_factor());
|
||||
EXPECT_EQ(1.f, child->last_device_scale_factor());
|
||||
EXPECT_EQ(1.f, root->draw_properties().device_scale_factor);
|
||||
EXPECT_EQ(1.f, child->draw_properties().device_scale_factor);
|
||||
}
|
||||
|
||||
gfx::Transform scale;
|
||||
@ -1213,8 +1180,8 @@ TEST_F(LayerTreeHostCommonTest, TransformAboveRootLayer) {
|
||||
EXPECT_EQ(scale, root->draw_properties().target_space_transform);
|
||||
EXPECT_EQ(scale, child->draw_properties().target_space_transform);
|
||||
EXPECT_EQ(identity_matrix, root->render_surface()->draw_transform());
|
||||
EXPECT_EQ(2.f, root->last_device_scale_factor());
|
||||
EXPECT_EQ(2.f, child->last_device_scale_factor());
|
||||
EXPECT_EQ(2.f, root->draw_properties().device_scale_factor);
|
||||
EXPECT_EQ(2.f, child->draw_properties().device_scale_factor);
|
||||
}
|
||||
|
||||
gfx::Transform rotate;
|
||||
@ -1228,8 +1195,8 @@ TEST_F(LayerTreeHostCommonTest, TransformAboveRootLayer) {
|
||||
EXPECT_EQ(rotate, root->draw_properties().target_space_transform);
|
||||
EXPECT_EQ(rotate, child->draw_properties().target_space_transform);
|
||||
EXPECT_EQ(identity_matrix, root->render_surface()->draw_transform());
|
||||
EXPECT_EQ(1.f, root->last_device_scale_factor());
|
||||
EXPECT_EQ(1.f, child->last_device_scale_factor());
|
||||
EXPECT_EQ(1.f, root->draw_properties().device_scale_factor);
|
||||
EXPECT_EQ(1.f, child->draw_properties().device_scale_factor);
|
||||
}
|
||||
|
||||
gfx::Transform composite;
|
||||
@ -1264,8 +1231,9 @@ TEST_F(LayerTreeHostCommonTest, TransformAboveRootLayer) {
|
||||
EXPECT_EQ(device_scaled_translate,
|
||||
child->draw_properties().target_space_transform);
|
||||
EXPECT_EQ(identity_matrix, root->render_surface()->draw_transform());
|
||||
EXPECT_EQ(device_scale_factor, root->last_device_scale_factor());
|
||||
EXPECT_EQ(device_scale_factor, child->last_device_scale_factor());
|
||||
EXPECT_EQ(device_scale_factor, root->draw_properties().device_scale_factor);
|
||||
EXPECT_EQ(device_scale_factor,
|
||||
child->draw_properties().device_scale_factor);
|
||||
}
|
||||
|
||||
// Verify it composes correctly with page scale.
|
||||
@ -1285,8 +1253,8 @@ TEST_F(LayerTreeHostCommonTest, TransformAboveRootLayer) {
|
||||
EXPECT_EQ(page_scaled_translate,
|
||||
child->draw_properties().target_space_transform);
|
||||
EXPECT_EQ(identity_matrix, root->render_surface()->draw_transform());
|
||||
EXPECT_EQ(1.f, root->last_device_scale_factor());
|
||||
EXPECT_EQ(1.f, child->last_device_scale_factor());
|
||||
EXPECT_EQ(1.f, root->draw_properties().device_scale_factor);
|
||||
EXPECT_EQ(1.f, child->draw_properties().device_scale_factor);
|
||||
}
|
||||
|
||||
// Verify that it composes correctly with transforms directly on root layer.
|
||||
@ -4049,19 +4017,11 @@ class NoScaleContentLayer : public ContentLayer {
|
||||
}
|
||||
|
||||
virtual void CalculateContentsScale(float ideal_contents_scale,
|
||||
float device_scale_factor,
|
||||
float page_scale_factor,
|
||||
float maximum_animation_contents_scale,
|
||||
bool animating_transform_to_screen,
|
||||
float* contents_scale_x,
|
||||
float* contents_scale_y,
|
||||
gfx::Size* content_bounds) OVERRIDE {
|
||||
// Skip over the ContentLayer to the base Layer class.
|
||||
Layer::CalculateContentsScale(ideal_contents_scale,
|
||||
device_scale_factor,
|
||||
page_scale_factor,
|
||||
maximum_animation_contents_scale,
|
||||
animating_transform_to_screen,
|
||||
contents_scale_x,
|
||||
contents_scale_y,
|
||||
content_bounds);
|
||||
|
@ -1050,19 +1050,11 @@ class NoScaleContentLayer : public ContentLayer {
|
||||
}
|
||||
|
||||
virtual void CalculateContentsScale(float ideal_contents_scale,
|
||||
float device_scale_factor,
|
||||
float page_scale_factor,
|
||||
float maximum_animation_contents_scale,
|
||||
bool animating_transform_to_screen,
|
||||
float* contents_scale_x,
|
||||
float* contents_scale_y,
|
||||
gfx::Size* contentBounds) OVERRIDE {
|
||||
// Skip over the ContentLayer's method to the base Layer class.
|
||||
Layer::CalculateContentsScale(ideal_contents_scale,
|
||||
device_scale_factor,
|
||||
page_scale_factor,
|
||||
maximum_animation_contents_scale,
|
||||
animating_transform_to_screen,
|
||||
contents_scale_x,
|
||||
contents_scale_y,
|
||||
contentBounds);
|
||||
|
Reference in New Issue
Block a user