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

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

Issue 2612023002: cc: Implement overdraw feedback debugging feature. (Closed)
Patch Set: make sure overdraw_feedback_ is initialized and reset properly 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
« no previous file with comments | « cc/test/pixel_test_output_surface.h ('k') | chrome/app/generated_resources.grd » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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) {
52 // External stencil test cannot be tested at the same time as |use_stencil|.
53 DCHECK(!use_stencil || !external_stencil_test_);
48 if (context_provider()) { 54 if (context_provider()) {
49 context_provider()->ContextGL()->ResizeCHROMIUM( 55 context_provider()->ContextGL()->ResizeCHROMIUM(
50 size.width(), size.height(), device_scale_factor, has_alpha); 56 size.width(), size.height(), device_scale_factor, has_alpha);
51 } else { 57 } else {
52 software_device()->Resize(size, device_scale_factor); 58 software_device()->Resize(size, device_scale_factor);
53 } 59 }
54 } 60 }
55 61
56 bool PixelTestOutputSurface::HasExternalStencilTest() const { 62 bool PixelTestOutputSurface::HasExternalStencilTest() const {
57 return external_stencil_test_; 63 return external_stencil_test_;
(...skipping 29 matching lines...) Expand all
87 } 93 }
88 94
89 uint32_t PixelTestOutputSurface::GetFramebufferCopyTextureFormat() { 95 uint32_t PixelTestOutputSurface::GetFramebufferCopyTextureFormat() {
90 // This format will work if the |context_provider| has an RGB or RGBA 96 // 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 97 // framebuffer. For now assume tests do not want/care about alpha in
92 // the root render pass. 98 // the root render pass.
93 return GL_RGB; 99 return GL_RGB;
94 } 100 }
95 101
96 } // namespace cc 102 } // namespace cc
OLDNEW
« no previous file with comments | « cc/test/pixel_test_output_surface.h ('k') | chrome/app/generated_resources.grd » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698