X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fandroid_webview%2Fbrowser%2Fhardware_renderer.cc;h=6a3d54bf4fbb5079bf2b758d0828e21d28e897a5;hb=4a1a0bdd01eef90b0826a0e761d3379d3715c10f;hp=df7e3614da05ef9285d786585d15229ed0a4c9bc;hpb=b1be5ca53587d23e7aeb77b26861fdc0a181ffd8;p=platform%2Fframework%2Fweb%2Fcrosswalk.git diff --git a/src/android_webview/browser/hardware_renderer.cc b/src/android_webview/browser/hardware_renderer.cc index df7e361..6a3d54b 100644 --- a/src/android_webview/browser/hardware_renderer.cc +++ b/src/android_webview/browser/hardware_renderer.cc @@ -20,6 +20,7 @@ #include "cc/trees/layer_tree_host.h" #include "cc/trees/layer_tree_settings.h" #include "gpu/command_buffer/client/gl_in_process_context.h" +#include "gpu/command_buffer/common/gles2_cmd_utils.h" #include "ui/gfx/frame_time.h" #include "ui/gfx/geometry/rect_conversions.h" #include "ui/gfx/geometry/rect_f.h" @@ -33,6 +34,7 @@ namespace android_webview { namespace { using webkit::gpu::WebGraphicsContext3DInProcessCommandBufferImpl; +using webkit::gpu::WebGraphicsContext3DImpl; scoped_refptr CreateContext( scoped_refptr surface, @@ -46,10 +48,10 @@ scoped_refptr CreateContext( attributes.stencil = false; attributes.shareResources = true; attributes.noAutomaticFlushes = true; - gpu::GLInProcessContextAttribs in_process_attribs; - WebGraphicsContext3DInProcessCommandBufferImpl::ConvertAttributes( - attributes, &in_process_attribs); - in_process_attribs.lose_context_when_out_of_memory = 1; + gpu::gles2::ContextCreationAttribHelper attribs_for_gles2; + WebGraphicsContext3DImpl::ConvertAttributes( + attributes, &attribs_for_gles2); + attribs_for_gles2.lose_context_when_out_of_memory = true; scoped_ptr context( gpu::GLInProcessContext::Create(service, @@ -59,7 +61,7 @@ scoped_refptr CreateContext( surface->GetSize(), share_context, false /* share_resources */, - in_process_attribs, + attribs_for_gles2, gpu_preference)); DCHECK(context.get()); @@ -94,7 +96,7 @@ HardwareRenderer::HardwareRenderer(SharedRendererState* state) settings.should_clear_root_render_pass = false; layer_tree_host_ = - cc::LayerTreeHost::CreateSingleThreaded(this, this, NULL, settings); + cc::LayerTreeHost::CreateSingleThreaded(this, this, NULL, settings, NULL); layer_tree_host_->SetRootLayer(root_layer_); layer_tree_host_->SetLayerTreeHostClientReady(); layer_tree_host_->set_has_transparent_background(true); @@ -116,6 +118,10 @@ HardwareRenderer::~HardwareRenderer() { #endif // DCHECK_IS_ON resource_collection_->SetClient(NULL); + + // Reset draw constraints. + shared_renderer_state_->UpdateDrawConstraints( + ParentCompositorDrawConstraints()); } void HardwareRenderer::DidBeginMainFrame() { @@ -191,6 +197,21 @@ void HardwareRenderer::DrawGL(bool stencil_enabled, if (last_egl_context_ != current_context) DLOG(WARNING) << "EGLContextChanged"; + gfx::Transform transform(gfx::Transform::kSkipInitialization); + transform.matrix().setColMajorf(draw_info->transform); + transform.Translate(scroll_offset_.x(), scroll_offset_.y()); + + // Need to post the new transform matrix back to child compositor + // because there is no onDraw during a Render Thread animation, and child + // compositor might not have the tiles rasterized as the animation goes on. + ParentCompositorDrawConstraints draw_constraints( + draw_info->is_layer, transform, gfx::Rect(viewport_)); + if (!draw_constraints_.Equals(draw_constraints)) { + draw_constraints_ = draw_constraints; + shared_renderer_state_->PostExternalDrawConstraintsToChildCompositor( + draw_constraints); + } + viewport_.SetSize(draw_info->width, draw_info->height); layer_tree_host_->SetViewportSize(viewport_); clip_.SetRect(draw_info->clip_left, @@ -199,9 +220,6 @@ void HardwareRenderer::DrawGL(bool stencil_enabled, draw_info->clip_bottom - draw_info->clip_top); stencil_enabled_ = stencil_enabled; - gfx::Transform transform(gfx::Transform::kSkipInitialization); - transform.matrix().setColMajorf(draw_info->transform); - transform.Translate(scroll_offset_.x(), scroll_offset_.y()); delegated_layer_->SetTransform(transform); gl_surface_->SetBackingFrameBufferObject(framebuffer_binding_ext);