#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"
namespace {
using webkit::gpu::WebGraphicsContext3DInProcessCommandBufferImpl;
+using webkit::gpu::WebGraphicsContext3DImpl;
scoped_refptr<cc::ContextProvider> CreateContext(
scoped_refptr<gfx::GLSurface> surface,
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<gpu::GLInProcessContext> context(
gpu::GLInProcessContext::Create(service,
surface->GetSize(),
share_context,
false /* share_resources */,
- in_process_attribs,
+ attribs_for_gles2,
gpu_preference));
DCHECK(context.get());
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);
#endif // DCHECK_IS_ON
resource_collection_->SetClient(NULL);
+
+ // Reset draw constraints.
+ shared_renderer_state_->UpdateDrawConstraints(
+ ParentCompositorDrawConstraints());
}
void HardwareRenderer::DidBeginMainFrame() {
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,
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);