Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(125)

Side by Side Diff: cc/picture_layer_impl.cc

Issue 11414238: implement the logic to set tile priorities based on current matrix (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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) {
98 tilings_.UpdateTilePriorities(layerTreeHostImpl()->deviceViewportSize(),
99 last_transform_,
100 current_transform,
101 current_time - last_update_time_);
102 }
103 last_transform_ = current_transform;
104 last_update_time_ = current_time;
91 } 105 }
92 106
93 scoped_refptr<Tile> PictureLayerImpl::CreateTile(PictureLayerTiling*, 107 scoped_refptr<Tile> PictureLayerImpl::CreateTile(PictureLayerTiling*,
94 gfx::Rect rect) { 108 gfx::Rect rect) {
95 TileManager* tile_manager = layerTreeHostImpl()->tileManager(); 109 TileManager* tile_manager = layerTreeHostImpl()->tileManager();
96 110
97 return make_scoped_refptr(new Tile( 111 return make_scoped_refptr(new Tile(
98 tile_manager, 112 tile_manager,
99 &pile_, 113 &pile_,
100 rect.size(), 114 rect.size(),
101 GL_RGBA, 115 GL_RGBA,
102 rect)); 116 rect));
103 } 117 }
104 118
105 void PictureLayerImpl::SyncFromActiveLayer(const PictureLayerImpl* other) { 119 void PictureLayerImpl::SyncFromActiveLayer(const PictureLayerImpl* other) {
106 tilings_.CloneFrom(other->tilings_); 120 tilings_.CloneFrom(other->tilings_);
107 } 121 }
108 122
109 } // namespace cc 123 } // namespace cc
OLDNEW
« no previous file with comments | « cc/picture_layer_impl.h ('k') | cc/picture_layer_tiling.h » ('j') | cc/picture_layer_tiling.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698