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/resources/tile_manager.h" | 5 #include "cc/resources/tile_manager.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <limits> | 8 #include <limits> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 25 #include "third_party/skia/include/core/SkPixelRef.h" | 25 #include "third_party/skia/include/core/SkPixelRef.h" |
| 26 #include "ui/gfx/rect_conversions.h" | 26 #include "ui/gfx/rect_conversions.h" |
| 27 | 27 |
| 28 namespace cc { | 28 namespace cc { |
| 29 namespace { | 29 namespace { |
| 30 | 30 |
| 31 // Flag to indicate whether we should try and detect that | 31 // Flag to indicate whether we should try and detect that |
| 32 // a tile is of solid color. | 32 // a tile is of solid color. |
| 33 const bool kUseColorEstimator = true; | 33 const bool kUseColorEstimator = true; |
| 34 | 34 |
| 35 // Minimum width/height of a pile that would require analysis for tiles. | |
| 36 const int kMinSizeToAnalyze = 256; | |
|
alokp
2014/03/27 05:20:45
kMinLengthToAnalyze?
vmpstr
2014/03/27 17:02:53
Done.
| |
| 37 | |
| 35 class DisableLCDTextFilter : public SkDrawFilter { | 38 class DisableLCDTextFilter : public SkDrawFilter { |
| 36 public: | 39 public: |
| 37 // SkDrawFilter interface. | 40 // SkDrawFilter interface. |
| 38 virtual bool filter(SkPaint* paint, SkDrawFilter::Type type) OVERRIDE { | 41 virtual bool filter(SkPaint* paint, SkDrawFilter::Type type) OVERRIDE { |
| 39 if (type != SkDrawFilter::kText_Type) | 42 if (type != SkDrawFilter::kText_Type) |
| 40 return true; | 43 return true; |
| 41 | 44 |
| 42 paint->setLCDRenderText(false); | 45 paint->setLCDRenderText(false); |
| 43 return true; | 46 return true; |
| 44 } | 47 } |
| (...skipping 1111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1156 CreateImageDecodeTask(tile, pixel_ref); | 1159 CreateImageDecodeTask(tile, pixel_ref); |
| 1157 decode_tasks.push_back(decode_task); | 1160 decode_tasks.push_back(decode_task); |
| 1158 existing_pixel_refs[id] = decode_task; | 1161 existing_pixel_refs[id] = decode_task; |
| 1159 } | 1162 } |
| 1160 | 1163 |
| 1161 // We analyze picture before rasterization to detect solid-color tiles. | 1164 // We analyze picture before rasterization to detect solid-color tiles. |
| 1162 // If the tile is detected as such there is no need to raster or upload. | 1165 // If the tile is detected as such there is no need to raster or upload. |
| 1163 // It is drawn directly as a solid-color quad saving raster and upload cost. | 1166 // It is drawn directly as a solid-color quad saving raster and upload cost. |
| 1164 // The analysis step is however expensive and is not justified when doing | 1167 // The analysis step is however expensive and is not justified when doing |
| 1165 // gpu rasterization where there is no upload. | 1168 // gpu rasterization where there is no upload. |
| 1166 bool analyze_picture = !tile->use_gpu_rasterization(); | 1169 // |
| 1170 // Additionally, we do not want to do the analysis if the layer that produced | |
| 1171 // this tile is narrow, since more likely than not the tile would not be | |
|
alokp
2014/03/27 05:20:45
I do not get the connection between the tile being
vmpstr
2014/03/27 17:02:53
It definitely doesn't mean that it's not solid, bu
alokp
2014/03/27 17:45:16
I understand that it is just a heuristic and I am
| |
| 1172 // solid. | |
| 1173 gfx::Size pile_size = tile->picture_pile()->size(); | |
| 1174 bool analyze_picture = | |
| 1175 !tile->use_gpu_rasterization() && | |
| 1176 std::min(pile_size.width(), pile_size.height()) >= kMinSizeToAnalyze; | |
| 1167 | 1177 |
| 1168 return make_scoped_refptr(new RasterWorkerPoolTaskImpl( | 1178 return make_scoped_refptr(new RasterWorkerPoolTaskImpl( |
| 1169 const_resource, | 1179 const_resource, |
| 1170 tile->picture_pile(), | 1180 tile->picture_pile(), |
| 1171 tile->content_rect(), | 1181 tile->content_rect(), |
| 1172 tile->contents_scale(), | 1182 tile->contents_scale(), |
| 1173 mts.raster_mode, | 1183 mts.raster_mode, |
| 1174 mts.resolution, | 1184 mts.resolution, |
| 1175 tile->layer_id(), | 1185 tile->layer_id(), |
| 1176 static_cast<const void*>(tile), | 1186 static_cast<const void*>(tile), |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1330 } | 1340 } |
| 1331 } | 1341 } |
| 1332 } | 1342 } |
| 1333 | 1343 |
| 1334 TileManager::PairedPictureLayer::PairedPictureLayer() | 1344 TileManager::PairedPictureLayer::PairedPictureLayer() |
| 1335 : active_layer(NULL), pending_layer(NULL) {} | 1345 : active_layer(NULL), pending_layer(NULL) {} |
| 1336 | 1346 |
| 1337 TileManager::PairedPictureLayer::~PairedPictureLayer() {} | 1347 TileManager::PairedPictureLayer::~PairedPictureLayer() {} |
| 1338 | 1348 |
| 1339 } // namespace cc | 1349 } // namespace cc |
| OLD | NEW |