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

Side by Side Diff: cc/trees/layer_tree_host_impl_unittest.cc

Issue 2857923004: cc: Keep PaintImage in DrawImage. (Closed)
Patch Set: addressed comments. Created 3 years, 7 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 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 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/trees/layer_tree_host_impl.h" 5 #include "cc/trees/layer_tree_host_impl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <cmath> 10 #include <cmath>
(...skipping 12299 matching lines...) Expand 10 before | Expand all | Expand 10 after
12310 TEST_F(LayerTreeHostImplTest, CheckerImagingTileInvalidation) { 12310 TEST_F(LayerTreeHostImplTest, CheckerImagingTileInvalidation) {
12311 LayerTreeSettings settings = DefaultSettings(); 12311 LayerTreeSettings settings = DefaultSettings();
12312 settings.enable_checker_imaging = true; 12312 settings.enable_checker_imaging = true;
12313 settings.default_tile_size = gfx::Size(256, 256); 12313 settings.default_tile_size = gfx::Size(256, 256);
12314 settings.max_untiled_layer_size = gfx::Size(256, 256); 12314 settings.max_untiled_layer_size = gfx::Size(256, 256);
12315 CreateHostImpl(settings, CreateCompositorFrameSink()); 12315 CreateHostImpl(settings, CreateCompositorFrameSink());
12316 gfx::Size layer_size = gfx::Size(750, 750); 12316 gfx::Size layer_size = gfx::Size(750, 750);
12317 12317
12318 std::unique_ptr<FakeRecordingSource> recording_source = 12318 std::unique_ptr<FakeRecordingSource> recording_source =
12319 FakeRecordingSource::CreateFilledRecordingSource(layer_size); 12319 FakeRecordingSource::CreateFilledRecordingSource(layer_size);
12320 sk_sp<SkImage> checkerable_image = 12320 PaintImage checkerable_image = PaintImage(
12321 CreateDiscardableImage(gfx::Size(500, 500)); 12321 PaintImage::GetNextId(), CreateDiscardableImage(gfx::Size(500, 500)));
12322 recording_source->add_draw_image(checkerable_image, gfx::Point(0, 0)); 12322 recording_source->add_draw_image(checkerable_image, gfx::Point(0, 0));
12323 12323
12324 SkColor non_solid_color = SkColorSetARGB(128, 45, 56, 67); 12324 SkColor non_solid_color = SkColorSetARGB(128, 45, 56, 67);
12325 PaintFlags non_solid_flags; 12325 PaintFlags non_solid_flags;
12326 non_solid_flags.setColor(non_solid_color); 12326 non_solid_flags.setColor(non_solid_color);
12327 recording_source->add_draw_rect_with_flags(gfx::Rect(510, 0, 200, 600), 12327 recording_source->add_draw_rect_with_flags(gfx::Rect(510, 0, 200, 600),
12328 non_solid_flags); 12328 non_solid_flags);
12329 recording_source->add_draw_rect_with_flags(gfx::Rect(0, 510, 200, 400), 12329 recording_source->add_draw_rect_with_flags(gfx::Rect(0, 510, 200, 400),
12330 non_solid_flags); 12330 non_solid_flags);
12331 recording_source->Rerecord(); 12331 recording_source->Rerecord();
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
12371 host_impl_->InvalidateContentOnImplSide(); 12371 host_impl_->InvalidateContentOnImplSide();
12372 pending_tree = host_impl_->pending_tree(); 12372 pending_tree = host_impl_->pending_tree();
12373 root = static_cast<FakePictureLayerImpl*>(*pending_tree->begin()); 12373 root = static_cast<FakePictureLayerImpl*>(*pending_tree->begin());
12374 for (auto* tile : root->tilings()->tiling_at(0)->AllTilesForTesting()) { 12374 for (auto* tile : root->tilings()->tiling_at(0)->AllTilesForTesting()) {
12375 if (tile->tiling_i_index() < 2 && tile->tiling_j_index() < 2) 12375 if (tile->tiling_i_index() < 2 && tile->tiling_j_index() < 2)
12376 EXPECT_TRUE(tile->HasRasterTask()); 12376 EXPECT_TRUE(tile->HasRasterTask());
12377 else 12377 else
12378 EXPECT_FALSE(tile->HasRasterTask()); 12378 EXPECT_FALSE(tile->HasRasterTask());
12379 } 12379 }
12380 Region expected_invalidation( 12380 Region expected_invalidation(
12381 raster_source->GetRectForImage(checkerable_image->uniqueID())); 12381 raster_source->GetRectForImage(checkerable_image.stable_id()));
12382 EXPECT_EQ(expected_invalidation, *(root->GetPendingInvalidation())); 12382 EXPECT_EQ(expected_invalidation, *(root->GetPendingInvalidation()));
12383 } 12383 }
12384 12384
12385 } // namespace 12385 } // namespace
12386 } // namespace cc 12386 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698