| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "cc/blink/web_layer_impl_fixed_bounds.h" | 5 #include "cc/blink/web_layer_impl_fixed_bounds.h" |
| 6 | 6 |
| 7 #include "cc/layers/layer.h" | 7 #include "cc/layers/layer.h" |
| 8 #include "third_party/WebKit/public/platform/WebFloatPoint.h" | 8 #include "third_party/WebKit/public/platform/WebFloatPoint.h" |
| 9 #include "third_party/WebKit/public/platform/WebSize.h" | 9 #include "third_party/WebKit/public/platform/WebSize.h" |
| 10 #include "third_party/skia/include/utils/SkMatrix44.h" | 10 #include "third_party/skia/include/utils/SkMatrix44.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 | 22 |
| 23 WebLayerImplFixedBounds::~WebLayerImplFixedBounds() { | 23 WebLayerImplFixedBounds::~WebLayerImplFixedBounds() { |
| 24 } | 24 } |
| 25 | 25 |
| 26 void WebLayerImplFixedBounds::invalidateRect(const blink::WebFloatRect& rect) { | 26 void WebLayerImplFixedBounds::invalidateRect(const blink::WebFloatRect& rect) { |
| 27 // Partial invalidations seldom occur for such layers. | 27 // Partial invalidations seldom occur for such layers. |
| 28 // Simply invalidate the whole layer to avoid transformation of coordinates. | 28 // Simply invalidate the whole layer to avoid transformation of coordinates. |
| 29 invalidate(); | 29 invalidate(); |
| 30 } | 30 } |
| 31 | 31 |
| 32 void WebLayerImplFixedBounds::invalidateRect(const blink::WebRect& rect) { |
| 33 // Partial invalidations seldom occur for such layers. |
| 34 // Simply invalidate the whole layer to avoid transformation of coordinates. |
| 35 invalidate(); |
| 36 } |
| 37 |
| 32 void WebLayerImplFixedBounds::setTransformOrigin( | 38 void WebLayerImplFixedBounds::setTransformOrigin( |
| 33 const blink::WebFloatPoint3D& transform_origin) { | 39 const blink::WebFloatPoint3D& transform_origin) { |
| 34 if (transform_origin != this->transformOrigin()) { | 40 if (transform_origin != this->transformOrigin()) { |
| 35 layer_->SetTransformOrigin(transform_origin); | 41 layer_->SetTransformOrigin(transform_origin); |
| 36 UpdateLayerBoundsAndTransform(); | 42 UpdateLayerBoundsAndTransform(); |
| 37 } | 43 } |
| 38 } | 44 } |
| 39 | 45 |
| 40 void WebLayerImplFixedBounds::setBounds(const blink::WebSize& bounds) { | 46 void WebLayerImplFixedBounds::setBounds(const blink::WebSize& bounds) { |
| 41 if (original_bounds_ != gfx::Size(bounds)) { | 47 if (original_bounds_ != gfx::Size(bounds)) { |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 gfx::Transform transform_with_bounds_scale(original_transform_); | 97 gfx::Transform transform_with_bounds_scale(original_transform_); |
| 92 float bounds_scale_x = | 98 float bounds_scale_x = |
| 93 static_cast<float>(original_bounds_.width()) / fixed_bounds_.width(); | 99 static_cast<float>(original_bounds_.width()) / fixed_bounds_.width(); |
| 94 float bounds_scale_y = | 100 float bounds_scale_y = |
| 95 static_cast<float>(original_bounds_.height()) / fixed_bounds_.height(); | 101 static_cast<float>(original_bounds_.height()) / fixed_bounds_.height(); |
| 96 transform_with_bounds_scale.Scale(bounds_scale_x, bounds_scale_y); | 102 transform_with_bounds_scale.Scale(bounds_scale_x, bounds_scale_y); |
| 97 layer_->SetTransform(transform_with_bounds_scale); | 103 layer_->SetTransform(transform_with_bounds_scale); |
| 98 } | 104 } |
| 99 | 105 |
| 100 } // namespace cc_blink | 106 } // namespace cc_blink |
| OLD | NEW |