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

Unified Diff: cc/layers/surface_layer.cc

Issue 719573003: Explicitly specify contents scale for SurfaceLayer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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
« no previous file with comments | « cc/layers/surface_layer.h ('k') | cc/layers/surface_layer_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/layers/surface_layer.cc
diff --git a/cc/layers/surface_layer.cc b/cc/layers/surface_layer.cc
index ee376aad4e025679bd5a137d44678edbe1180c27..ab6289ef4265d1b5a85ac275986fca0515a515bb 100644
--- a/cc/layers/surface_layer.cc
+++ b/cc/layers/surface_layer.cc
@@ -44,6 +44,7 @@ scoped_refptr<SurfaceLayer> SurfaceLayer::Create(
SurfaceLayer::SurfaceLayer(const SatisfyCallback& satisfy_callback,
const RequireCallback& require_callback)
: Layer(),
+ surface_scale_(1.f),
satisfy_callback_(satisfy_callback),
require_callback_(require_callback) {
}
@@ -53,10 +54,13 @@ SurfaceLayer::~SurfaceLayer() {
DCHECK(destroy_sequence_.is_null());
}
-void SurfaceLayer::SetSurfaceId(SurfaceId surface_id, const gfx::Size& size) {
+void SurfaceLayer::SetSurfaceId(SurfaceId surface_id,
+ float scale,
+ const gfx::Size& size) {
SatisfyDestroySequence();
surface_id_ = surface_id;
surface_size_ = size;
+ surface_scale_ = scale;
CreateNewDestroySequence();
UpdateDrawsContent(HasDrawableContent());
@@ -94,12 +98,8 @@ void SurfaceLayer::CalculateContentsScale(float ideal_contents_scale,
float* contents_scale_y,
gfx::Size* content_bounds) {
*content_bounds = surface_size_;
- *contents_scale_x =
- bounds().IsEmpty() ? 1.f : static_cast<float>(content_bounds->width()) /
- bounds().width();
- *contents_scale_y =
- bounds().IsEmpty() ? 1.f : static_cast<float>(content_bounds->height()) /
- bounds().height();
+ *contents_scale_x = surface_scale_;
+ *contents_scale_y = surface_scale_;
}
void SurfaceLayer::CreateNewDestroySequence() {
« no previous file with comments | « cc/layers/surface_layer.h ('k') | cc/layers/surface_layer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698