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

Unified Diff: mojo/services/native_viewport/viewport_surface.cc

Issue 534843002: Convert view manager to surfaces with uploading shim in client lib (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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
Index: mojo/services/native_viewport/viewport_surface.cc
diff --git a/mojo/services/native_viewport/viewport_surface.cc b/mojo/services/native_viewport/viewport_surface.cc
index 1ddff9b2f242a7ee1b830fe2c2006ef731af8737..562f6f2acda73a4e4f460060fedfff4e46ccb9b0 100644
--- a/mojo/services/native_viewport/viewport_surface.cc
+++ b/mojo/services/native_viewport/viewport_surface.cc
@@ -8,6 +8,7 @@
#include "cc/surfaces/surface_id_allocator.h"
#include "mojo/services/public/cpp/geometry/geometry_type_converters.h"
#include "mojo/services/public/cpp/surfaces/surfaces_type_converters.h"
+#include "mojo/services/public/cpp/surfaces/surfaces_utils.h"
#include "ui/gfx/transform.h"
namespace mojo {
@@ -43,7 +44,8 @@ void ViewportSurface::SetBounds(const gfx::Rect& bounds) {
return;
surface_->DestroySurface(SurfaceId::From(id_));
- BindSurfaceToNativeViewport();
+ if (widget_id_)
+ BindSurfaceToNativeViewport();
}
void ViewportSurface::SetChildId(cc::SurfaceId child_id) {
@@ -54,6 +56,7 @@ void ViewportSurface::SetChildId(cc::SurfaceId child_id) {
void ViewportSurface::OnSurfaceConnectionCreated(SurfacePtr surface,
uint32_t id_namespace) {
surface_ = surface.Pass();
+ surface_.set_client(this);
id_allocator_.reset(new cc::SurfaceIdAllocator(id_namespace));
if (widget_id_ != 0u)
BindSurfaceToNativeViewport();
@@ -87,24 +90,10 @@ void ViewportSurface::SubmitFrame() {
surface_quad->shared_quad_state_index = 0;
surface_quad->surface_quad_state = surface_quad_state.Pass();
- SharedQuadStatePtr sqs = SharedQuadState::New();
- sqs->content_to_target_transform = Transform::From(gfx::Transform());
- sqs->content_bounds = Size::From(bounds_.size());
- sqs->visible_content_rect = Rect::From(bounds_);
- sqs->clip_rect = Rect::From(bounds_);
- sqs->is_clipped = false;
- sqs->opacity = 1.0f;
- sqs->blend_mode = SkXfermode::SK_XFERMODE_kSrcOver_Mode;
- sqs->sorting_context_id = 1;
-
- PassPtr pass = Pass::New();
- pass->id = 1;
- pass->output_rect = Rect::From(bounds_);
- pass->damage_rect = Rect::From(bounds_);
- pass->transform_to_root_target = Transform::From(gfx::Transform());
- pass->has_transparent_background = false;
+ PassPtr pass = CreateDefaultPass(1, bounds_);
+
pass->quads.push_back(surface_quad.Pass());
- pass->shared_quad_states.push_back(sqs.Pass());
+ pass->shared_quad_states.push_back(CreateDefaultSQS(bounds_.size()));
FramePtr frame = Frame::New();
frame->passes.push_back(pass.Pass());

Powered by Google App Engine
This is Rietveld 408576698