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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
45 layer_bounds_(layer_bounds), | 45 layer_bounds_(layer_bounds), |
46 resolution_(NON_IDEAL_RESOLUTION), | 46 resolution_(NON_IDEAL_RESOLUTION), |
47 client_(client), | 47 client_(client), |
48 tiling_data_(gfx::Size(), gfx::Size(), true), | 48 tiling_data_(gfx::Size(), gfx::Size(), true), |
49 last_source_frame_number_(0), | 49 last_source_frame_number_(0), |
50 last_impl_frame_time_(0.0) { | 50 last_impl_frame_time_(0.0) { |
51 gfx::Size content_bounds = | 51 gfx::Size content_bounds = |
52 gfx::ToCeiledSize(gfx::ScaleSize(layer_bounds, contents_scale)); | 52 gfx::ToCeiledSize(gfx::ScaleSize(layer_bounds, contents_scale)); |
53 gfx::Size tile_size = client_->CalculateTileSize(content_bounds); | 53 gfx::Size tile_size = client_->CalculateTileSize(content_bounds); |
54 | 54 |
55 DCHECK(!gfx::ToFlooredSize( | |
enne (OOO)
2013/05/03 07:00:57
Oh, good thought to put a check here.
| |
56 gfx::ScaleSize(layer_bounds, contents_scale)).IsEmpty()) << | |
57 "Tiling created with scale too small as contents become empty. " << | |
58 "Layer bounds: " << layer_bounds.ToString() << | |
59 "Contents scale: " << contents_scale; | |
60 | |
55 tiling_data_.SetTotalSize(content_bounds); | 61 tiling_data_.SetTotalSize(content_bounds); |
56 tiling_data_.SetMaxTextureSize(tile_size); | 62 tiling_data_.SetMaxTextureSize(tile_size); |
57 } | 63 } |
58 | 64 |
59 PictureLayerTiling::~PictureLayerTiling() { | 65 PictureLayerTiling::~PictureLayerTiling() { |
60 } | 66 } |
61 | 67 |
62 void PictureLayerTiling::SetClient(PictureLayerTilingClient* client) { | 68 void PictureLayerTiling::SetClient(PictureLayerTilingClient* client) { |
63 client_ = client; | 69 client_ = client; |
64 } | 70 } |
(...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
619 | 625 |
620 // If our delta is less then our event distance, we're done. | 626 // If our delta is less then our event distance, we're done. |
621 if (delta < event.distance) | 627 if (delta < event.distance) |
622 break; | 628 break; |
623 } | 629 } |
624 | 630 |
625 return gfx::Rect(origin_x, origin_y, width, height); | 631 return gfx::Rect(origin_x, origin_y, width, height); |
626 } | 632 } |
627 | 633 |
628 } // namespace cc | 634 } // namespace cc |
OLD | NEW |