Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(130)

Side by Side Diff: cc/playback/picture_pile_impl_unittest.cc

Issue 1294673006: Update GatherPixelRefDevice to the new SkImage/SkPixelRef API (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: update cc_unittests Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/test/fake_picture_pile_impl.h" 6 #include "cc/test/fake_picture_pile_impl.h"
7 #include "cc/test/skia_common.h" 7 #include "cc/test/skia_common.h"
8 #include "skia/ext/refptr.h" 8 #include "skia/ext/refptr.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 #include "third_party/skia/include/core/SkPixelRef.h" 10 #include "third_party/skia/include/core/SkPixelRef.h"
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 } 160 }
161 161
162 TEST(PicturePileImplTest, PixelRefIteratorDiscardableRefsOneTile) { 162 TEST(PicturePileImplTest, PixelRefIteratorDiscardableRefsOneTile) {
163 gfx::Size tile_size(256, 256); 163 gfx::Size tile_size(256, 256);
164 gfx::Size layer_bounds(512, 512); 164 gfx::Size layer_bounds(512, 512);
165 165
166 scoped_ptr<FakePicturePile> recording_source = 166 scoped_ptr<FakePicturePile> recording_source =
167 FakePicturePile::CreateFilledPile(tile_size, layer_bounds); 167 FakePicturePile::CreateFilledPile(tile_size, layer_bounds);
168 168
169 SkBitmap discardable_bitmap[2][2]; 169 SkBitmap discardable_bitmap[2][2];
170 CreateBitmap(gfx::Size(32, 32), "discardable", &discardable_bitmap[0][0]); 170 CreateDiscardableBitmap(gfx::Size(32, 32), &discardable_bitmap[0][0]);
171 CreateBitmap(gfx::Size(32, 32), "discardable", &discardable_bitmap[0][1]); 171 CreateDiscardableBitmap(gfx::Size(32, 32), &discardable_bitmap[0][1]);
172 CreateBitmap(gfx::Size(32, 32), "discardable", &discardable_bitmap[1][1]); 172 CreateDiscardableBitmap(gfx::Size(32, 32), &discardable_bitmap[1][1]);
173 173
174 // Discardable pixel refs are found in the following cells: 174 // Discardable pixel refs are found in the following cells:
175 // |---|---| 175 // |---|---|
176 // | x | x | 176 // | x | x |
177 // |---|---| 177 // |---|---|
178 // | | x | 178 // | | x |
179 // |---|---| 179 // |---|---|
180 recording_source->add_draw_bitmap(discardable_bitmap[0][0], gfx::Point(0, 0)); 180 recording_source->add_draw_bitmap(discardable_bitmap[0][0], gfx::Point(0, 0));
181 recording_source->add_draw_bitmap(discardable_bitmap[0][1], 181 recording_source->add_draw_bitmap(discardable_bitmap[0][1],
182 gfx::Point(260, 0)); 182 gfx::Point(260, 0));
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
523 recording_source->tiling().TileBounds(2, 0), 523 recording_source->tiling().TileBounds(2, 0),
524 }; 524 };
525 gfx::RectF expected_rects[] = { 525 gfx::RectF expected_rects[] = {
526 gfx::RectF(recording_source->tiling().TileBounds(0, 0)), 526 gfx::RectF(recording_source->tiling().TileBounds(0, 0)),
527 gfx::RectF(recording_source->tiling().TileBounds(1, 0)), 527 gfx::RectF(recording_source->tiling().TileBounds(1, 0)),
528 gfx::RectF(recording_source->tiling().TileBounds(2, 0)), 528 gfx::RectF(recording_source->tiling().TileBounds(2, 0)),
529 }; 529 };
530 SkBitmap discardable_bitmap[arraysize(bitmap_rects)]; 530 SkBitmap discardable_bitmap[arraysize(bitmap_rects)];
531 531
532 for (size_t i = 0; i < arraysize(bitmap_rects); ++i) { 532 for (size_t i = 0; i < arraysize(bitmap_rects); ++i) {
533 CreateBitmap(bitmap_rects[i].size(), "discardable", &discardable_bitmap[i]); 533 CreateDiscardableBitmap(bitmap_rects[i].size(), &discardable_bitmap[i]);
534 recording_source->add_draw_bitmap(discardable_bitmap[i], 534 recording_source->add_draw_bitmap(discardable_bitmap[i],
535 bitmap_rects[i].origin()); 535 bitmap_rects[i].origin());
536 } 536 }
537 537
538 recording_source->SetGatherPixelRefs(true); 538 recording_source->SetGatherPixelRefs(true);
539 recording_source->Rerecord(); 539 recording_source->Rerecord();
540 540
541 scoped_refptr<FakePicturePileImpl> pile = 541 scoped_refptr<FakePicturePileImpl> pile =
542 FakePicturePileImpl::CreateFromPile(recording_source.get(), nullptr); 542 FakePicturePileImpl::CreateFromPile(recording_source.get(), nullptr);
543 543
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
602 EXPECT_TRUE(++iterator); 602 EXPECT_TRUE(++iterator);
603 EXPECT_TRUE(iterator->pixel_ref == discardable_bitmap[2].pixelRef()); 603 EXPECT_TRUE(iterator->pixel_ref == discardable_bitmap[2].pixelRef());
604 EXPECT_EQ(expected_rects[2].ToString(), 604 EXPECT_EQ(expected_rects[2].ToString(),
605 gfx::SkRectToRectF(iterator->pixel_ref_rect).ToString()); 605 gfx::SkRectToRectF(iterator->pixel_ref_rect).ToString());
606 EXPECT_FALSE(++iterator); 606 EXPECT_FALSE(++iterator);
607 } 607 }
608 } 608 }
609 609
610 } // namespace 610 } // namespace
611 } // namespace cc 611 } // namespace cc
OLDNEW
« no previous file with comments | « cc/playback/display_list_recording_source_unittest.cc ('k') | cc/playback/pixel_ref_map_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698