summaryrefslogtreecommitdiffstats
path: root/cc
diff options
context:
space:
mode:
authorStephen White <senorblanco@chromium.org>2014-10-07 15:01:36 -0400
committerStephen White <senorblanco@chromium.org>2014-10-07 19:02:38 +0000
commitac87ab0c79d04f620b84ed04a81685aebfc0e691 (patch)
treeca649437463ac1fe2d4a260f68390efced11441c /cc
parent85a4a581610cf3016769de48e3f96bcd4f060147 (diff)
downloadchromium_src-ac87ab0c79d04f620b84ed04a81685aebfc0e691.zip
chromium_src-ac87ab0c79d04f620b84ed04a81685aebfc0e691.tar.gz
chromium_src-ac87ab0c79d04f620b84ed04a81685aebfc0e691.tar.bz2
Revert "Change FlippedFramebuffer return for surfaceless"
This reverts commit 38542d51c9d4bedc79ac78aca67259b7c0bdc214. This was causing at least 5000 layout tests to fail, e.g., http://build.chromium.org/p/chromium.webkit/builders/WebKit%20Linux%20%28deps%29/builds/34932 TBR=achaulk@chromium.org BUG= Review URL: https://codereview.chromium.org/637593004 Cr-Commit-Position: refs/heads/master@{#298534}
Diffstat (limited to 'cc')
-rw-r--r--cc/output/direct_renderer.cc12
-rw-r--r--cc/output/direct_renderer.h5
-rw-r--r--cc/output/gl_renderer.cc15
-rw-r--r--cc/output/gl_renderer.h2
-rw-r--r--cc/output/renderer_pixeltest.cc101
-rw-r--r--cc/output/software_renderer.cc6
-rw-r--r--cc/output/software_renderer.h2
-rw-r--r--cc/test/data/blue_yellow_flipped.pngbin609 -> 0 bytes
-rw-r--r--cc/test/layer_tree_pixel_test.cc5
-rw-r--r--cc/test/pixel_test.cc7
-rw-r--r--cc/test/pixel_test.h42
-rw-r--r--cc/test/pixel_test_output_surface.cc7
-rw-r--r--cc/test/pixel_test_output_surface.h3
13 files changed, 28 insertions, 179 deletions
diff --git a/cc/output/direct_renderer.cc b/cc/output/direct_renderer.cc
index 97f290c..ad39f1a 100644
--- a/cc/output/direct_renderer.cc
+++ b/cc/output/direct_renderer.cc
@@ -81,8 +81,9 @@ void DirectRenderer::QuadRectTransform(gfx::Transform* quad_rect_transform,
void DirectRenderer::InitializeViewport(DrawingFrame* frame,
const gfx::Rect& draw_rect,
const gfx::Rect& viewport_rect,
- const gfx::Size& surface_size,
- bool flip_y) {
+ const gfx::Size& surface_size) {
+ bool flip_y = FlippedFramebuffer();
+
DCHECK_GE(viewport_rect.x(), 0);
DCHECK_GE(viewport_rect.y(), 0);
DCHECK_LE(viewport_rect.right(), surface_size.width());
@@ -118,7 +119,7 @@ gfx::Rect DirectRenderer::MoveFromDrawToWindowSpace(
gfx::Rect window_rect = draw_rect;
window_rect -= current_draw_rect_.OffsetFromOrigin();
window_rect += current_viewport_rect_.OffsetFromOrigin();
- if (FlippedRootFramebuffer())
+ if (FlippedFramebuffer())
window_rect.set_y(current_surface_size_.height() - window_rect.bottom());
return window_rect;
}
@@ -278,7 +279,7 @@ bool DirectRenderer::NeedDeviceClip(const DrawingFrame* frame) const {
gfx::Rect DirectRenderer::DeviceClipRectInWindowSpace(const DrawingFrame* frame)
const {
gfx::Rect device_clip_rect = frame->device_clip_rect;
- if (FlippedRootFramebuffer())
+ if (FlippedFramebuffer())
device_clip_rect.set_y(current_surface_size_.height() -
device_clip_rect.bottom());
return device_clip_rect;
@@ -396,8 +397,7 @@ bool DirectRenderer::UseRenderPass(DrawingFrame* frame,
InitializeViewport(frame,
render_pass->output_rect,
frame->device_viewport_rect,
- output_surface_->SurfaceSize(),
- FlippedRootFramebuffer());
+ output_surface_->SurfaceSize());
return true;
}
diff --git a/cc/output/direct_renderer.h b/cc/output/direct_renderer.h
index 20e2abe..d4c4ba6 100644
--- a/cc/output/direct_renderer.h
+++ b/cc/output/direct_renderer.h
@@ -70,8 +70,7 @@ class CC_EXPORT DirectRenderer : public Renderer {
void InitializeViewport(DrawingFrame* frame,
const gfx::Rect& draw_rect,
const gfx::Rect& viewport_rect,
- const gfx::Size& surface_size,
- bool flip_y);
+ const gfx::Size& surface_size);
gfx::Rect MoveFromDrawToWindowSpace(const gfx::Rect& draw_rect) const;
bool NeedDeviceClip(const DrawingFrame* frame) const;
@@ -105,7 +104,7 @@ class CC_EXPORT DirectRenderer : public Renderer {
virtual void BeginDrawingFrame(DrawingFrame* frame) = 0;
virtual void FinishDrawingFrame(DrawingFrame* frame) = 0;
virtual void FinishDrawingQuadList();
- virtual bool FlippedRootFramebuffer() const = 0;
+ virtual bool FlippedFramebuffer() const = 0;
virtual void EnsureScissorTestEnabled() = 0;
virtual void EnsureScissorTestDisabled() = 0;
virtual void DiscardBackbuffer() {}
diff --git a/cc/output/gl_renderer.cc b/cc/output/gl_renderer.cc
index f6659ca..6357793 100644
--- a/cc/output/gl_renderer.cc
+++ b/cc/output/gl_renderer.cc
@@ -2195,9 +2195,7 @@ void GLRenderer::FinishDrawingFrame(DrawingFrame* frame) {
void GLRenderer::FinishDrawingQuadList() { FlushTextureQuadCache(); }
-bool GLRenderer::FlippedRootFramebuffer() const {
- return output_surface_->capabilities().uses_default_gl_framebuffer;
-}
+bool GLRenderer::FlippedFramebuffer() const { return true; }
void GLRenderer::EnsureScissorTestEnabled() {
if (is_scissor_enabled_)
@@ -2356,8 +2354,7 @@ void GLRenderer::SwapBuffers(const CompositorFrameMetadata& metadata) {
swap_buffer_rect_.height();
compositor_frame.gl_frame_data->sub_buffer_rect =
gfx::Rect(swap_buffer_rect_.x(),
- FlippedRootFramebuffer() ? flipped_y_pos_of_rect_bottom
- : swap_buffer_rect_.y(),
+ flipped_y_pos_of_rect_bottom,
swap_buffer_rect_.width(),
swap_buffer_rect_.height());
} else {
@@ -2697,12 +2694,8 @@ bool GLRenderer::BindFramebufferToTexture(DrawingFrame* frame,
GL_FRAMEBUFFER_COMPLETE ||
IsContextLost());
- bool flipped_framebuffer = true;
- InitializeViewport(frame,
- target_rect,
- gfx::Rect(target_rect.size()),
- target_rect.size(),
- flipped_framebuffer);
+ InitializeViewport(
+ frame, target_rect, gfx::Rect(target_rect.size()), target_rect.size());
return true;
}
diff --git a/cc/output/gl_renderer.h b/cc/output/gl_renderer.h
index d88312c..72f51b5 100644
--- a/cc/output/gl_renderer.h
+++ b/cc/output/gl_renderer.h
@@ -114,7 +114,7 @@ class CC_EXPORT GLRenderer : public DirectRenderer {
virtual void DoDrawQuad(DrawingFrame* frame, const class DrawQuad*) override;
virtual void BeginDrawingFrame(DrawingFrame* frame) override;
virtual void FinishDrawingFrame(DrawingFrame* frame) override;
- virtual bool FlippedRootFramebuffer() const override;
+ virtual bool FlippedFramebuffer() const override;
virtual void EnsureScissorTestEnabled() override;
virtual void EnsureScissorTestDisabled() override;
virtual void CopyCurrentRenderPassToBitmap(
diff --git a/cc/output/renderer_pixeltest.cc b/cc/output/renderer_pixeltest.cc
index e86c0e0..00c9100 100644
--- a/cc/output/renderer_pixeltest.cc
+++ b/cc/output/renderer_pixeltest.cc
@@ -2100,107 +2100,6 @@ TYPED_TEST(RendererPixelTest, PictureDrawQuadNonIdentityScale) {
ExactPixelComparator(true)));
}
-typedef RendererPixelTest<GLRendererWithFlippedSurface>
- GLRendererPixelTestWithFlippedOutputSurface;
-
-TEST_F(GLRendererPixelTestWithFlippedOutputSurface, ExplicitFlipTest) {
- // This draws the normal blue-yellow scene with an inverted output surface.
- gfx::Rect viewport_rect(this->device_viewport_size_);
-
- RenderPassId root_pass_id(1, 1);
- scoped_ptr<RenderPass> root_pass =
- CreateTestRootRenderPass(root_pass_id, viewport_rect);
-
- RenderPassId child_pass_id(2, 2);
- gfx::Rect pass_rect(this->device_viewport_size_);
- gfx::Transform transform_to_root;
- scoped_ptr<RenderPass> child_pass =
- CreateTestRenderPass(child_pass_id, pass_rect, transform_to_root);
-
- gfx::Transform content_to_target_transform;
- SharedQuadState* shared_state = CreateTestSharedQuadState(
- content_to_target_transform, viewport_rect, child_pass.get());
-
- gfx::Rect blue_rect(0,
- 0,
- this->device_viewport_size_.width(),
- this->device_viewport_size_.height() / 2);
- SolidColorDrawQuad* blue =
- child_pass->CreateAndAppendDrawQuad<SolidColorDrawQuad>();
- blue->SetNew(shared_state, blue_rect, blue_rect, SK_ColorBLUE, false);
- gfx::Rect yellow_rect(0,
- this->device_viewport_size_.height() / 2,
- this->device_viewport_size_.width(),
- this->device_viewport_size_.height() / 2);
- SolidColorDrawQuad* yellow =
- child_pass->CreateAndAppendDrawQuad<SolidColorDrawQuad>();
- yellow->SetNew(shared_state, yellow_rect, yellow_rect, SK_ColorYELLOW, false);
-
- SharedQuadState* pass_shared_state =
- CreateTestSharedQuadState(gfx::Transform(), pass_rect, root_pass.get());
- CreateTestRenderPassDrawQuad(
- pass_shared_state, pass_rect, child_pass_id, root_pass.get());
-
- RenderPassList pass_list;
- pass_list.push_back(child_pass.Pass());
- pass_list.push_back(root_pass.Pass());
-
- EXPECT_TRUE(this->RunPixelTest(
- &pass_list,
- base::FilePath(FILE_PATH_LITERAL("blue_yellow_flipped.png")),
- ExactPixelComparator(true)));
-}
-
-TEST_F(GLRendererPixelTestWithFlippedOutputSurface, CheckChildPassUnflipped) {
- // This draws the normal blue-yellow scene with an inverted output surface.
- gfx::Rect viewport_rect(this->device_viewport_size_);
-
- RenderPassId root_pass_id(1, 1);
- scoped_ptr<RenderPass> root_pass =
- CreateTestRootRenderPass(root_pass_id, viewport_rect);
-
- RenderPassId child_pass_id(2, 2);
- gfx::Rect pass_rect(this->device_viewport_size_);
- gfx::Transform transform_to_root;
- scoped_ptr<RenderPass> child_pass =
- CreateTestRenderPass(child_pass_id, pass_rect, transform_to_root);
-
- gfx::Transform content_to_target_transform;
- SharedQuadState* shared_state = CreateTestSharedQuadState(
- content_to_target_transform, viewport_rect, child_pass.get());
-
- gfx::Rect blue_rect(0,
- 0,
- this->device_viewport_size_.width(),
- this->device_viewport_size_.height() / 2);
- SolidColorDrawQuad* blue =
- child_pass->CreateAndAppendDrawQuad<SolidColorDrawQuad>();
- blue->SetNew(shared_state, blue_rect, blue_rect, SK_ColorBLUE, false);
- gfx::Rect yellow_rect(0,
- this->device_viewport_size_.height() / 2,
- this->device_viewport_size_.width(),
- this->device_viewport_size_.height() / 2);
- SolidColorDrawQuad* yellow =
- child_pass->CreateAndAppendDrawQuad<SolidColorDrawQuad>();
- yellow->SetNew(shared_state, yellow_rect, yellow_rect, SK_ColorYELLOW, false);
-
- SharedQuadState* pass_shared_state =
- CreateTestSharedQuadState(gfx::Transform(), pass_rect, root_pass.get());
- CreateTestRenderPassDrawQuad(
- pass_shared_state, pass_rect, child_pass_id, root_pass.get());
-
- RenderPassList pass_list;
- pass_list.push_back(child_pass.Pass());
- pass_list.push_back(root_pass.Pass());
-
- // Check that the child pass remains unflipped.
- EXPECT_TRUE(this->RunPixelTestWithReadbackTarget(
- &pass_list,
- pass_list.front(),
- base::FilePath(FILE_PATH_LITERAL("blue_yellow.png")),
- ExactPixelComparator(true)));
-}
-
TEST_F(GLRendererPixelTest, PictureDrawQuadTexture4444) {
gfx::Size pile_tile_size(1000, 1000);
gfx::Rect viewport(this->device_viewport_size_);
diff --git a/cc/output/software_renderer.cc b/cc/output/software_renderer.cc
index a88dba2..ae58b63 100644
--- a/cc/output/software_renderer.cc
+++ b/cc/output/software_renderer.cc
@@ -127,7 +127,7 @@ void SoftwareRenderer::ReceiveSwapBuffersAck(const CompositorFrameAck& ack) {
output_device_->ReclaimSoftwareFrame(ack.last_software_frame_id);
}
-bool SoftwareRenderer::FlippedRootFramebuffer() const {
+bool SoftwareRenderer::FlippedFramebuffer() const {
return false;
}
@@ -162,12 +162,10 @@ bool SoftwareRenderer::BindFramebufferToTexture(
new ResourceProvider::ScopedWriteLockSoftware(
resource_provider_, texture->id()));
current_canvas_ = current_framebuffer_lock_->sk_canvas();
- bool flipped_framebuffer = false;
InitializeViewport(frame,
target_rect,
gfx::Rect(target_rect.size()),
- target_rect.size(),
- flipped_framebuffer);
+ target_rect.size());
return true;
}
diff --git a/cc/output/software_renderer.h b/cc/output/software_renderer.h
index 6ab01cd..deac838 100644
--- a/cc/output/software_renderer.h
+++ b/cc/output/software_renderer.h
@@ -57,7 +57,7 @@ class CC_EXPORT SoftwareRenderer : public DirectRenderer {
virtual void DoDrawQuad(DrawingFrame* frame, const DrawQuad* quad) override;
virtual void BeginDrawingFrame(DrawingFrame* frame) override;
virtual void FinishDrawingFrame(DrawingFrame* frame) override;
- virtual bool FlippedRootFramebuffer() const override;
+ virtual bool FlippedFramebuffer() const override;
virtual void EnsureScissorTestEnabled() override;
virtual void EnsureScissorTestDisabled() override;
virtual void CopyCurrentRenderPassToBitmap(
diff --git a/cc/test/data/blue_yellow_flipped.png b/cc/test/data/blue_yellow_flipped.png
deleted file mode 100644
index 04d17b6..0000000
--- a/cc/test/data/blue_yellow_flipped.png
+++ /dev/null
Binary files differ
diff --git a/cc/test/layer_tree_pixel_test.cc b/cc/test/layer_tree_pixel_test.cc
index 25f2e93..ed14e33 100644
--- a/cc/test/layer_tree_pixel_test.cc
+++ b/cc/test/layer_tree_pixel_test.cc
@@ -53,9 +53,8 @@ scoped_ptr<OutputSurface> LayerTreePixelTest::CreateOutputSurface(
case GL_WITH_DEFAULT:
case GL_WITH_BITMAP: {
- bool uses_default_gl_framebuffer = true;
- output_surface = make_scoped_ptr(new PixelTestOutputSurface(
- new TestInProcessContextProvider, uses_default_gl_framebuffer));
+ output_surface = make_scoped_ptr(
+ new PixelTestOutputSurface(new TestInProcessContextProvider));
break;
}
}
diff --git a/cc/test/pixel_test.cc b/cc/test/pixel_test.cc
index dcbcba0..6900319 100644
--- a/cc/test/pixel_test.cc
+++ b/cc/test/pixel_test.cc
@@ -107,12 +107,11 @@ bool PixelTest::PixelsMatchReference(const base::FilePath& ref_file,
*result_bitmap_, test_data_dir.Append(ref_file), comparator);
}
-void PixelTest::SetUpGLRenderer(bool use_skia_gpu_backend,
- bool uses_main_gl_framebuffer) {
+void PixelTest::SetUpGLRenderer(bool use_skia_gpu_backend) {
enable_pixel_output_.reset(new gfx::DisableNullDrawGLBindings);
- output_surface_.reset(new PixelTestOutputSurface(
- new TestInProcessContextProvider, uses_main_gl_framebuffer));
+ output_surface_.reset(
+ new PixelTestOutputSurface(new TestInProcessContextProvider));
output_surface_->BindToClient(output_surface_client_.get());
shared_bitmap_manager_.reset(new TestSharedBitmapManager());
diff --git a/cc/test/pixel_test.h b/cc/test/pixel_test.h
index 88e73fa..17ecffb 100644
--- a/cc/test/pixel_test.h
+++ b/cc/test/pixel_test.h
@@ -53,8 +53,7 @@ class PixelTest : public testing::Test, RendererClient {
gfx::Vector2d external_device_viewport_offset_;
gfx::Rect external_device_clip_rect_;
- void SetUpGLRenderer(bool use_skia_gpu_backend,
- bool uses_main_gl_framebuffer);
+ void SetUpGLRenderer(bool use_skia_gpu_backend);
void SetUpSoftwareRenderer();
void ForceExpandedViewport(const gfx::Size& surface_expansion);
@@ -116,25 +115,9 @@ class SoftwareRendererWithExpandedViewport : public SoftwareRenderer {
: SoftwareRenderer(client, settings, output_surface, resource_provider) {}
};
-class GLRendererWithFlippedSurface : public GLRenderer {
- public:
- GLRendererWithFlippedSurface(RendererClient* client,
- const LayerTreeSettings* settings,
- OutputSurface* output_surface,
- ResourceProvider* resource_provider,
- TextureMailboxDeleter* texture_mailbox_deleter,
- int highp_threshold_min)
- : GLRenderer(client,
- settings,
- output_surface,
- resource_provider,
- texture_mailbox_deleter,
- highp_threshold_min) {}
-};
-
template<>
inline void RendererPixelTest<GLRenderer>::SetUp() {
- SetUpGLRenderer(false, true);
+ SetUpGLRenderer(false);
}
template<>
@@ -149,7 +132,7 @@ inline bool RendererPixelTest<GLRenderer>::ExpandedViewport() const {
template<>
inline void RendererPixelTest<GLRendererWithExpandedViewport>::SetUp() {
- SetUpGLRenderer(false, true);
+ SetUpGLRenderer(false);
ForceExpandedViewport(gfx::Size(50, 50));
ForceViewportOffset(gfx::Vector2d(10, 20));
}
@@ -166,24 +149,7 @@ RendererPixelTest<GLRendererWithExpandedViewport>::ExpandedViewport() const {
return true;
}
-template <>
-inline void RendererPixelTest<GLRendererWithFlippedSurface>::SetUp() {
- SetUpGLRenderer(false, false);
-}
-
-template <>
-inline bool RendererPixelTest<GLRendererWithFlippedSurface>::UseSkiaGPUBackend()
- const {
- return false;
-}
-
-template <>
-inline bool RendererPixelTest<GLRendererWithFlippedSurface>::ExpandedViewport()
- const {
- return true;
-}
-
-template <>
+template<>
inline void RendererPixelTest<SoftwareRenderer>::SetUp() {
SetUpSoftwareRenderer();
}
diff --git a/cc/test/pixel_test_output_surface.cc b/cc/test/pixel_test_output_surface.cc
index 9fe85b6..c773a52 100644
--- a/cc/test/pixel_test_output_surface.cc
+++ b/cc/test/pixel_test_output_surface.cc
@@ -10,11 +10,8 @@
namespace cc {
PixelTestOutputSurface::PixelTestOutputSurface(
- scoped_refptr<ContextProvider> context_provider,
- bool uses_main_gl_framebuffer)
- : OutputSurface(context_provider), external_stencil_test_(false) {
- capabilities_.uses_default_gl_framebuffer = uses_main_gl_framebuffer;
-}
+ scoped_refptr<ContextProvider> context_provider)
+ : OutputSurface(context_provider), external_stencil_test_(false) {}
PixelTestOutputSurface::PixelTestOutputSurface(
scoped_ptr<SoftwareOutputDevice> software_device)
diff --git a/cc/test/pixel_test_output_surface.h b/cc/test/pixel_test_output_surface.h
index ac05144..ce9d79c 100644
--- a/cc/test/pixel_test_output_surface.h
+++ b/cc/test/pixel_test_output_surface.h
@@ -12,8 +12,7 @@ namespace cc {
class PixelTestOutputSurface : public OutputSurface {
public:
explicit PixelTestOutputSurface(
- scoped_refptr<ContextProvider> context_provider,
- bool uses_main_gl_framebuffer);
+ scoped_refptr<ContextProvider> context_provider);
explicit PixelTestOutputSurface(
scoped_ptr<SoftwareOutputDevice> software_device);