We started redesigning GpuMemoryBuffer interface to handle multiple buffers [0].
[chromium-blink-merge.git] / android_webview / browser / parent_compositor_draw_constraints.cc
blob8bd0ccdc7d1f40ea5d41c3d48536249bb065df21
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.
5 #include "android_webview/browser/parent_compositor_draw_constraints.h"
7 #include "android_webview/browser/child_frame.h"
9 namespace android_webview {
11 ParentCompositorDrawConstraints::ParentCompositorDrawConstraints()
12 : is_layer(false) {
15 ParentCompositorDrawConstraints::ParentCompositorDrawConstraints(
16 bool is_layer,
17 const gfx::Transform& transform,
18 const gfx::Rect& surface_rect)
19 : is_layer(is_layer), transform(transform), surface_rect(surface_rect) {
22 bool ParentCompositorDrawConstraints::NeedUpdate(
23 const ChildFrame& frame) const {
24 if (is_layer != frame.is_layer ||
25 transform != frame.transform_for_tile_priority) {
26 return true;
29 // Viewport for tile priority does not depend on surface rect in this case.
30 if (frame.offscreen_pre_raster)
31 return false;
33 if (is_layer) {
34 return surface_rect != frame.viewport_rect_for_tile_priority;
35 } else {
36 // Workaround for corner case. See crbug.com/417479.
37 return frame.viewport_rect_for_tile_priority.IsEmpty() &&
38 !surface_rect.IsEmpty();
42 } // namespace webview