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

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

Issue 683113005: Update from chromium https://crrev.com/302282 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 1 month 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/layers/delegated_renderer_layer_impl.cc ('k') | cc/layers/picture_layer.cc » ('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 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 "base/containers/hash_tables.h" 5 #include "base/containers/hash_tables.h"
6 #include "cc/layers/append_quads_data.h" 6 #include "cc/layers/append_quads_data.h"
7 #include "cc/layers/nine_patch_layer_impl.h" 7 #include "cc/layers/nine_patch_layer_impl.h"
8 #include "cc/quads/texture_draw_quad.h" 8 #include "cc/quads/texture_draw_quad.h"
9 #include "cc/resources/ui_resource_bitmap.h" 9 #include "cc/resources/ui_resource_bitmap.h"
10 #include "cc/resources/ui_resource_client.h" 10 #include "cc/resources/ui_resource_client.h"
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 if (!fill_center) { 82 if (!fill_center) {
83 EXPECT_RECT_EQ(expected_remaining, gfx::ToEnclosedRect(remaining.bounds())); 83 EXPECT_RECT_EQ(expected_remaining, gfx::ToEnclosedRect(remaining.bounds()));
84 } else { 84 } else {
85 EXPECT_TRUE(remaining.bounds().IsEmpty()); 85 EXPECT_TRUE(remaining.bounds().IsEmpty());
86 } 86 }
87 87
88 // Verify UV rects 88 // Verify UV rects
89 gfx::Rect bitmap_rect(bitmap_size); 89 gfx::Rect bitmap_rect(bitmap_size);
90 Region tex_remaining(bitmap_rect); 90 Region tex_remaining(bitmap_rect);
91 for (const auto& quad : quads) { 91 for (const auto& quad : quads) {
92 const TextureDrawQuad* tex_quad = TextureDrawQuad::MaterialCast(&quad); 92 const TextureDrawQuad* tex_quad = TextureDrawQuad::MaterialCast(quad);
93 gfx::RectF tex_rect = 93 gfx::RectF tex_rect =
94 gfx::BoundingRect(tex_quad->uv_top_left, tex_quad->uv_bottom_right); 94 gfx::BoundingRect(tex_quad->uv_top_left, tex_quad->uv_bottom_right);
95 tex_rect.Scale(bitmap_size.width(), bitmap_size.height()); 95 tex_rect.Scale(bitmap_size.width(), bitmap_size.height());
96 tex_remaining.Subtract(Region(ToRoundedIntRect(tex_rect))); 96 tex_remaining.Subtract(Region(ToRoundedIntRect(tex_rect)));
97 } 97 }
98 98
99 if (!fill_center) { 99 if (!fill_center) {
100 EXPECT_RECT_EQ(aperture_rect, tex_remaining.bounds()); 100 EXPECT_RECT_EQ(aperture_rect, tex_remaining.bounds());
101 Region aperture_region(aperture_rect); 101 Region aperture_region(aperture_rect);
102 EXPECT_EQ(aperture_region, tex_remaining); 102 EXPECT_EQ(aperture_region, tex_remaining);
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 impl.quad_list(), occluded, &partially_occluded_count); 266 impl.quad_list(), occluded, &partially_occluded_count);
267 // The layer outputs nine quads, three of which are partially occluded, and 267 // The layer outputs nine quads, three of which are partially occluded, and
268 // three fully occluded. 268 // three fully occluded.
269 EXPECT_EQ(6u, impl.quad_list().size()); 269 EXPECT_EQ(6u, impl.quad_list().size());
270 EXPECT_EQ(3u, partially_occluded_count); 270 EXPECT_EQ(3u, partially_occluded_count);
271 } 271 }
272 } 272 }
273 273
274 } // namespace 274 } // namespace
275 } // namespace cc 275 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/delegated_renderer_layer_impl.cc ('k') | cc/layers/picture_layer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698