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

Side by Side Diff: cc/resources/tile.cc

Issue 183663003: cc: Add tiling raster tile iterators. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 months 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/resources/tile.h" 5 #include "cc/resources/tile.h"
6 6
7 #include <algorithm>
8
7 #include "cc/base/math_util.h" 9 #include "cc/base/math_util.h"
8 #include "cc/debug/traced_value.h" 10 #include "cc/debug/traced_value.h"
9 #include "cc/resources/tile_manager.h" 11 #include "cc/resources/tile_manager.h"
10 #include "third_party/khronos/GLES2/gl2.h" 12 #include "third_party/khronos/GLES2/gl2.h"
11 13
12 namespace cc { 14 namespace cc {
13 15
14 Tile::Id Tile::s_next_id_ = 0; 16 Tile::Id Tile::s_next_id_ = 0;
15 17
16 Tile::Tile(TileManager* tile_manager, 18 Tile::Tile(TileManager* tile_manager,
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 return res.PassAs<base::Value>(); 76 return res.PassAs<base::Value>();
75 } 77 }
76 78
77 size_t Tile::GPUMemoryUsageInBytes() const { 79 size_t Tile::GPUMemoryUsageInBytes() const {
78 size_t total_size = 0; 80 size_t total_size = 0;
79 for (int mode = 0; mode < NUM_RASTER_MODES; ++mode) 81 for (int mode = 0; mode < NUM_RASTER_MODES; ++mode)
80 total_size += managed_state_.tile_versions[mode].GPUMemoryUsageInBytes(); 82 total_size += managed_state_.tile_versions[mode].GPUMemoryUsageInBytes();
81 return total_size; 83 return total_size;
82 } 84 }
83 85
86 RasterMode Tile::DetermineRasterModeForTree(WhichTree tree) const {
87 return DetermineRasterModeForResolution(priority(tree).resolution);
88 }
89
90 RasterMode Tile::DetermineOverallRasterMode() const {
91 return DetermineRasterModeForResolution(managed_state_.resolution);
92 }
93
94 RasterMode Tile::DetermineRasterModeForResolution(
95 TileResolution resolution) const {
96 RasterMode current_mode = managed_state_.raster_mode;
97 RasterMode raster_mode = HIGH_QUALITY_RASTER_MODE;
98 if (resolution == LOW_RESOLUTION)
99 raster_mode = LOW_QUALITY_RASTER_MODE;
100 else if (can_use_lcd_text())
101 raster_mode = HIGH_QUALITY_RASTER_MODE;
102 else if (managed_state_.tile_versions[current_mode].has_text_ ||
103 !managed_state_.tile_versions[current_mode].IsReadyToDraw())
104 raster_mode = HIGH_QUALITY_NO_LCD_RASTER_MODE;
105
106 return std::min(raster_mode, current_mode);
107 }
108
84 } // namespace cc 109 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698