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

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: move all the math from picture_layer_tiling to tile_prority 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 outside_bottom_edge && useAA); 76 outside_bottom_edge && useAA);
75 quadSink.append(quad.PassAs<DrawQuad>(), appendQuadsData); 77 quadSink.append(quad.PassAs<DrawQuad>(), appendQuadsData);
76 } 78 }
77 } 79 }
78 80
79 void PictureLayerImpl::dumpLayerProperties(std::string*, int indent) const { 81 void PictureLayerImpl::dumpLayerProperties(std::string*, int indent) const {
80 // TODO(enne): implement me 82 // TODO(enne): implement me
81 } 83 }
82 84
83 void PictureLayerImpl::didUpdateTransforms() { 85 void PictureLayerImpl::didUpdateTransforms() {
86 DCHECK(contentsScaleX() == contentsScaleY());
84 tilings_.SetLayerBounds(bounds()); 87 tilings_.SetLayerBounds(bounds());
85 // TODO(enne): Add more tilings during pinch zoom. 88 // TODO(enne): Add more tilings during pinch zoom.
86 if (!tilings_.num_tilings()) { 89 if (!tilings_.num_tilings()) {
87 gfx::Size tile_size = layerTreeHostImpl()->settings().defaultTileSize; 90 gfx::Size tile_size = layerTreeHostImpl()->settings().defaultTileSize;
88 tilings_.AddTiling(contentsScaleX(), tile_size); 91 tilings_.AddTiling(contentsScaleX(), tile_size);
89 // TODO(enne): handle invalidations, create new tiles 92 // TODO(enne): handle invalidations, create new tiles
90 } 93 }
94
95 gfx::Transform current_screen_space_transform = screenSpaceTransform();
96 double current_time =
97 (base::TimeTicks::Now() - base::TimeTicks()).InSecondsF();
98 double time_delta =
99 (last_update_time_ == 0 ? 0 : current_time - last_update_time_);
100 tilings_.UpdateTilePriorities(layerTreeHostImpl()->deviceViewportSize(),
101 contentsScaleX(),
102 last_screen_space_transform_,
103 current_screen_space_transform,
104 time_delta);
105
106 last_screen_space_transform_ = current_screen_space_transform;
107 last_update_time_ = current_time;
91 } 108 }
92 109
93 scoped_refptr<Tile> PictureLayerImpl::CreateTile(PictureLayerTiling*, 110 scoped_refptr<Tile> PictureLayerImpl::CreateTile(PictureLayerTiling*,
94 gfx::Rect rect) { 111 gfx::Rect rect) {
95 TileManager* tile_manager = layerTreeHostImpl()->tileManager(); 112 TileManager* tile_manager = layerTreeHostImpl()->tileManager();
96 113
97 return make_scoped_refptr(new Tile( 114 return make_scoped_refptr(new Tile(
98 tile_manager, 115 tile_manager,
99 &pile_, 116 &pile_,
100 rect.size(), 117 rect.size(),
101 GL_RGBA, 118 GL_RGBA,
102 rect)); 119 rect));
103 } 120 }
104 121
105 void PictureLayerImpl::SyncFromActiveLayer(const PictureLayerImpl* other) { 122 void PictureLayerImpl::SyncFromActiveLayer(const PictureLayerImpl* other) {
106 tilings_.CloneFrom(other->tilings_); 123 tilings_.CloneFrom(other->tilings_);
107 } 124 }
108 125
109 } // namespace cc 126 } // 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