OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #include <vector> | |
6 | |
7 #include "cc/resources/display_list_raster_source.h" | |
8 #include "cc/test/fake_display_list_recording_source.h" | |
9 #include "cc/test/fake_picture_pile.h" | |
10 #include "cc/test/fake_picture_pile_impl.h" | |
11 #include "cc/test/impl_side_painting_settings.h" | |
12 #include "cc/test/skia_common.h" | |
13 #include "testing/gtest/include/gtest/gtest.h" | |
14 | |
15 namespace cc { | |
16 namespace { | |
17 | |
18 template <class T> | |
19 scoped_ptr<T> CreateRecordingSource(const gfx::Rect& viewport, | |
20 const gfx::Size& grid_cell_size); | |
21 | |
22 template <> | |
23 scoped_ptr<FakePicturePile> CreateRecordingSource<FakePicturePile>( | |
24 const gfx::Rect& viewport, | |
25 const gfx::Size& grid_cell_size) { | |
26 return FakePicturePile::CreateFilledPile(grid_cell_size, viewport.size()); | |
27 } | |
28 | |
29 template <> | |
30 scoped_ptr<FakeDisplayListRecordingSource> CreateRecordingSource< | |
31 FakeDisplayListRecordingSource>(const gfx::Rect& viewport, | |
32 const gfx::Size& grid_cell_size) { | |
33 scoped_ptr<FakeDisplayListRecordingSource> recording_source = | |
34 FakeDisplayListRecordingSource::CreateRecordingSource(viewport); | |
35 recording_source->SetGridCellSize(grid_cell_size); | |
36 | |
37 return recording_source.Pass(); | |
38 } | |
39 | |
40 template <class T> | |
41 scoped_refptr<RasterSource> CreateRasterSource(T* recording_source); | |
42 | |
43 template <> | |
44 scoped_refptr<RasterSource> CreateRasterSource( | |
45 FakePicturePile* recording_source) { | |
46 return FakePicturePileImpl::CreateFromPile(recording_source, nullptr); | |
47 } | |
48 | |
49 template <> | |
50 scoped_refptr<RasterSource> CreateRasterSource( | |
51 FakeDisplayListRecordingSource* recording_source) { | |
52 bool can_use_lcd_text = true; | |
53 return DisplayListRasterSource::CreateFromDisplayListRecordingSource( | |
54 recording_source, can_use_lcd_text); | |
55 } | |
56 | |
57 template <typename T> | |
58 class RecordingSourceTest : public testing::Test {}; | |
59 | |
60 using testing::Types; | |
61 | |
62 typedef Types<FakePicturePile, FakeDisplayListRecordingSource> | |
63 RecordingSourceImplementations; | |
64 | |
65 TYPED_TEST_CASE(RecordingSourceTest, RecordingSourceImplementations); | |
66 | |
67 TYPED_TEST(RecordingSourceTest, NoGatherPixelRefEmptyPixelRefs) { | |
68 gfx::Size grid_cell_size(128, 128); | |
69 gfx::Rect recorded_viewport(0, 0, 256, 256); | |
70 | |
71 scoped_ptr<TypeParam> recording_source = | |
72 CreateRecordingSource<TypeParam>(recorded_viewport, grid_cell_size); | |
73 recording_source->SetGatherPixelRefs(false); | |
74 recording_source->Rerecord(); | |
75 | |
76 scoped_refptr<RasterSource> raster_source = | |
77 CreateRasterSource<TypeParam>(recording_source.get()); | |
78 | |
79 // If recording source do not gather pixel ref, raster source is not going to | |
80 // get pixel refs. | |
81 { | |
82 std::vector<SkPixelRef*> pixel_refs; | |
83 raster_source->GatherPixelRefs(recorded_viewport, 1.0, &pixel_refs); | |
84 EXPECT_TRUE(pixel_refs.empty()); | |
85 } | |
86 } | |
87 | |
88 TYPED_TEST(RecordingSourceTest, EmptyPixelRefs) { | |
89 gfx::Size grid_cell_size(128, 128); | |
90 gfx::Rect recorded_viewport(0, 0, 256, 256); | |
91 | |
92 scoped_ptr<TypeParam> recording_source = | |
93 CreateRecordingSource<TypeParam>(recorded_viewport, grid_cell_size); | |
94 recording_source->SetGatherPixelRefs(true); | |
95 recording_source->Rerecord(); | |
96 | |
97 scoped_refptr<RasterSource> raster_source = | |
98 CreateRasterSource<TypeParam>(recording_source.get()); | |
99 | |
100 // Tile sized iterators. | |
101 { | |
102 std::vector<SkPixelRef*> pixel_refs; | |
103 raster_source->GatherPixelRefs(gfx::Rect(0, 0, 128, 128), 1.0, &pixel_refs); | |
104 EXPECT_TRUE(pixel_refs.empty()); | |
105 } | |
106 { | |
107 std::vector<SkPixelRef*> pixel_refs; | |
108 raster_source->GatherPixelRefs(gfx::Rect(0, 0, 256, 256), 2.0, &pixel_refs); | |
109 EXPECT_TRUE(pixel_refs.empty()); | |
110 } | |
111 { | |
112 std::vector<SkPixelRef*> pixel_refs; | |
113 raster_source->GatherPixelRefs(gfx::Rect(0, 0, 64, 64), 0.5, &pixel_refs); | |
114 EXPECT_TRUE(pixel_refs.empty()); | |
115 } | |
116 // Shifted tile sized iterators. | |
117 { | |
118 std::vector<SkPixelRef*> pixel_refs; | |
119 raster_source->GatherPixelRefs(gfx::Rect(140, 140, 128, 128), 1.0, | |
120 &pixel_refs); | |
121 EXPECT_TRUE(pixel_refs.empty()); | |
122 } | |
123 { | |
124 std::vector<SkPixelRef*> pixel_refs; | |
125 raster_source->GatherPixelRefs(gfx::Rect(280, 280, 256, 256), 2.0, | |
126 &pixel_refs); | |
127 EXPECT_TRUE(pixel_refs.empty()); | |
128 } | |
129 { | |
130 std::vector<SkPixelRef*> pixel_refs; | |
131 raster_source->GatherPixelRefs(gfx::Rect(70, 70, 64, 64), 0.5, &pixel_refs); | |
132 EXPECT_TRUE(pixel_refs.empty()); | |
133 } | |
134 // Layer sized iterators. | |
135 { | |
136 std::vector<SkPixelRef*> pixel_refs; | |
137 raster_source->GatherPixelRefs(gfx::Rect(0, 0, 256, 256), 1.0, &pixel_refs); | |
138 EXPECT_TRUE(pixel_refs.empty()); | |
139 } | |
140 { | |
141 std::vector<SkPixelRef*> pixel_refs; | |
142 raster_source->GatherPixelRefs(gfx::Rect(0, 0, 512, 512), 2.0, &pixel_refs); | |
143 EXPECT_TRUE(pixel_refs.empty()); | |
144 } | |
145 { | |
146 std::vector<SkPixelRef*> pixel_refs; | |
147 raster_source->GatherPixelRefs(gfx::Rect(0, 0, 128, 128), 0.5, &pixel_refs); | |
148 EXPECT_TRUE(pixel_refs.empty()); | |
149 } | |
150 } | |
151 | |
152 TYPED_TEST(RecordingSourceTest, NoDiscardablePixelRefs) { | |
153 gfx::Size grid_cell_size(128, 128); | |
154 gfx::Rect recorded_viewport(0, 0, 256, 256); | |
155 | |
156 scoped_ptr<TypeParam> recording_source = | |
157 CreateRecordingSource<TypeParam>(recorded_viewport, grid_cell_size); | |
158 | |
159 SkPaint simple_paint; | |
160 simple_paint.setColor(SkColorSetARGB(255, 12, 23, 34)); | |
161 | |
162 SkBitmap non_discardable_bitmap; | |
163 CreateBitmap(gfx::Size(128, 128), "notdiscardable", &non_discardable_bitmap); | |
164 | |
165 recording_source->add_draw_rect_with_paint(gfx::Rect(0, 0, 256, 256), | |
166 simple_paint); | |
167 recording_source->add_draw_rect_with_paint(gfx::Rect(128, 128, 512, 512), | |
168 simple_paint); | |
169 recording_source->add_draw_rect_with_paint(gfx::Rect(512, 0, 256, 256), | |
170 simple_paint); | |
171 recording_source->add_draw_rect_with_paint(gfx::Rect(0, 512, 256, 256), | |
172 simple_paint); | |
173 recording_source->add_draw_bitmap(non_discardable_bitmap, gfx::Point(128, 0)); | |
174 recording_source->add_draw_bitmap(non_discardable_bitmap, gfx::Point(0, 128)); | |
175 recording_source->add_draw_bitmap(non_discardable_bitmap, | |
176 gfx::Point(150, 150)); | |
177 recording_source->SetGatherPixelRefs(true); | |
178 recording_source->Rerecord(); | |
179 | |
180 scoped_refptr<RasterSource> raster_source = | |
181 CreateRasterSource<TypeParam>(recording_source.get()); | |
182 | |
183 // Tile sized iterators. | |
184 { | |
185 std::vector<SkPixelRef*> pixel_refs; | |
186 raster_source->GatherPixelRefs(gfx::Rect(0, 0, 128, 128), 1.0, &pixel_refs); | |
187 EXPECT_TRUE(pixel_refs.empty()); | |
188 } | |
189 { | |
190 std::vector<SkPixelRef*> pixel_refs; | |
191 raster_source->GatherPixelRefs(gfx::Rect(0, 0, 256, 256), 2.0, &pixel_refs); | |
192 EXPECT_TRUE(pixel_refs.empty()); | |
193 } | |
194 { | |
195 std::vector<SkPixelRef*> pixel_refs; | |
196 raster_source->GatherPixelRefs(gfx::Rect(0, 0, 64, 64), 0.5, &pixel_refs); | |
197 EXPECT_TRUE(pixel_refs.empty()); | |
198 } | |
199 // Shifted tile sized iterators. | |
200 { | |
201 std::vector<SkPixelRef*> pixel_refs; | |
202 raster_source->GatherPixelRefs(gfx::Rect(140, 140, 128, 128), 1.0, | |
203 &pixel_refs); | |
204 EXPECT_TRUE(pixel_refs.empty()); | |
205 } | |
206 { | |
207 std::vector<SkPixelRef*> pixel_refs; | |
208 raster_source->GatherPixelRefs(gfx::Rect(280, 280, 256, 256), 2.0, | |
209 &pixel_refs); | |
210 EXPECT_TRUE(pixel_refs.empty()); | |
211 } | |
212 { | |
213 std::vector<SkPixelRef*> pixel_refs; | |
214 raster_source->GatherPixelRefs(gfx::Rect(70, 70, 64, 64), 0.5, &pixel_refs); | |
215 EXPECT_TRUE(pixel_refs.empty()); | |
216 } | |
217 // Layer sized iterators. | |
218 { | |
219 std::vector<SkPixelRef*> pixel_refs; | |
220 raster_source->GatherPixelRefs(gfx::Rect(0, 0, 256, 256), 1.0, &pixel_refs); | |
221 EXPECT_TRUE(pixel_refs.empty()); | |
222 } | |
223 { | |
224 std::vector<SkPixelRef*> pixel_refs; | |
225 raster_source->GatherPixelRefs(gfx::Rect(0, 0, 512, 512), 2.0, &pixel_refs); | |
226 EXPECT_TRUE(pixel_refs.empty()); | |
227 } | |
228 { | |
229 std::vector<SkPixelRef*> pixel_refs; | |
230 raster_source->GatherPixelRefs(gfx::Rect(0, 0, 128, 128), 0.5, &pixel_refs); | |
231 EXPECT_TRUE(pixel_refs.empty()); | |
232 } | |
233 } | |
234 | |
235 TYPED_TEST(RecordingSourceTest, DiscardablePixelRefs) { | |
236 gfx::Size grid_cell_size(128, 128); | |
237 gfx::Rect recorded_viewport(0, 0, 256, 256); | |
238 | |
239 scoped_ptr<TypeParam> recording_source = | |
240 CreateRecordingSource<TypeParam>(recorded_viewport, grid_cell_size); | |
241 | |
242 SkBitmap discardable_bitmap[2][2]; | |
243 CreateBitmap(gfx::Size(32, 32), "discardable", &discardable_bitmap[0][0]); | |
244 CreateBitmap(gfx::Size(32, 32), "discardable", &discardable_bitmap[1][0]); | |
245 CreateBitmap(gfx::Size(32, 32), "discardable", &discardable_bitmap[1][1]); | |
246 | |
247 // Discardable pixel refs are found in the following cells: | |
248 // |---|---| | |
249 // | x | | | |
250 // |---|---| | |
251 // | x | x | | |
252 // |---|---| | |
253 recording_source->add_draw_bitmap(discardable_bitmap[0][0], gfx::Point(0, 0)); | |
254 recording_source->add_draw_bitmap(discardable_bitmap[1][0], | |
255 gfx::Point(0, 130)); | |
256 recording_source->add_draw_bitmap(discardable_bitmap[1][1], | |
257 gfx::Point(140, 140)); | |
258 recording_source->SetGatherPixelRefs(true); | |
259 recording_source->Rerecord(); | |
260 | |
261 scoped_refptr<RasterSource> raster_source = | |
262 CreateRasterSource<TypeParam>(recording_source.get()); | |
263 | |
264 // Tile sized iterators. These should find only one pixel ref. | |
265 { | |
266 std::vector<SkPixelRef*> pixel_refs; | |
267 raster_source->GatherPixelRefs(gfx::Rect(0, 0, 128, 128), 1.0, &pixel_refs); | |
268 EXPECT_FALSE(pixel_refs.empty()); | |
269 EXPECT_TRUE(pixel_refs[0] == discardable_bitmap[0][0].pixelRef()); | |
270 EXPECT_EQ(1u, pixel_refs.size()); | |
271 } | |
272 { | |
273 std::vector<SkPixelRef*> pixel_refs; | |
274 raster_source->GatherPixelRefs(gfx::Rect(0, 0, 256, 256), 2.0, &pixel_refs); | |
275 EXPECT_FALSE(pixel_refs.empty()); | |
276 EXPECT_TRUE(pixel_refs[0] == discardable_bitmap[0][0].pixelRef()); | |
277 EXPECT_EQ(1u, pixel_refs.size()); | |
278 } | |
279 { | |
280 std::vector<SkPixelRef*> pixel_refs; | |
281 raster_source->GatherPixelRefs(gfx::Rect(0, 0, 64, 64), 0.5, &pixel_refs); | |
282 EXPECT_FALSE(pixel_refs.empty()); | |
283 EXPECT_TRUE(pixel_refs[0] == discardable_bitmap[0][0].pixelRef()); | |
284 EXPECT_EQ(1u, pixel_refs.size()); | |
285 } | |
286 | |
287 // Shifted tile sized iterators. These should find only one pixel ref. | |
288 { | |
289 std::vector<SkPixelRef*> pixel_refs; | |
290 raster_source->GatherPixelRefs(gfx::Rect(140, 140, 128, 128), 1.0, | |
291 &pixel_refs); | |
292 EXPECT_FALSE(pixel_refs.empty()); | |
293 EXPECT_TRUE(pixel_refs[0] == discardable_bitmap[1][1].pixelRef()); | |
294 EXPECT_EQ(1u, pixel_refs.size()); | |
295 } | |
296 { | |
297 std::vector<SkPixelRef*> pixel_refs; | |
298 raster_source->GatherPixelRefs(gfx::Rect(280, 280, 256, 256), 2.0, | |
299 &pixel_refs); | |
300 EXPECT_FALSE(pixel_refs.empty()); | |
301 EXPECT_TRUE(pixel_refs[0] == discardable_bitmap[1][1].pixelRef()); | |
302 EXPECT_EQ(1u, pixel_refs.size()); | |
303 } | |
304 { | |
305 std::vector<SkPixelRef*> pixel_refs; | |
306 raster_source->GatherPixelRefs(gfx::Rect(70, 70, 64, 64), 0.5, &pixel_refs); | |
307 EXPECT_FALSE(pixel_refs.empty()); | |
308 EXPECT_TRUE(pixel_refs[0] == discardable_bitmap[1][1].pixelRef()); | |
309 EXPECT_EQ(1u, pixel_refs.size()); | |
310 } | |
311 | |
312 // Ensure there's no discardable pixel refs in the empty cell | |
313 { | |
314 std::vector<SkPixelRef*> pixel_refs; | |
315 raster_source->GatherPixelRefs(gfx::Rect(140, 0, 128, 128), 1.0, | |
316 &pixel_refs); | |
317 EXPECT_TRUE(pixel_refs.empty()); | |
318 } | |
319 | |
320 // Layer sized iterators. These should find all 3 pixel refs. | |
321 { | |
322 std::vector<SkPixelRef*> pixel_refs; | |
323 raster_source->GatherPixelRefs(gfx::Rect(0, 0, 256, 256), 1.0, &pixel_refs); | |
324 EXPECT_FALSE(pixel_refs.empty()); | |
325 EXPECT_TRUE(pixel_refs[0] == discardable_bitmap[0][0].pixelRef()); | |
326 EXPECT_TRUE(pixel_refs[1] == discardable_bitmap[1][0].pixelRef()); | |
327 EXPECT_TRUE(pixel_refs[2] == discardable_bitmap[1][1].pixelRef()); | |
328 EXPECT_EQ(3u, pixel_refs.size()); | |
329 } | |
330 { | |
331 std::vector<SkPixelRef*> pixel_refs; | |
332 raster_source->GatherPixelRefs(gfx::Rect(0, 0, 512, 512), 2.0, &pixel_refs); | |
333 EXPECT_FALSE(pixel_refs.empty()); | |
334 EXPECT_TRUE(pixel_refs[0] == discardable_bitmap[0][0].pixelRef()); | |
335 EXPECT_TRUE(pixel_refs[1] == discardable_bitmap[1][0].pixelRef()); | |
336 EXPECT_TRUE(pixel_refs[2] == discardable_bitmap[1][1].pixelRef()); | |
337 EXPECT_EQ(3u, pixel_refs.size()); | |
338 } | |
339 { | |
340 std::vector<SkPixelRef*> pixel_refs; | |
341 raster_source->GatherPixelRefs(gfx::Rect(0, 0, 128, 128), 0.5, &pixel_refs); | |
342 EXPECT_FALSE(pixel_refs.empty()); | |
343 EXPECT_TRUE(pixel_refs[0] == discardable_bitmap[0][0].pixelRef()); | |
344 EXPECT_TRUE(pixel_refs[1] == discardable_bitmap[1][0].pixelRef()); | |
345 EXPECT_TRUE(pixel_refs[2] == discardable_bitmap[1][1].pixelRef()); | |
346 EXPECT_EQ(3u, pixel_refs.size()); | |
347 } | |
348 } | |
349 | |
350 TYPED_TEST(RecordingSourceTest, DiscardablePixelRefsBaseNonDiscardable) { | |
351 gfx::Size grid_cell_size(256, 256); | |
352 gfx::Rect recorded_viewport(0, 0, 512, 512); | |
353 | |
354 scoped_ptr<TypeParam> recording_source = | |
355 CreateRecordingSource<TypeParam>(recorded_viewport, grid_cell_size); | |
356 | |
357 SkBitmap non_discardable_bitmap; | |
358 CreateBitmap(gfx::Size(512, 512), "notdiscardable", &non_discardable_bitmap); | |
359 | |
360 SkBitmap discardable_bitmap[2][2]; | |
361 CreateBitmap(gfx::Size(128, 128), "discardable", &discardable_bitmap[0][0]); | |
362 CreateBitmap(gfx::Size(128, 128), "discardable", &discardable_bitmap[0][1]); | |
363 CreateBitmap(gfx::Size(128, 128), "discardable", &discardable_bitmap[1][1]); | |
364 | |
365 // One large non-discardable bitmap covers the whole grid. | |
366 // Discardable pixel refs are found in the following cells: | |
367 // |---|---| | |
368 // | x | x | | |
369 // |---|---| | |
370 // | | x | | |
371 // |---|---| | |
372 recording_source->add_draw_bitmap(non_discardable_bitmap, gfx::Point(0, 0)); | |
373 recording_source->add_draw_bitmap(discardable_bitmap[0][0], gfx::Point(0, 0)); | |
374 recording_source->add_draw_bitmap(discardable_bitmap[0][1], | |
375 gfx::Point(260, 0)); | |
376 recording_source->add_draw_bitmap(discardable_bitmap[1][1], | |
377 gfx::Point(260, 260)); | |
378 recording_source->SetGatherPixelRefs(true); | |
379 recording_source->Rerecord(); | |
380 | |
381 scoped_refptr<RasterSource> raster_source = | |
382 CreateRasterSource<TypeParam>(recording_source.get()); | |
383 | |
384 // Tile sized iterators. These should find only one pixel ref. | |
385 { | |
386 std::vector<SkPixelRef*> pixel_refs; | |
387 raster_source->GatherPixelRefs(gfx::Rect(0, 0, 256, 256), 1.0, &pixel_refs); | |
388 EXPECT_FALSE(pixel_refs.empty()); | |
389 EXPECT_TRUE(pixel_refs[0] == discardable_bitmap[0][0].pixelRef()); | |
390 EXPECT_EQ(1u, pixel_refs.size()); | |
391 } | |
392 { | |
393 std::vector<SkPixelRef*> pixel_refs; | |
394 raster_source->GatherPixelRefs(gfx::Rect(0, 0, 512, 512), 2.0, &pixel_refs); | |
395 EXPECT_FALSE(pixel_refs.empty()); | |
396 EXPECT_TRUE(pixel_refs[0] == discardable_bitmap[0][0].pixelRef()); | |
397 EXPECT_EQ(1u, pixel_refs.size()); | |
398 } | |
399 { | |
400 std::vector<SkPixelRef*> pixel_refs; | |
401 raster_source->GatherPixelRefs(gfx::Rect(0, 0, 128, 128), 0.5, &pixel_refs); | |
402 EXPECT_FALSE(pixel_refs.empty()); | |
403 EXPECT_TRUE(pixel_refs[0] == discardable_bitmap[0][0].pixelRef()); | |
404 EXPECT_EQ(1u, pixel_refs.size()); | |
405 } | |
406 // Shifted tile sized iterators. These should find only one pixel ref. | |
407 { | |
408 std::vector<SkPixelRef*> pixel_refs; | |
409 raster_source->GatherPixelRefs(gfx::Rect(260, 260, 256, 256), 1.0, | |
410 &pixel_refs); | |
411 EXPECT_FALSE(pixel_refs.empty()); | |
412 EXPECT_TRUE(pixel_refs[0] == discardable_bitmap[1][1].pixelRef()); | |
413 EXPECT_EQ(1u, pixel_refs.size()); | |
414 } | |
415 { | |
416 std::vector<SkPixelRef*> pixel_refs; | |
417 raster_source->GatherPixelRefs(gfx::Rect(520, 520, 512, 512), 2.0, | |
418 &pixel_refs); | |
419 EXPECT_FALSE(pixel_refs.empty()); | |
420 EXPECT_TRUE(pixel_refs[0] == discardable_bitmap[1][1].pixelRef()); | |
421 EXPECT_EQ(1u, pixel_refs.size()); | |
422 } | |
423 { | |
424 std::vector<SkPixelRef*> pixel_refs; | |
425 raster_source->GatherPixelRefs(gfx::Rect(130, 130, 128, 128), 0.5, | |
426 &pixel_refs); | |
427 EXPECT_FALSE(pixel_refs.empty()); | |
428 EXPECT_TRUE(pixel_refs[0] == discardable_bitmap[1][1].pixelRef()); | |
429 EXPECT_EQ(1u, pixel_refs.size()); | |
430 } | |
431 // Ensure there's no discardable pixel refs in the empty cell | |
432 { | |
433 std::vector<SkPixelRef*> pixel_refs; | |
434 raster_source->GatherPixelRefs(gfx::Rect(0, 256, 256, 256), 1.0, | |
435 &pixel_refs); | |
436 EXPECT_TRUE(pixel_refs.empty()); | |
437 } | |
438 // Layer sized iterators. These should find three pixel ref. | |
439 { | |
440 std::vector<SkPixelRef*> pixel_refs; | |
441 raster_source->GatherPixelRefs(gfx::Rect(0, 0, 512, 512), 1.0, &pixel_refs); | |
442 EXPECT_FALSE(pixel_refs.empty()); | |
443 EXPECT_TRUE(pixel_refs[0] == discardable_bitmap[0][0].pixelRef()); | |
444 EXPECT_TRUE(pixel_refs[1] == discardable_bitmap[0][1].pixelRef()); | |
445 EXPECT_TRUE(pixel_refs[2] == discardable_bitmap[1][1].pixelRef()); | |
446 EXPECT_EQ(3u, pixel_refs.size()); | |
447 } | |
448 { | |
449 std::vector<SkPixelRef*> pixel_refs; | |
450 raster_source->GatherPixelRefs(gfx::Rect(0, 0, 1024, 1024), 2.0, | |
451 &pixel_refs); | |
452 EXPECT_FALSE(pixel_refs.empty()); | |
453 EXPECT_TRUE(pixel_refs[0] == discardable_bitmap[0][0].pixelRef()); | |
454 EXPECT_TRUE(pixel_refs[1] == discardable_bitmap[0][1].pixelRef()); | |
455 EXPECT_TRUE(pixel_refs[2] == discardable_bitmap[1][1].pixelRef()); | |
456 EXPECT_EQ(3u, pixel_refs.size()); | |
457 } | |
458 { | |
459 std::vector<SkPixelRef*> pixel_refs; | |
460 raster_source->GatherPixelRefs(gfx::Rect(0, 0, 256, 256), 0.5, &pixel_refs); | |
461 EXPECT_FALSE(pixel_refs.empty()); | |
462 EXPECT_TRUE(pixel_refs[0] == discardable_bitmap[0][0].pixelRef()); | |
463 EXPECT_TRUE(pixel_refs[1] == discardable_bitmap[0][1].pixelRef()); | |
464 EXPECT_TRUE(pixel_refs[2] == discardable_bitmap[1][1].pixelRef()); | |
465 EXPECT_EQ(3u, pixel_refs.size()); | |
466 } | |
467 } | |
468 | |
469 } // namespace | |
470 } // namespace cc | |
OLD | NEW |