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 <vector> | 5 #include <vector> |
6 | 6 |
7 #include "cc/base/region.h" | 7 #include "cc/base/region.h" |
8 #include "cc/playback/display_list_raster_source.h" | 8 #include "cc/playback/display_list_raster_source.h" |
9 #include "cc/test/fake_content_layer_client.h" | 9 #include "cc/test/fake_content_layer_client.h" |
10 #include "cc/test/fake_display_list_recording_source.h" | 10 #include "cc/test/fake_display_list_recording_source.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 TEST_F(DisplayListRecordingSourceTest, DiscardablePixelRefsWithTransform) { | 22 TEST_F(DisplayListRecordingSourceTest, DiscardablePixelRefsWithTransform) { |
23 gfx::Size grid_cell_size(128, 128); | 23 gfx::Size grid_cell_size(128, 128); |
24 gfx::Rect recorded_viewport(256, 256); | 24 gfx::Rect recorded_viewport(256, 256); |
25 | 25 |
26 scoped_ptr<FakeDisplayListRecordingSource> recording_source = | 26 scoped_ptr<FakeDisplayListRecordingSource> recording_source = |
27 FakeDisplayListRecordingSource::CreateFilledRecordingSource( | 27 FakeDisplayListRecordingSource::CreateFilledRecordingSource( |
28 recorded_viewport.size()); | 28 recorded_viewport.size()); |
29 recording_source->SetGridCellSize(grid_cell_size); | 29 recording_source->SetGridCellSize(grid_cell_size); |
30 SkBitmap discardable_bitmap[2][2]; | 30 SkBitmap discardable_bitmap[2][2]; |
31 gfx::Transform identity_transform; | 31 gfx::Transform identity_transform; |
32 CreateBitmap(gfx::Size(32, 32), "discardable", &discardable_bitmap[0][0]); | 32 CreateDiscardableBitmap(gfx::Size(32, 32), &discardable_bitmap[0][0]); |
33 // Translate transform is equivalent to moving using point. | 33 // Translate transform is equivalent to moving using point. |
34 gfx::Transform translate_transform; | 34 gfx::Transform translate_transform; |
35 translate_transform.Translate(0, 130); | 35 translate_transform.Translate(0, 130); |
36 CreateBitmap(gfx::Size(32, 32), "discardable", &discardable_bitmap[1][0]); | 36 CreateDiscardableBitmap(gfx::Size(32, 32), &discardable_bitmap[1][0]); |
37 // This moves the bitmap to center of viewport and rotate, this would make | 37 // This moves the bitmap to center of viewport and rotate, this would make |
38 // this bitmap in all four tile grids. | 38 // this bitmap in all four tile grids. |
39 gfx::Transform rotate_transform; | 39 gfx::Transform rotate_transform; |
40 rotate_transform.Translate(112, 112); | 40 rotate_transform.Translate(112, 112); |
41 rotate_transform.Rotate(45); | 41 rotate_transform.Rotate(45); |
42 CreateBitmap(gfx::Size(32, 32), "discardable", &discardable_bitmap[1][1]); | 42 CreateDiscardableBitmap(gfx::Size(32, 32), &discardable_bitmap[1][1]); |
43 | 43 |
44 gfx::RectF rect(0, 0, 32, 32); | 44 gfx::RectF rect(0, 0, 32, 32); |
45 gfx::RectF translate_rect = rect; | 45 gfx::RectF translate_rect = rect; |
46 translate_transform.TransformRect(&translate_rect); | 46 translate_transform.TransformRect(&translate_rect); |
47 gfx::RectF rotate_rect = rect; | 47 gfx::RectF rotate_rect = rect; |
48 rotate_transform.TransformRect(&rotate_rect); | 48 rotate_transform.TransformRect(&rotate_rect); |
49 | 49 |
50 recording_source->add_draw_bitmap_with_transform(discardable_bitmap[0][0], | 50 recording_source->add_draw_bitmap_with_transform(discardable_bitmap[0][0], |
51 identity_transform); | 51 identity_transform); |
52 recording_source->add_draw_bitmap_with_transform(discardable_bitmap[1][0], | 52 recording_source->add_draw_bitmap_with_transform(discardable_bitmap[1][0], |
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
348 // layer's bottom edge. | 348 // layer's bottom edge. |
349 visible_rect.Offset(0, 231); | 349 visible_rect.Offset(0, 231); |
350 recording_source.UpdateAndExpandInvalidation( | 350 recording_source.UpdateAndExpandInvalidation( |
351 &client, &invalidation, layer_size, visible_rect, 0, | 351 &client, &invalidation, layer_size, visible_rect, 0, |
352 RecordingSource::RECORD_NORMALLY); | 352 RecordingSource::RECORD_NORMALLY); |
353 EXPECT_EQ(gfx::Rect(0, 0, 8256, 9000), recording_source.recorded_viewport()); | 353 EXPECT_EQ(gfx::Rect(0, 0, 8256, 9000), recording_source.recorded_viewport()); |
354 } | 354 } |
355 | 355 |
356 } // namespace | 356 } // namespace |
357 } // namespace cc | 357 } // namespace cc |
OLD | NEW |