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

Unified Diff: chrome/browser/android/compositor/layer/thumbnail_layer.cc

Issue 2499863002: Simplify content_layer attachment and viewporting logic. (Closed)
Patch Set: Fix clang error Created 4 years, 1 month 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
Index: chrome/browser/android/compositor/layer/thumbnail_layer.cc
diff --git a/chrome/browser/android/compositor/layer/thumbnail_layer.cc b/chrome/browser/android/compositor/layer/thumbnail_layer.cc
index 169f26c6708311c115d07e5b5ddadc451de65780..007a17b86a830b473fd75e8800cb6931a29e21c4 100644
--- a/chrome/browser/android/compositor/layer/thumbnail_layer.cc
+++ b/chrome/browser/android/compositor/layer/thumbnail_layer.cc
@@ -23,6 +23,8 @@ void ThumbnailLayer::SetThumbnail(Thumbnail* thumbnail) {
void ThumbnailLayer::Clip(const gfx::Rect& clipping) {
last_clipping_ = clipping;
+ clipped_ = true;
+
gfx::Size clipped_content = gfx::Size(content_size_.width() - clipping.x(),
content_size_.height() - clipping.y());
clipped_content.SetToMin(clipping.size());
@@ -36,6 +38,11 @@ void ThumbnailLayer::Clip(const gfx::Rect& clipping) {
(clipping.y() + clipped_content.height()) / resource_size_.height()));
}
+void ThumbnailLayer::ClearClip() {
+ layer_->SetUV(gfx::PointF(0.f, 0.f), gfx::PointF(1.f, 1.f));
+ clipped_ = false;
+}
+
void ThumbnailLayer::AddSelfToParentOrReplaceAt(scoped_refptr<cc::Layer> parent,
size_t index) {
if (index >= parent->children().size())
@@ -60,7 +67,8 @@ void ThumbnailLayer::UpdateSizes(const gfx::SizeF& content_size,
if (content_size != content_size_ || resource_size != resource_size_) {
content_size_ = content_size;
resource_size_ = resource_size;
- Clip(last_clipping_);
+ if (clipped_)
+ Clip(last_clipping_);
}
}

Powered by Google App Engine
This is Rietveld 408576698