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

Side by Side Diff: cc/raster/raster_source_unittest.cc

Issue 2780843002: Split image decode cache limits into "working set" vs "cache" limits (Closed)
Patch Set: comments Created 3 years, 8 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 | « no previous file | cc/test/fake_tile_manager.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 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 "cc/raster/raster_source.h" 5 #include "cc/raster/raster_source.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <memory> 9 #include <memory>
10 10
(...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after
576 gfx::Rect(size.width() - 4, size.height() - 4, 4, 4), flags); 576 gfx::Rect(size.width() - 4, size.height() - 4, 4, 4), flags);
577 577
578 recording_source->SetGenerateDiscardableImagesMetadata(true); 578 recording_source->SetGenerateDiscardableImagesMetadata(true);
579 recording_source->Rerecord(); 579 recording_source->Rerecord();
580 580
581 bool can_use_lcd = true; 581 bool can_use_lcd = true;
582 scoped_refptr<RasterSource> raster_source = 582 scoped_refptr<RasterSource> raster_source =
583 recording_source->CreateRasterSource(can_use_lcd); 583 recording_source->CreateRasterSource(can_use_lcd);
584 SoftwareImageDecodeCache controller( 584 SoftwareImageDecodeCache controller(
585 ResourceFormat::RGBA_8888, 585 ResourceFormat::RGBA_8888,
586 LayerTreeSettings().software_decoded_image_budget_bytes); 586 LayerTreeSettings().decoded_image_working_set_budget_bytes);
587 raster_source->set_image_decode_cache(&controller); 587 raster_source->set_image_decode_cache(&controller);
588 588
589 SkBitmap bitmap; 589 SkBitmap bitmap;
590 bitmap.allocN32Pixels(size.width() * 0.5f, size.height() * 0.25f); 590 bitmap.allocN32Pixels(size.width() * 0.5f, size.height() * 0.25f);
591 SkCanvas canvas(bitmap); 591 SkCanvas canvas(bitmap);
592 canvas.scale(0.5f, 0.25f); 592 canvas.scale(0.5f, 0.25f);
593 593
594 RasterSource::PlaybackSettings settings; 594 RasterSource::PlaybackSettings settings;
595 settings.playback_to_shared_canvas = true; 595 settings.playback_to_shared_canvas = true;
596 settings.use_image_hijack_canvas = true; 596 settings.use_image_hijack_canvas = true;
597 raster_source->PlaybackToCanvas(&canvas, ColorSpaceForTesting(), 597 raster_source->PlaybackToCanvas(&canvas, ColorSpaceForTesting(),
598 gfx::Rect(size), gfx::Rect(size), 1.f, 598 gfx::Rect(size), gfx::Rect(size), 1.f,
599 settings); 599 settings);
600 600
601 EXPECT_EQ(SK_ColorGREEN, bitmap.getColor(0, 0)); 601 EXPECT_EQ(SK_ColorGREEN, bitmap.getColor(0, 0));
602 EXPECT_EQ(SK_ColorGREEN, bitmap.getColor(49, 0)); 602 EXPECT_EQ(SK_ColorGREEN, bitmap.getColor(49, 0));
603 EXPECT_EQ(SK_ColorGREEN, bitmap.getColor(0, 24)); 603 EXPECT_EQ(SK_ColorGREEN, bitmap.getColor(0, 24));
604 EXPECT_EQ(SK_ColorGREEN, bitmap.getColor(49, 24)); 604 EXPECT_EQ(SK_ColorGREEN, bitmap.getColor(49, 24));
605 for (int x = 0; x < 49; ++x) 605 for (int x = 0; x < 49; ++x)
606 EXPECT_EQ(SK_ColorRED, bitmap.getColor(x, 12)); 606 EXPECT_EQ(SK_ColorRED, bitmap.getColor(x, 12));
607 for (int y = 0; y < 24; ++y) 607 for (int y = 0; y < 24; ++y)
608 EXPECT_EQ(SK_ColorRED, bitmap.getColor(24, y)); 608 EXPECT_EQ(SK_ColorRED, bitmap.getColor(24, y));
609 } 609 }
610 610
611 } // namespace 611 } // namespace
612 } // namespace cc 612 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | cc/test/fake_tile_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698