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

Side by Side Diff: android_webview/browser/parent_output_surface.cc

Issue 266353003: aw: Ubercomp mega patch (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "android_webview/browser/parent_output_surface.h"
6
7 #include "cc/output/output_surface_client.h"
8 #include "gpu/command_buffer/client/gles2_interface.h"
9
10 namespace android_webview {
11
12 ParentOutputSurface::ParentOutputSurface(
13 scoped_refptr<cc::ContextProvider> context_provider)
14 : cc::OutputSurface(context_provider),
15 weak_factory_(this) {
16 // TODO(boliu): Need this?
17 capabilities_.draw_and_swap_full_viewport_every_frame = true;
18 }
19
20 ParentOutputSurface::~ParentOutputSurface() {}
21
22 bool ParentOutputSurface::BindToClient(cc::OutputSurfaceClient* client) {
23 bool result = cc::OutputSurface::BindToClient(client);
24 if (result)
25 UpdateClientBeforeDraw();
26 return result;
27 }
28
29 void ParentOutputSurface::SwapBuffers(cc::CompositorFrame* frame) {
30 context_provider_->ContextGL()->ShallowFlushCHROMIUM();
31 client_->DidSwapBuffers();
32 SetNeedsRedrawRect(gfx::Rect(surface_size_));
33 }
34
35 base::WeakPtr<ParentOutputSurface> ParentOutputSurface::GetWeakPtr() {
36 return weak_factory_.GetWeakPtr();
37 }
38
39 void ParentOutputSurface::SetDrawConstraints(const gfx::Size& surface_size,
40 const gfx::Rect& clip) {
41 surface_size_ = surface_size;
42 clip_ = clip;
43 if (client_)
44 UpdateClientBeforeDraw();
45 }
46
47 void ParentOutputSurface::UpdateClientBeforeDraw() {
48 SetNeedsRedrawRect(gfx::Rect(surface_size_));
49 gfx::Transform identity;
50 gfx::Rect empty;
51 SetExternalDrawConstraints(identity, empty, clip_, true);
52 }
53
54 } // namespace android_webview
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698