Index: cc/tiles/picture_layer_tiling.h |
diff --git a/cc/tiles/picture_layer_tiling.h b/cc/tiles/picture_layer_tiling.h |
index 99e30d9f054c796c3a07999223931cfc26780c0a..eed20fcca61ce36ca4b059a17f29ea931f9cd23c 100644 |
--- a/cc/tiles/picture_layer_tiling.h |
+++ b/cc/tiles/picture_layer_tiling.h |
@@ -17,6 +17,7 @@ |
#include "base/macros.h" |
#include "cc/base/cc_export.h" |
#include "cc/base/region.h" |
+#include "cc/base/scale_translate2d.h" |
#include "cc/base/tiling_data.h" |
#include "cc/tiles/tile.h" |
#include "cc/tiles/tile_priority.h" |
@@ -81,7 +82,7 @@ class CC_EXPORT PictureLayerTiling { |
static const int kBorderTexels = 1; |
PictureLayerTiling(WhichTree tree, |
- const gfx::SizeF& raster_scales, |
+ const ScaleTranslate2d& raster_transform, |
scoped_refptr<RasterSource> raster_source, |
PictureLayerTilingClient* client, |
float min_preraster_distance, |
@@ -120,8 +121,10 @@ class CC_EXPORT PictureLayerTiling { |
gfx::Size tiling_size() const { return tiling_data_.tiling_size(); } |
gfx::Rect live_tiles_rect() const { return live_tiles_rect_; } |
gfx::Size tile_size() const { return tiling_data_.max_texture_size(); } |
- float contents_scale_key() const { return raster_scales_.width(); } |
- const gfx::SizeF& raster_scales() const { return raster_scales_; } |
+ float contents_scale_key() const { return raster_transform_.scale(); } |
+ const ScaleTranslate2d& raster_transform() const { |
+ return raster_transform_; |
+ } |
const TilingData* tiling_data() const { return &tiling_data_; } |
Tile* TileAt(int i, int j) const { |
@@ -165,9 +168,8 @@ class CC_EXPORT PictureLayerTiling { |
UpdateAndGetAllPrioritizedTilesForTesting() const; |
void SetAllTilesOccludedForTesting() { |
- gfx::Rect viewport_in_layer_space = ScaleToEnclosingRect( |
- current_visible_rect_, 1.f / raster_scales_.width(), |
- 1.f / raster_scales_.height()); |
+ gfx::Rect viewport_in_layer_space = |
+ EnclosingLayerRectFromContentsRect(current_visible_rect_); |
current_occlusion_in_layer_space_ = |
Occlusion(gfx::Transform(), |
SimpleEnclosedRegion(viewport_in_layer_space), |
@@ -181,7 +183,7 @@ class CC_EXPORT PictureLayerTiling { |
const gfx::Rect& skewport, |
const gfx::Rect& soon_border_rect, |
const gfx::Rect& eventually_rect) { |
- SetTilePriorityRects(gfx::SizeF(1.f, 1.f), visible_rect_in_content_space, |
+ SetTilePriorityRects(1.f, visible_rect_in_content_space, |
skewport, soon_border_rect, eventually_rect, |
Occlusion()); |
} |
@@ -219,7 +221,7 @@ class CC_EXPORT PictureLayerTiling { |
const PictureLayerTiling* tiling_ = nullptr; |
gfx::Size coverage_rect_max_bounds_; |
gfx::Rect coverage_rect_; |
- gfx::SizeF coverage_to_content_scale_; |
+ ScaleTranslate2d coverage_to_content_; |
Tile* current_tile_ = nullptr; |
gfx::Rect current_geometry_rect_; |
@@ -279,7 +281,7 @@ class CC_EXPORT PictureLayerTiling { |
bool TilingMatchesTileIndices(const PictureLayerTiling* twin) const; |
// Save the required data for computing tile priorities later. |
- void SetTilePriorityRects(const gfx::SizeF& content_to_screen_scale, |
+ void SetTilePriorityRects(float content_to_screen_scale, |
const gfx::Rect& visible_rect_in_content_space, |
const gfx::Rect& skewport, |
const gfx::Rect& soon_border_rect, |
@@ -327,8 +329,13 @@ class CC_EXPORT PictureLayerTiling { |
} |
void RemoveTilesInRegion(const Region& layer_region, bool recreate_tiles); |
+ gfx::Rect EnclosingContentsRectFromLayerRect( |
+ const gfx::Rect& layer_rect) const; |
+ gfx::Rect EnclosingLayerRectFromContentsRect( |
+ const gfx::Rect& contents_rect) const; |
+ |
// Given properties. |
- const gfx::SizeF raster_scales_; |
+ const ScaleTranslate2d raster_transform_; |
PictureLayerTilingClient* const client_; |
const WhichTree tree_; |
scoped_refptr<RasterSource> raster_source_; |
@@ -350,7 +357,7 @@ class CC_EXPORT PictureLayerTiling { |
gfx::Rect current_soon_border_rect_; |
gfx::Rect current_eventually_rect_; |
// Other properties used for tile iteration and prioritization. |
- gfx::SizeF current_content_to_screen_scale_; |
+ float current_content_to_screen_scale_ = 0.f; |
Occlusion current_occlusion_in_layer_space_; |
float max_skewport_extent_in_screen_space_ = 0.f; |