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

Unified Diff: ui/compositor/layer.cc

Issue 417943004: Use Surfaces to hold delegated renderer contents. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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 | « ui/compositor/layer.h ('k') | no next file » | 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 db40f77f4c1197e0c83e1d3fa89698a79d29110d..aa97a567251ee0b7d02bad03b1089c28a80ed3a6 100644
--- a/ui/compositor/layer.cc
+++ b/ui/compositor/layer.cc
@@ -17,6 +17,7 @@
#include "cc/layers/nine_patch_layer.h"
#include "cc/layers/picture_layer.h"
#include "cc/layers/solid_color_layer.h"
+#include "cc/layers/surface_layer.h"
#include "cc/layers/texture_layer.h"
#include "cc/output/copy_output_request.h"
#include "cc/output/delegated_frame_data.h"
@@ -496,6 +497,7 @@ void Layer::SwitchToLayer(scoped_refptr<cc::Layer> new_layer) {
solid_color_layer_ = NULL;
texture_layer_ = NULL;
delegated_renderer_layer_ = NULL;
+ surface_layer_ = NULL;
cc_layer_->AddLayerAnimationEventObserver(this);
for (size_t i = 0; i < children_.size(); ++i) {
@@ -564,6 +566,18 @@ void Layer::SetShowDelegatedContent(cc::DelegatedFrameProvider* frame_provider,
RecomputeDrawsContentAndUVRect();
}
+void Layer::SetShowSurface(cc::SurfaceId id, gfx::Size frame_size_in_dip) {
+ DCHECK_EQ(type_, LAYER_TEXTURED);
+
+ scoped_refptr<cc::SurfaceLayer> new_layer = cc::SurfaceLayer::Create();
+ new_layer->SetSurfaceId(id);
+ SwitchToLayer(new_layer);
+ surface_layer_ = new_layer;
+
+ frame_size_in_dip_ = frame_size_in_dip;
+ RecomputeDrawsContentAndUVRect();
+}
+
void Layer::SetShowPaintedContent() {
if (content_layer_.get())
return;
@@ -982,7 +996,7 @@ void Layer::RecomputeDrawsContentAndUVRect() {
static_cast<float>(size.width()) / frame_size_in_dip_.width(),
static_cast<float>(size.height()) / frame_size_in_dip_.height());
texture_layer_->SetUV(uv_top_left, uv_bottom_right);
- } else if (delegated_renderer_layer_.get()) {
+ } else if (delegated_renderer_layer_.get() || surface_layer_.get()) {
size.SetToMin(frame_size_in_dip_);
}
cc_layer_->SetBounds(size);
« no previous file with comments | « ui/compositor/layer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698