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

Unified Diff: cc/picture_layer_tiling.cc

Issue 12383060: cc: Remove texture scaling and clear edge texels of a layer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase and expand base picture Created 7 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/picture_layer_tiling.h ('k') | cc/picture_pile.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/picture_layer_tiling.cc
diff --git a/cc/picture_layer_tiling.cc b/cc/picture_layer_tiling.cc
index e0a254448afade895486e60bc841371ad03ac949..e760e4aa3a6a588c3a3420ca5c9ff432f062938a 100644
--- a/cc/picture_layer_tiling.cc
+++ b/cc/picture_layer_tiling.cc
@@ -190,8 +190,7 @@ PictureLayerTiling::Iterator::Iterator(const PictureLayerTiling* tiling,
: tiling_(tiling),
dest_rect_(dest_rect),
current_tile_(NULL),
- dest_to_content_scale_x_(0),
- dest_to_content_scale_y_(0),
+ dest_to_content_scale_(0),
tile_i_(0),
tile_j_(0),
left_(0),
@@ -202,42 +201,17 @@ PictureLayerTiling::Iterator::Iterator(const PictureLayerTiling* tiling,
if (dest_rect_.IsEmpty())
return;
- float dest_to_content_scale = tiling_->contents_scale_ / dest_scale;
+ dest_to_content_scale_ = tiling_->contents_scale_ / dest_scale;
// This is the maximum size that the dest rect can be, given the content size.
gfx::Size dest_content_size = gfx::ToCeiledSize(gfx::ScaleSize(
tiling_->ContentRect().size(),
- 1 / dest_to_content_scale,
- 1 / dest_to_content_scale));
-
- // The last row/column of texels may not have full rasterization coverage,
- // which can happen if the ceiled content size does not equal the floored
- // content size. These texels will sample outside of the recording to
- // generate their pixels. Use the floored size here to ignore them.
- gfx::Size content_size_floor = gfx::ToFlooredSize(tiling->ContentSizeF());
- dest_to_content_scale_x_ = content_size_floor.width() /
- static_cast<float>(dest_content_size.width());
- dest_to_content_scale_y_ = content_size_floor.height() /
- static_cast<float>(dest_content_size.height());
-
- // It's possible that when drawing a quad with texel:pixel ratio < 1
- // GL_LINEAR will cause us to blend in invalid texels.
- // We stretch the content a little more to prevent sampling past the
- // middle of the last texel.
- if (layerDeviceAlignment == LayerAlignedToDevice){
- if (dest_to_content_scale_x_ < 1.0)
- dest_to_content_scale_x_ -= 0.5f / dest_content_size.width();
- if (dest_to_content_scale_y_ < 1.0)
- dest_to_content_scale_y_ -= 0.5f / dest_content_size.height();
- }
- else if (layerDeviceAlignment == LayerNotAlignedToDevice) {
- dest_to_content_scale_x_ -= 0.5f / dest_content_size.width();
- dest_to_content_scale_y_ -= 0.5f / dest_content_size.height();
- }
+ 1 / dest_to_content_scale_,
+ 1 / dest_to_content_scale_));
gfx::Rect content_rect =
gfx::ToEnclosingRect(gfx::ScaleRect(dest_rect_,
- dest_to_content_scale_x_,
- dest_to_content_scale_y_));
+ dest_to_content_scale_,
+ dest_to_content_scale_));
// IndexFromSrcCoord clamps to valid tile ranges, so it's necessary to
// check for non-intersection first.
content_rect.Intersect(gfx::Rect(tiling_->tiling_data_.total_size()));
@@ -286,8 +260,8 @@ PictureLayerTiling::Iterator& PictureLayerTiling::Iterator::operator++() {
gfx::Rect content_rect = tiling_->tiling_data_.TileBounds(tile_i_, tile_j_);
current_geometry_rect_ = gfx::ToEnclosingRect(
- gfx::ScaleRect(content_rect, 1 / dest_to_content_scale_x_,
- 1 / dest_to_content_scale_y_));
+ gfx::ScaleRect(content_rect, 1 / dest_to_content_scale_,
+ 1 / dest_to_content_scale_));
current_geometry_rect_.Intersect(dest_rect_);
@@ -336,8 +310,8 @@ gfx::RectF PictureLayerTiling::Iterator::texture_rect() const {
// Convert from dest space => content space => texture space.
gfx::RectF texture_rect(current_geometry_rect_);
- texture_rect.Scale(dest_to_content_scale_x_,
- dest_to_content_scale_y_);
+ texture_rect.Scale(dest_to_content_scale_,
+ dest_to_content_scale_);
texture_rect.Offset(-tex_origin.OffsetFromOrigin());
texture_rect.Intersect(tiling_->ContentRect());
« no previous file with comments | « cc/picture_layer_tiling.h ('k') | cc/picture_pile.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698