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

Side by Side Diff: cc/paint/discardable_image_map_unittest.cc

Issue 2928703005: Revert of cc: Move SkShader construction to a single spot in PaintShader (Closed)
Patch Set: Created 3 years, 6 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
« no previous file with comments | « cc/paint/BUILD.gn ('k') | cc/paint/discardable_image_store.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "cc/paint/discardable_image_map.h" 5 #include "cc/paint/discardable_image_map.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <memory> 9 #include <memory>
10 10
(...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after
590 // transforms, so we can't let the scale drop all the way to 0. 590 // transforms, so we can't let the scale drop all the way to 0.
591 static constexpr float kMinScale = 0.1f; 591 static constexpr float kMinScale = 0.1f;
592 592
593 for (int y = 0; y < 4; ++y) { 593 for (int y = 0; y < 4; ++y) {
594 for (int x = 0; x < 4; ++x) { 594 for (int x = 0; x < 4; ++x) {
595 if ((x + y) & 1) { 595 if ((x + y) & 1) {
596 discardable_image[y][x] = CreateDiscardableImage(gfx::Size(500, 500)); 596 discardable_image[y][x] = CreateDiscardableImage(gfx::Size(500, 500));
597 SkMatrix scale = SkMatrix::MakeScale(std::max(x * 0.5f, kMinScale), 597 SkMatrix scale = SkMatrix::MakeScale(std::max(x * 0.5f, kMinScale),
598 std::max(y * 0.5f, kMinScale)); 598 std::max(y * 0.5f, kMinScale));
599 PaintFlags flags; 599 PaintFlags flags;
600 flags.setShader(PaintShader::MakeImage( 600 flags.setShader(discardable_image[y][x]->makeShader(
601 discardable_image[y][x], SkShader::kClamp_TileMode, 601 SkShader::kClamp_TileMode, SkShader::kClamp_TileMode, &scale));
602 SkShader::kClamp_TileMode, &scale));
603 content_layer_client.add_draw_rect( 602 content_layer_client.add_draw_rect(
604 gfx::Rect(x * 512 + 6, y * 512 + 6, 500, 500), flags); 603 gfx::Rect(x * 512 + 6, y * 512 + 6, 500, 500), flags);
605 } 604 }
606 } 605 }
607 } 606 }
608 607
609 scoped_refptr<DisplayItemList> display_list = 608 scoped_refptr<DisplayItemList> display_list =
610 content_layer_client.PaintContentsToDisplayList( 609 content_layer_client.PaintContentsToDisplayList(
611 ContentLayerClient::PAINTING_BEHAVIOR_NORMAL); 610 ContentLayerClient::PAINTING_BEHAVIOR_NORMAL);
612 display_list->GenerateDiscardableImagesMetadata(); 611 display_list->GenerateDiscardableImagesMetadata();
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
713 EXPECT_TRUE(discardable_image == images[0].paint_image()); 712 EXPECT_TRUE(discardable_image == images[0].paint_image());
714 713
715 images.clear(); 714 images.clear();
716 image_map_.GetDiscardableImagesInRect(gfx::Rect(105, 105, 5, 95), 1.f, 715 image_map_.GetDiscardableImagesInRect(gfx::Rect(105, 105, 5, 95), 1.f,
717 target_color_space, &images); 716 target_color_space, &images);
718 EXPECT_EQ(1u, images.size()); 717 EXPECT_EQ(1u, images.size());
719 EXPECT_TRUE(discardable_image2 == images[0].paint_image()); 718 EXPECT_TRUE(discardable_image2 == images[0].paint_image());
720 } 719 }
721 720
722 } // namespace cc 721 } // namespace cc
OLDNEW
« no previous file with comments | « cc/paint/BUILD.gn ('k') | cc/paint/discardable_image_store.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698