| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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/resources/picture_layer_tiling.h" | 5 #include "cc/resources/picture_layer_tiling.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <cmath> | 8 #include <cmath> |
| 9 | 9 |
| 10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 : contents_scale_(contents_scale), | 35 : contents_scale_(contents_scale), |
| 36 layer_bounds_(layer_bounds), | 36 layer_bounds_(layer_bounds), |
| 37 resolution_(NON_IDEAL_RESOLUTION), | 37 resolution_(NON_IDEAL_RESOLUTION), |
| 38 client_(client), | 38 client_(client), |
| 39 tiling_data_(gfx::Size(), gfx::Size(), true), | 39 tiling_data_(gfx::Size(), gfx::Size(), true), |
| 40 last_impl_frame_time_in_seconds_(0.0) { | 40 last_impl_frame_time_in_seconds_(0.0) { |
| 41 gfx::Size content_bounds = | 41 gfx::Size content_bounds = |
| 42 gfx::ToCeiledSize(gfx::ScaleSize(layer_bounds, contents_scale)); | 42 gfx::ToCeiledSize(gfx::ScaleSize(layer_bounds, contents_scale)); |
| 43 gfx::Size tile_size = client_->CalculateTileSize(content_bounds); | 43 gfx::Size tile_size = client_->CalculateTileSize(content_bounds); |
| 44 | 44 |
| 45 DCHECK(!gfx::ToFlooredSize( |
| 46 gfx::ScaleSize(layer_bounds, contents_scale)).IsEmpty()) << |
| 47 "Tiling created with scale too small as contents become empty. " << |
| 48 "Layer bounds: " << layer_bounds.ToString() << |
| 49 "Contents scale: " << contents_scale; |
| 50 |
| 45 tiling_data_.SetTotalSize(content_bounds); | 51 tiling_data_.SetTotalSize(content_bounds); |
| 46 tiling_data_.SetMaxTextureSize(tile_size); | 52 tiling_data_.SetMaxTextureSize(tile_size); |
| 47 } | 53 } |
| 48 | 54 |
| 49 PictureLayerTiling::~PictureLayerTiling() { | 55 PictureLayerTiling::~PictureLayerTiling() { |
| 50 } | 56 } |
| 51 | 57 |
| 52 void PictureLayerTiling::SetClient(PictureLayerTilingClient* client) { | 58 void PictureLayerTiling::SetClient(PictureLayerTilingClient* client) { |
| 53 client_ = client; | 59 client_ = client; |
| 54 } | 60 } |
| (...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 600 | 606 |
| 601 // If our delta is less then our event distance, we're done. | 607 // If our delta is less then our event distance, we're done. |
| 602 if (delta < event.distance) | 608 if (delta < event.distance) |
| 603 break; | 609 break; |
| 604 } | 610 } |
| 605 | 611 |
| 606 return gfx::Rect(origin_x, origin_y, width, height); | 612 return gfx::Rect(origin_x, origin_y, width, height); |
| 607 } | 613 } |
| 608 | 614 |
| 609 } // namespace cc | 615 } // namespace cc |
| OLD | NEW |