OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/display_item_list.h" | 5 #include "cc/playback/display_item_list.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
416 | 416 |
417 TEST(DisplayItemListTest, FilterItem) { | 417 TEST(DisplayItemListTest, FilterItem) { |
418 gfx::Rect layer_rect(100, 100); | 418 gfx::Rect layer_rect(100, 100); |
419 FilterOperations filters; | 419 FilterOperations filters; |
420 unsigned char pixels[4 * 100 * 100] = {0}; | 420 unsigned char pixels[4 * 100 * 100] = {0}; |
421 DisplayItemListSettings settings; | 421 DisplayItemListSettings settings; |
422 settings.use_cached_picture = true; | 422 settings.use_cached_picture = true; |
423 scoped_refptr<DisplayItemList> list = | 423 scoped_refptr<DisplayItemList> list = |
424 DisplayItemList::Create(layer_rect, settings); | 424 DisplayItemList::Create(layer_rect, settings); |
425 | 425 |
426 skia::RefPtr<SkSurface> source_surface = | 426 sk_sp<SkSurface> source_surface = SkSurface::MakeRasterN32Premul(50, 50); |
427 skia::AdoptRef(SkSurface::NewRasterN32Premul(50, 50)); | |
428 SkCanvas* source_canvas = source_surface->getCanvas(); | 427 SkCanvas* source_canvas = source_surface->getCanvas(); |
429 source_canvas->clear(SkColorSetRGB(128, 128, 128)); | 428 source_canvas->clear(SkColorSetRGB(128, 128, 128)); |
430 skia::RefPtr<SkImage> source_image = | 429 skia::RefPtr<SkImage> source_image = |
431 skia::AdoptRef(source_surface->newImageSnapshot()); | 430 skia::AdoptRef(source_surface->newImageSnapshot()); |
432 | 431 |
433 // For most SkImageFilters, the |dst| bounds computed by computeFastBounds are | 432 // For most SkImageFilters, the |dst| bounds computed by computeFastBounds are |
434 // dependent on the provided |src| bounds. This means, for example, that | 433 // dependent on the provided |src| bounds. This means, for example, that |
435 // translating |src| results in a corresponding translation of |dst|. But this | 434 // translating |src| results in a corresponding translation of |dst|. But this |
436 // is not the case for all SkImageFilters; for some of them (e.g. | 435 // is not the case for all SkImageFilters; for some of them (e.g. |
437 // SkImageSource), the computation of |dst| in computeFastBounds doesn't | 436 // SkImageSource), the computation of |dst| in computeFastBounds doesn't |
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
753 | 752 |
754 value = list->AsValue(false)->ToString(); | 753 value = list->AsValue(false)->ToString(); |
755 EXPECT_EQ(value.find("\"items\":"), std::string::npos); | 754 EXPECT_EQ(value.find("\"items\":"), std::string::npos); |
756 EXPECT_NE(value.find("\"layer_rect\":[0,0,0,0]"), std::string::npos); | 755 EXPECT_NE(value.find("\"layer_rect\":[0,0,0,0]"), std::string::npos); |
757 // There should be no skp64 entry present as the items aren't included and the | 756 // There should be no skp64 entry present as the items aren't included and the |
758 // layer rect is empty. | 757 // layer rect is empty. |
759 EXPECT_EQ(value.find("\"skp64\":"), std::string::npos); | 758 EXPECT_EQ(value.find("\"skp64\":"), std::string::npos); |
760 } | 759 } |
761 | 760 |
762 } // namespace cc | 761 } // namespace cc |
OLD | NEW |