OLD | NEW |
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 "base/memory/scoped_ptr.h" | 5 #include "base/memory/scoped_ptr.h" |
6 #include "cc/playback/display_list_raster_source.h" | 6 #include "cc/playback/display_list_raster_source.h" |
7 #include "cc/test/fake_display_list_recording_source.h" | 7 #include "cc/test/fake_display_list_recording_source.h" |
8 #include "cc/test/skia_common.h" | 8 #include "cc/test/skia_common.h" |
9 #include "skia/ext/refptr.h" | 9 #include "skia/ext/refptr.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 EXPECT_EQ(analysis.solid_color, SkColorSetARGB(0, 0, 0, 0)); | 169 EXPECT_EQ(analysis.solid_color, SkColorSetARGB(0, 0, 0, 0)); |
170 } | 170 } |
171 | 171 |
172 TEST(DisplayListRasterSourceTest, PixelRefIteratorDiscardableRefsOneTile) { | 172 TEST(DisplayListRasterSourceTest, PixelRefIteratorDiscardableRefsOneTile) { |
173 gfx::Size layer_bounds(512, 512); | 173 gfx::Size layer_bounds(512, 512); |
174 | 174 |
175 scoped_ptr<FakeDisplayListRecordingSource> recording_source = | 175 scoped_ptr<FakeDisplayListRecordingSource> recording_source = |
176 FakeDisplayListRecordingSource::CreateFilledRecordingSource(layer_bounds); | 176 FakeDisplayListRecordingSource::CreateFilledRecordingSource(layer_bounds); |
177 | 177 |
178 SkBitmap discardable_bitmap[2][2]; | 178 SkBitmap discardable_bitmap[2][2]; |
179 CreateBitmap(gfx::Size(32, 32), "discardable", &discardable_bitmap[0][0]); | 179 CreateDiscardableBitmap(gfx::Size(32, 32), &discardable_bitmap[0][0]); |
180 CreateBitmap(gfx::Size(32, 32), "discardable", &discardable_bitmap[0][1]); | 180 CreateDiscardableBitmap(gfx::Size(32, 32), &discardable_bitmap[0][1]); |
181 CreateBitmap(gfx::Size(32, 32), "discardable", &discardable_bitmap[1][1]); | 181 CreateDiscardableBitmap(gfx::Size(32, 32), &discardable_bitmap[1][1]); |
182 | 182 |
183 // Discardable pixel refs are found in the following cells: | 183 // Discardable pixel refs are found in the following cells: |
184 // |---|---| | 184 // |---|---| |
185 // | x | x | | 185 // | x | x | |
186 // |---|---| | 186 // |---|---| |
187 // | | x | | 187 // | | x | |
188 // |---|---| | 188 // |---|---| |
189 recording_source->add_draw_bitmap(discardable_bitmap[0][0], gfx::Point(0, 0)); | 189 recording_source->add_draw_bitmap(discardable_bitmap[0][0], gfx::Point(0, 0)); |
190 recording_source->add_draw_bitmap(discardable_bitmap[0][1], | 190 recording_source->add_draw_bitmap(discardable_bitmap[0][1], |
191 gfx::Point(260, 0)); | 191 gfx::Point(260, 0)); |
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
594 scoped_refptr<DisplayListRasterSource> raster = | 594 scoped_refptr<DisplayListRasterSource> raster = |
595 DisplayListRasterSource::CreateFromDisplayListRecordingSource( | 595 DisplayListRasterSource::CreateFromDisplayListRecordingSource( |
596 recording_source.get(), false); | 596 recording_source.get(), false); |
597 size_t total_memory_usage = raster->GetPictureMemoryUsage(); | 597 size_t total_memory_usage = raster->GetPictureMemoryUsage(); |
598 EXPECT_GE(total_memory_usage, kReportedMemoryUsageInBytes); | 598 EXPECT_GE(total_memory_usage, kReportedMemoryUsageInBytes); |
599 EXPECT_LT(total_memory_usage, 2 * kReportedMemoryUsageInBytes); | 599 EXPECT_LT(total_memory_usage, 2 * kReportedMemoryUsageInBytes); |
600 } | 600 } |
601 | 601 |
602 } // namespace | 602 } // namespace |
603 } // namespace cc | 603 } // namespace cc |
OLD | NEW |