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

Unified Diff: ui/compositor/layer.cc

Issue 2514033002: Introducing SurfaceReferenceFactory (Closed)
Patch Set: rebase Created 4 years 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 | « ui/compositor/layer.h ('k') | ui/compositor/layer_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/compositor/layer.cc
diff --git a/ui/compositor/layer.cc b/ui/compositor/layer.cc
index ad04a6441759dfa7c3461e19a3b9967d16528cc3..eb8096256d26df29e595fdce9d89518582f64785 100644
--- a/ui/compositor/layer.cc
+++ b/ui/compositor/layer.cc
@@ -182,11 +182,9 @@ std::unique_ptr<Layer> Layer::Clone() const {
clone->SetAlphaShape(base::MakeUnique<SkRegion>(*alpha_shape_));
// cc::Layer state.
- if (surface_layer_ && surface_layer_->surface_id().is_valid()) {
- clone->SetShowSurface(
- surface_layer_->surface_id(), surface_layer_->satisfy_callback(),
- surface_layer_->require_callback(), surface_layer_->surface_size(),
- surface_layer_->surface_scale());
+ if (surface_layer_ && surface_layer_->surface_info().id().is_valid()) {
+ clone->SetShowSurface(surface_layer_->surface_info(),
+ surface_layer_->surface_reference_factory());
} else if (type_ == LAYER_SOLID_COLOR) {
clone->SetColor(GetTargetColor());
}
@@ -656,27 +654,23 @@ bool Layer::TextureFlipped() const {
}
void Layer::SetShowSurface(
- const cc::SurfaceId& surface_id,
- const cc::SurfaceLayer::SatisfyCallback& satisfy_callback,
- const cc::SurfaceLayer::RequireCallback& require_callback,
- const gfx::Size& surface_size_in_pixels,
- float scale) {
+ const cc::SurfaceInfo& surface_info,
+ scoped_refptr<cc::SurfaceReferenceFactory> ref_factory) {
DCHECK(type_ == LAYER_TEXTURED || type_ == LAYER_SOLID_COLOR);
scoped_refptr<cc::SurfaceLayer> new_layer =
- cc::SurfaceLayer::Create(satisfy_callback, require_callback);
- new_layer->SetSurfaceId(surface_id, scale, surface_size_in_pixels,
- false /* stretch_content_to_fill_bounds */);
+ cc::SurfaceLayer::Create(ref_factory);
+ new_layer->SetSurfaceInfo(surface_info,
+ false /* stretch_content_to_fill_bounds */);
SwitchToLayer(new_layer);
surface_layer_ = new_layer;
- frame_size_in_dip_ = gfx::ConvertSizeToDIP(scale, surface_size_in_pixels);
+ frame_size_in_dip_ = gfx::ConvertSizeToDIP(surface_info.device_scale_factor(),
+ surface_info.size_in_pixels());
RecomputeDrawsContentAndUVRect();
for (const auto& mirror : mirrors_) {
- mirror->dest()->SetShowSurface(surface_id, satisfy_callback,
- require_callback, surface_size_in_pixels,
- scale);
+ mirror->dest()->SetShowSurface(surface_info, ref_factory);
}
}
« no previous file with comments | « ui/compositor/layer.h ('k') | ui/compositor/layer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698