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

Side by Side Diff: cc/paint/discardable_image_map_unittest.cc

Issue 2881063003: cc: Change RTree::Search to return results, add comments, more tests. (Closed)
Patch Set: Created 3 years, 7 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/paint/discardable_image_map.h" 5 #include "cc/paint/discardable_image_map.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <memory> 9 #include <memory>
10 10
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 std::vector<PositionScaleDrawImage> GetDiscardableImagesInRect( 59 std::vector<PositionScaleDrawImage> GetDiscardableImagesInRect(
60 const DiscardableImageMap& image_map, 60 const DiscardableImageMap& image_map,
61 const gfx::Rect& rect) { 61 const gfx::Rect& rect) {
62 std::vector<DrawImage> draw_images; 62 std::vector<DrawImage> draw_images;
63 // Choose a not-SRGB-and-not-invalid target color space to verify that it 63 // Choose a not-SRGB-and-not-invalid target color space to verify that it
64 // is passed correctly to the resulting DrawImages. 64 // is passed correctly to the resulting DrawImages.
65 gfx::ColorSpace target_color_space = gfx::ColorSpace::CreateXYZD50(); 65 gfx::ColorSpace target_color_space = gfx::ColorSpace::CreateXYZD50();
66 image_map.GetDiscardableImagesInRect(rect, 1.f, target_color_space, 66 image_map.GetDiscardableImagesInRect(rect, 1.f, target_color_space,
67 &draw_images); 67 &draw_images);
68 68
69 std::vector<size_t> indices; 69 std::vector<size_t> indices = image_map.images_rtree_.Search(rect);
danakj 2017/05/15 20:35:34 as well here if u want
vmpstr 2017/05/15 20:46:34 Done.
70 image_map.images_rtree_.Search(rect, &indices);
71 std::vector<PositionScaleDrawImage> position_draw_images; 70 std::vector<PositionScaleDrawImage> position_draw_images;
72 for (size_t index : indices) { 71 for (size_t index : indices) {
73 position_draw_images.push_back( 72 position_draw_images.push_back(
74 PositionScaleDrawImage(image_map.all_images_[index].first.image(), 73 PositionScaleDrawImage(image_map.all_images_[index].first.image(),
75 image_map.all_images_[index].second, 74 image_map.all_images_[index].second,
76 image_map.all_images_[index].first.scale())); 75 image_map.all_images_[index].first.scale()));
77 } 76 }
78 77
79 EXPECT_EQ(draw_images.size(), position_draw_images.size()); 78 EXPECT_EQ(draw_images.size(), position_draw_images.size());
80 for (size_t i = 0; i < draw_images.size(); ++i) { 79 for (size_t i = 0; i < draw_images.size(); ++i) {
(...skipping 631 matching lines...) Expand 10 before | Expand all | Expand 10 after
712 EXPECT_TRUE(discardable_image == images[0].image()); 711 EXPECT_TRUE(discardable_image == images[0].image());
713 712
714 images.clear(); 713 images.clear();
715 image_map_.GetDiscardableImagesInRect(gfx::Rect(105, 105, 5, 95), 1.f, 714 image_map_.GetDiscardableImagesInRect(gfx::Rect(105, 105, 5, 95), 1.f,
716 target_color_space, &images); 715 target_color_space, &images);
717 EXPECT_EQ(1u, images.size()); 716 EXPECT_EQ(1u, images.size());
718 EXPECT_TRUE(discardable_image2 == images[0].image()); 717 EXPECT_TRUE(discardable_image2 == images[0].image());
719 } 718 }
720 719
721 } // namespace cc 720 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698