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

Side by Side Diff: cc/test/pixel_test_output_surface.cc

Issue 2612023002: cc: Implement overdraw feedback debugging feature. (Closed)
Patch Set: tracing cleanup Created 3 years, 11 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/test/pixel_test_output_surface.h" 5 #include "cc/test/pixel_test_output_surface.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/threading/thread_task_runner_handle.h" 10 #include "base/threading/thread_task_runner_handle.h"
11 #include "cc/output/output_surface_client.h" 11 #include "cc/output/output_surface_client.h"
12 #include "cc/output/output_surface_frame.h" 12 #include "cc/output/output_surface_frame.h"
13 #include "gpu/command_buffer/client/gles2_interface.h" 13 #include "gpu/command_buffer/client/gles2_interface.h"
14 #include "third_party/khronos/GLES2/gl2.h" 14 #include "third_party/khronos/GLES2/gl2.h"
15 #include "ui/gfx/transform.h" 15 #include "ui/gfx/transform.h"
16 16
17 namespace cc { 17 namespace cc {
18 18
19 PixelTestOutputSurface::PixelTestOutputSurface( 19 PixelTestOutputSurface::PixelTestOutputSurface(
20 scoped_refptr<ContextProvider> context_provider, 20 scoped_refptr<ContextProvider> context_provider,
21 bool flipped_output_surface) 21 bool flipped_output_surface)
22 : OutputSurface(std::move(context_provider)), weak_ptr_factory_(this) { 22 : OutputSurface(std::move(context_provider)), weak_ptr_factory_(this) {
23 capabilities_.flipped_output_surface = flipped_output_surface; 23 capabilities_.flipped_output_surface = flipped_output_surface;
24 capabilities_.supports_stencil = true;
24 } 25 }
25 26
26 PixelTestOutputSurface::PixelTestOutputSurface( 27 PixelTestOutputSurface::PixelTestOutputSurface(
27 std::unique_ptr<SoftwareOutputDevice> software_device) 28 std::unique_ptr<SoftwareOutputDevice> software_device)
28 : OutputSurface(std::move(software_device)), weak_ptr_factory_(this) {} 29 : OutputSurface(std::move(software_device)), weak_ptr_factory_(this) {
30 capabilities_.supports_stencil = true;
31 }
29 32
30 PixelTestOutputSurface::~PixelTestOutputSurface() = default; 33 PixelTestOutputSurface::~PixelTestOutputSurface() = default;
31 34
32 void PixelTestOutputSurface::BindToClient(OutputSurfaceClient* client) { 35 void PixelTestOutputSurface::BindToClient(OutputSurfaceClient* client) {
33 client_ = client; 36 client_ = client;
34 } 37 }
35 38
36 void PixelTestOutputSurface::EnsureBackbuffer() {} 39 void PixelTestOutputSurface::EnsureBackbuffer() {}
37 40
38 void PixelTestOutputSurface::DiscardBackbuffer() {} 41 void PixelTestOutputSurface::DiscardBackbuffer() {}
39 42
40 void PixelTestOutputSurface::BindFramebuffer() { 43 void PixelTestOutputSurface::BindFramebuffer() {
41 context_provider()->ContextGL()->BindFramebuffer(GL_FRAMEBUFFER, 0); 44 context_provider()->ContextGL()->BindFramebuffer(GL_FRAMEBUFFER, 0);
42 } 45 }
43 46
44 void PixelTestOutputSurface::Reshape(const gfx::Size& size, 47 void PixelTestOutputSurface::Reshape(const gfx::Size& size,
45 float device_scale_factor, 48 float device_scale_factor,
46 const gfx::ColorSpace& color_space, 49 const gfx::ColorSpace& color_space,
47 bool has_alpha) { 50 bool has_alpha,
51 bool use_stencil) {
48 if (context_provider()) { 52 if (context_provider()) {
49 context_provider()->ContextGL()->ResizeCHROMIUM( 53 context_provider()->ContextGL()->ResizeCHROMIUM(
50 size.width(), size.height(), device_scale_factor, has_alpha); 54 size.width(), size.height(), device_scale_factor, has_alpha);
51 } else { 55 } else {
52 software_device()->Resize(size, device_scale_factor); 56 software_device()->Resize(size, device_scale_factor);
53 } 57 }
54 } 58 }
55 59
56 bool PixelTestOutputSurface::HasExternalStencilTest() const { 60 bool PixelTestOutputSurface::HasExternalStencilTest() const {
57 return external_stencil_test_; 61 return external_stencil_test_;
danakj 2017/01/16 18:17:55 This can be true, but supports_stencil is true. So
reveman 2017/01/16 22:46:18 Added DCHECK to PixelTestOutputSurface::Reshape.
58 } 62 }
59 63
60 void PixelTestOutputSurface::ApplyExternalStencil() {} 64 void PixelTestOutputSurface::ApplyExternalStencil() {}
61 65
62 void PixelTestOutputSurface::SwapBuffers(OutputSurfaceFrame frame) { 66 void PixelTestOutputSurface::SwapBuffers(OutputSurfaceFrame frame) {
63 base::ThreadTaskRunnerHandle::Get()->PostTask( 67 base::ThreadTaskRunnerHandle::Get()->PostTask(
64 FROM_HERE, base::Bind(&PixelTestOutputSurface::SwapBuffersCallback, 68 FROM_HERE, base::Bind(&PixelTestOutputSurface::SwapBuffersCallback,
65 weak_ptr_factory_.GetWeakPtr())); 69 weak_ptr_factory_.GetWeakPtr()));
66 } 70 }
67 71
(...skipping 19 matching lines...) Expand all
87 } 91 }
88 92
89 uint32_t PixelTestOutputSurface::GetFramebufferCopyTextureFormat() { 93 uint32_t PixelTestOutputSurface::GetFramebufferCopyTextureFormat() {
90 // This format will work if the |context_provider| has an RGB or RGBA 94 // This format will work if the |context_provider| has an RGB or RGBA
91 // framebuffer. For now assume tests do not want/care about alpha in 95 // framebuffer. For now assume tests do not want/care about alpha in
92 // the root render pass. 96 // the root render pass.
93 return GL_RGB; 97 return GL_RGB;
94 } 98 }
95 99
96 } // namespace cc 100 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698