Chromium Code Reviews| 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/picture_layer_impl.h" | 5 #include "cc/picture_layer_impl.h" |
| 6 | 6 |
| 7 #include "base/time.h" | |
| 7 #include "cc/layer_tree_host_impl.h" | 8 #include "cc/layer_tree_host_impl.h" |
| 8 #include "cc/math_util.h" | 9 #include "cc/math_util.h" |
| 9 #include "cc/quad_sink.h" | 10 #include "cc/quad_sink.h" |
| 10 #include "cc/tile_draw_quad.h" | 11 #include "cc/tile_draw_quad.h" |
| 11 | 12 |
| 12 namespace cc { | 13 namespace cc { |
| 13 | 14 |
| 14 PictureLayerImpl::PictureLayerImpl(int id) : | 15 PictureLayerImpl::PictureLayerImpl(int id) : |
| 15 LayerImpl(id), | 16 LayerImpl(id), |
| 16 tilings_(this) { | 17 tilings_(this), |
| 18 last_update_time_(0) { | |
| 17 } | 19 } |
| 18 | 20 |
| 19 PictureLayerImpl::~PictureLayerImpl() { | 21 PictureLayerImpl::~PictureLayerImpl() { |
| 20 } | 22 } |
| 21 | 23 |
| 22 const char* PictureLayerImpl::layerTypeAsString() const { | 24 const char* PictureLayerImpl::layerTypeAsString() const { |
| 23 return "PictureLayer"; | 25 return "PictureLayer"; |
| 24 } | 26 } |
| 25 | 27 |
| 26 void PictureLayerImpl::appendQuads(QuadSink& quadSink, | 28 void PictureLayerImpl::appendQuads(QuadSink& quadSink, |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 81 } | 83 } |
| 82 | 84 |
| 83 void PictureLayerImpl::didUpdateTransforms() { | 85 void PictureLayerImpl::didUpdateTransforms() { |
| 84 tilings_.SetLayerBounds(bounds()); | 86 tilings_.SetLayerBounds(bounds()); |
| 85 // TODO(enne): Add more tilings during pinch zoom. | 87 // TODO(enne): Add more tilings during pinch zoom. |
| 86 if (!tilings_.num_tilings()) { | 88 if (!tilings_.num_tilings()) { |
| 87 gfx::Size tile_size = layerTreeHostImpl()->settings().defaultTileSize; | 89 gfx::Size tile_size = layerTreeHostImpl()->settings().defaultTileSize; |
| 88 tilings_.AddTiling(contentsScaleX(), tile_size); | 90 tilings_.AddTiling(contentsScaleX(), tile_size); |
| 89 // TODO(enne): handle invalidations, create new tiles | 91 // TODO(enne): handle invalidations, create new tiles |
| 90 } | 92 } |
| 93 | |
| 94 gfx::Transform current_transform = screenSpaceTransform(); | |
| 95 double current_time = | |
| 96 (base::TimeTicks::Now() - base::TimeTicks()).InSecondsF(); | |
| 97 if (last_update_time_ != 0) { | |
|
epennerAtGoogle
2012/11/30 16:48:34
Should we move this condition into UpdateTilePrior
qinmin
2012/11/30 19:24:13
using timedelta 0 when this happens, so that we wo
| |
| 98 tilings_.UpdateTilePriorities(layerTreeHostImpl()->deviceViewportSize(), | |
| 99 contentsScaleX(), | |
|
danakj
2012/11/30 18:39:00
can you DCHECK that contentsScaleX() == contentsSc
qinmin
2012/11/30 19:24:13
Done.
| |
| 100 last_transform_, | |
| 101 current_transform, | |
| 102 current_time - last_update_time_); | |
| 103 } | |
| 104 last_transform_ = current_transform; | |
| 105 last_update_time_ = current_time; | |
| 91 } | 106 } |
| 92 | 107 |
| 93 scoped_refptr<Tile> PictureLayerImpl::CreateTile(PictureLayerTiling*, | 108 scoped_refptr<Tile> PictureLayerImpl::CreateTile(PictureLayerTiling*, |
| 94 gfx::Rect rect) { | 109 gfx::Rect rect) { |
| 95 TileManager* tile_manager = layerTreeHostImpl()->tileManager(); | 110 TileManager* tile_manager = layerTreeHostImpl()->tileManager(); |
| 96 | 111 |
| 97 return make_scoped_refptr(new Tile( | 112 return make_scoped_refptr(new Tile( |
| 98 tile_manager, | 113 tile_manager, |
| 99 &pile_, | 114 &pile_, |
| 100 rect.size(), | 115 rect.size(), |
| 101 GL_RGBA, | 116 GL_RGBA, |
| 102 rect)); | 117 rect)); |
| 103 } | 118 } |
| 104 | 119 |
| 105 void PictureLayerImpl::SyncFromActiveLayer(const PictureLayerImpl* other) { | 120 void PictureLayerImpl::SyncFromActiveLayer(const PictureLayerImpl* other) { |
| 106 tilings_.CloneFrom(other->tilings_); | 121 tilings_.CloneFrom(other->tilings_); |
| 107 } | 122 } |
| 108 | 123 |
| 109 } // namespace cc | 124 } // namespace cc |
| OLD | NEW |