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

Side by Side Diff: cc/layers/tiled_layer_impl_unittest.cc

Issue 643583003: [C++11 Allowed Features] Declares a type-safe null pointer converting from NULL to nullptr in src/… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: foramted. Created 6 years, 2 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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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/layers/tiled_layer_impl.h" 5 #include "cc/layers/tiled_layer_impl.h"
6 6
7 #include "cc/layers/append_quads_data.h" 7 #include "cc/layers/append_quads_data.h"
8 #include "cc/quads/tile_draw_quad.h" 8 #include "cc/quads/tile_draw_quad.h"
9 #include "cc/resources/layer_tiling_data.h" 9 #include "cc/resources/layer_tiling_data.h"
10 #include "cc/test/fake_impl_proxy.h" 10 #include "cc/test/fake_impl_proxy.h"
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 gfx::Size layer_size(tile_size.width() * num_tiles_x, 87 gfx::Size layer_size(tile_size.width() * num_tiles_x,
88 tile_size.height() * num_tiles_y); 88 tile_size.height() * num_tiles_y);
89 89
90 // Verify default layer does creates quads 90 // Verify default layer does creates quads
91 { 91 {
92 scoped_ptr<TiledLayerImpl> layer = 92 scoped_ptr<TiledLayerImpl> layer =
93 CreateLayer(tile_size, layer_size, LayerTilingData::NO_BORDER_TEXELS); 93 CreateLayer(tile_size, layer_size, LayerTilingData::NO_BORDER_TEXELS);
94 scoped_ptr<RenderPass> render_pass = RenderPass::Create(); 94 scoped_ptr<RenderPass> render_pass = RenderPass::Create();
95 95
96 AppendQuadsData data; 96 AppendQuadsData data;
97 EXPECT_TRUE(layer->WillDraw(DRAW_MODE_HARDWARE, NULL)); 97 EXPECT_TRUE(layer->WillDraw(DRAW_MODE_HARDWARE, nullptr));
98 layer->AppendQuads(render_pass.get(), Occlusion(), &data); 98 layer->AppendQuads(render_pass.get(), Occlusion(), &data);
99 layer->DidDraw(NULL); 99 layer->DidDraw(nullptr);
100 unsigned num_tiles = num_tiles_x * num_tiles_y; 100 unsigned num_tiles = num_tiles_x * num_tiles_y;
101 EXPECT_EQ(render_pass->quad_list.size(), num_tiles); 101 EXPECT_EQ(render_pass->quad_list.size(), num_tiles);
102 } 102 }
103 103
104 // Layer with empty visible layer rect produces no quads 104 // Layer with empty visible layer rect produces no quads
105 { 105 {
106 scoped_ptr<TiledLayerImpl> layer = 106 scoped_ptr<TiledLayerImpl> layer =
107 CreateLayer(tile_size, layer_size, LayerTilingData::NO_BORDER_TEXELS); 107 CreateLayer(tile_size, layer_size, LayerTilingData::NO_BORDER_TEXELS);
108 layer->draw_properties().visible_content_rect = gfx::Rect(); 108 layer->draw_properties().visible_content_rect = gfx::Rect();
109 109
110 scoped_ptr<RenderPass> render_pass = RenderPass::Create(); 110 scoped_ptr<RenderPass> render_pass = RenderPass::Create();
111 111
112 EXPECT_FALSE(layer->WillDraw(DRAW_MODE_HARDWARE, NULL)); 112 EXPECT_FALSE(layer->WillDraw(DRAW_MODE_HARDWARE, nullptr));
113 } 113 }
114 114
115 // Layer with non-intersecting visible layer rect produces no quads 115 // Layer with non-intersecting visible layer rect produces no quads
116 { 116 {
117 scoped_ptr<TiledLayerImpl> layer = 117 scoped_ptr<TiledLayerImpl> layer =
118 CreateLayer(tile_size, layer_size, LayerTilingData::NO_BORDER_TEXELS); 118 CreateLayer(tile_size, layer_size, LayerTilingData::NO_BORDER_TEXELS);
119 119
120 gfx::Rect outside_bounds(-100, -100, 50, 50); 120 gfx::Rect outside_bounds(-100, -100, 50, 50);
121 layer->draw_properties().visible_content_rect = outside_bounds; 121 layer->draw_properties().visible_content_rect = outside_bounds;
122 122
123 scoped_ptr<RenderPass> render_pass = RenderPass::Create(); 123 scoped_ptr<RenderPass> render_pass = RenderPass::Create();
124 124
125 AppendQuadsData data; 125 AppendQuadsData data;
126 EXPECT_TRUE(layer->WillDraw(DRAW_MODE_HARDWARE, NULL)); 126 EXPECT_TRUE(layer->WillDraw(DRAW_MODE_HARDWARE, nullptr));
127 layer->AppendQuads(render_pass.get(), Occlusion(), &data); 127 layer->AppendQuads(render_pass.get(), Occlusion(), &data);
128 layer->DidDraw(NULL); 128 layer->DidDraw(nullptr);
129 EXPECT_EQ(render_pass->quad_list.size(), 0u); 129 EXPECT_EQ(render_pass->quad_list.size(), 0u);
130 } 130 }
131 131
132 // Layer with skips draw produces no quads 132 // Layer with skips draw produces no quads
133 { 133 {
134 scoped_ptr<TiledLayerImpl> layer = 134 scoped_ptr<TiledLayerImpl> layer =
135 CreateLayer(tile_size, layer_size, LayerTilingData::NO_BORDER_TEXELS); 135 CreateLayer(tile_size, layer_size, LayerTilingData::NO_BORDER_TEXELS);
136 layer->set_skips_draw(true); 136 layer->set_skips_draw(true);
137 137
138 scoped_ptr<RenderPass> render_pass = RenderPass::Create(); 138 scoped_ptr<RenderPass> render_pass = RenderPass::Create();
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 LayerTestCommon::VerifyQuadsAreOccluded( 363 LayerTestCommon::VerifyQuadsAreOccluded(
364 impl.quad_list(), occluded, &partially_occluded_count); 364 impl.quad_list(), occluded, &partially_occluded_count);
365 // The layer outputs one quad, which is partially occluded. 365 // The layer outputs one quad, which is partially occluded.
366 EXPECT_EQ(100u - 10u, impl.quad_list().size()); 366 EXPECT_EQ(100u - 10u, impl.quad_list().size());
367 EXPECT_EQ(10u + 10u, partially_occluded_count); 367 EXPECT_EQ(10u + 10u, partially_occluded_count);
368 } 368 }
369 } 369 }
370 370
371 } // namespace 371 } // namespace
372 } // namespace cc 372 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698