| OLD | NEW |
| 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/playback/discardable_image_map.h" | 5 #include "cc/playback/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 25 matching lines...) Expand all Loading... |
| 36 }; | 36 }; |
| 37 | 37 |
| 38 } // namespace | 38 } // namespace |
| 39 | 39 |
| 40 class DiscardableImageMapTest : public testing::Test { | 40 class DiscardableImageMapTest : public testing::Test { |
| 41 public: | 41 public: |
| 42 std::vector<PositionScaleDrawImage> GetDiscardableImagesInRect( | 42 std::vector<PositionScaleDrawImage> GetDiscardableImagesInRect( |
| 43 const DiscardableImageMap& image_map, | 43 const DiscardableImageMap& image_map, |
| 44 const gfx::Rect& rect) { | 44 const gfx::Rect& rect) { |
| 45 std::vector<DrawImage> draw_images; | 45 std::vector<DrawImage> draw_images; |
| 46 image_map.GetDiscardableImagesInRect(rect, gfx::SizeF(1.f, 1.f), | 46 image_map.GetDiscardableImagesInRect(rect, 1.f, &draw_images); |
| 47 &draw_images); | |
| 48 | 47 |
| 49 std::vector<size_t> indices; | 48 std::vector<size_t> indices; |
| 50 image_map.images_rtree_.Search(rect, &indices); | 49 image_map.images_rtree_.Search(rect, &indices); |
| 51 std::vector<PositionScaleDrawImage> position_draw_images; | 50 std::vector<PositionScaleDrawImage> position_draw_images; |
| 52 for (size_t index : indices) { | 51 for (size_t index : indices) { |
| 53 position_draw_images.push_back( | 52 position_draw_images.push_back( |
| 54 PositionScaleDrawImage(image_map.all_images_[index].first.image(), | 53 PositionScaleDrawImage(image_map.all_images_[index].first.image(), |
| 55 image_map.all_images_[index].second, | 54 image_map.all_images_[index].second, |
| 56 image_map.all_images_[index].first.scale())); | 55 image_map.all_images_[index].first.scale())); |
| 57 } | 56 } |
| (...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 537 EXPECT_EQ(gfx::Rect(512 + 6, 2 * 512 + 6, 500, 500), images[1].image_rect); | 536 EXPECT_EQ(gfx::Rect(512 + 6, 2 * 512 + 6, 500, 500), images[1].image_rect); |
| 538 EXPECT_TRUE(images[2].image == discardable_image[2][3]); | 537 EXPECT_TRUE(images[2].image == discardable_image[2][3]); |
| 539 EXPECT_EQ(gfx::Rect(3 * 512 + 6, 2 * 512 + 6, 500, 500), | 538 EXPECT_EQ(gfx::Rect(3 * 512 + 6, 2 * 512 + 6, 500, 500), |
| 540 images[2].image_rect); | 539 images[2].image_rect); |
| 541 EXPECT_TRUE(images[3].image == discardable_image[3][2]); | 540 EXPECT_TRUE(images[3].image == discardable_image[3][2]); |
| 542 EXPECT_EQ(gfx::Rect(2 * 512 + 6, 3 * 512 + 6, 500, 500), | 541 EXPECT_EQ(gfx::Rect(2 * 512 + 6, 3 * 512 + 6, 500, 500), |
| 543 images[3].image_rect); | 542 images[3].image_rect); |
| 544 } | 543 } |
| 545 | 544 |
| 546 } // namespace cc | 545 } // namespace cc |
| OLD | NEW |