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

Side by Side Diff: cc/tiles/software_image_decode_controller_unittest.cc

Issue 1839833003: Add medium image quality to software predecode. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Using SkSize instead of SkMatrix, some renaming + comments. Created 4 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
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/tiles/software_image_decode_controller.h" 5 #include "cc/tiles/software_image_decode_controller.h"
6 6
7 #include "cc/playback/draw_image.h" 7 #include "cc/playback/draw_image.h"
8 #include "cc/raster/tile_task.h" 8 #include "cc/raster/tile_task.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 10
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 EXPECT_TRUE(need_unref); 396 EXPECT_TRUE(need_unref);
397 EXPECT_TRUE(high_quality_task); 397 EXPECT_TRUE(high_quality_task);
398 398
399 DrawImage medium_quality_draw_image( 399 DrawImage medium_quality_draw_image(
400 image.get(), SkIRect::MakeWH(image->width(), image->height()), 400 image.get(), SkIRect::MakeWH(image->width(), image->height()),
401 kMedium_SkFilterQuality, 401 kMedium_SkFilterQuality,
402 CreateMatrix(SkSize::Make(0.5f, 0.5f), is_decomposable)); 402 CreateMatrix(SkSize::Make(0.5f, 0.5f), is_decomposable));
403 scoped_refptr<TileTask> medium_quality_task; 403 scoped_refptr<TileTask> medium_quality_task;
404 need_unref = controller.GetTaskForImageAndRef( 404 need_unref = controller.GetTaskForImageAndRef(
405 medium_quality_draw_image, prepare_tiles_id, &medium_quality_task); 405 medium_quality_draw_image, prepare_tiles_id, &medium_quality_task);
406 // Medium quality isn't handled by the controller, so it won't ref it. Note 406 EXPECT_TRUE(need_unref);
407 // that this will change when medium quality is handled and will need to be
408 // updated.
409 EXPECT_FALSE(need_unref);
410 EXPECT_TRUE(medium_quality_task); 407 EXPECT_TRUE(medium_quality_task);
411 EXPECT_TRUE(high_quality_task.get() != medium_quality_task.get()); 408 EXPECT_TRUE(high_quality_task.get() != medium_quality_task.get());
412 409
413 DrawImage low_quality_draw_image( 410 DrawImage low_quality_draw_image(
414 image.get(), SkIRect::MakeWH(image->width(), image->height()), 411 image.get(), SkIRect::MakeWH(image->width(), image->height()),
415 kLow_SkFilterQuality, 412 kLow_SkFilterQuality,
416 CreateMatrix(SkSize::Make(0.5f, 0.5f), is_decomposable)); 413 CreateMatrix(SkSize::Make(0.5f, 0.5f), is_decomposable));
417 scoped_refptr<TileTask> low_quality_task; 414 scoped_refptr<TileTask> low_quality_task;
418 need_unref = controller.GetTaskForImageAndRef( 415 need_unref = controller.GetTaskForImageAndRef(
419 low_quality_draw_image, prepare_tiles_id, &low_quality_task); 416 low_quality_draw_image, prepare_tiles_id, &low_quality_task);
420 EXPECT_TRUE(need_unref); 417 EXPECT_TRUE(need_unref);
421 EXPECT_TRUE(low_quality_task); 418 EXPECT_TRUE(low_quality_task);
422 EXPECT_TRUE(high_quality_task.get() != low_quality_task.get()); 419 EXPECT_TRUE(high_quality_task.get() != low_quality_task.get());
423 EXPECT_TRUE(medium_quality_task.get() != low_quality_task.get()); 420 EXPECT_TRUE(medium_quality_task.get() != low_quality_task.get());
424 421
425 controller.UnrefImage(high_quality_draw_image); 422 controller.UnrefImage(high_quality_draw_image);
423 controller.UnrefImage(medium_quality_draw_image);
426 controller.UnrefImage(low_quality_draw_image); 424 controller.UnrefImage(low_quality_draw_image);
427 } 425 }
428 426
429 TEST(SoftwareImageDecodeControllerTest, GetTaskForImageSameImageDifferentSize) { 427 TEST(SoftwareImageDecodeControllerTest, GetTaskForImageSameImageDifferentSize) {
430 SoftwareImageDecodeController controller; 428 SoftwareImageDecodeController controller;
431 skia::RefPtr<SkImage> image = CreateImage(100, 100); 429 skia::RefPtr<SkImage> image = CreateImage(100, 100);
432 bool is_decomposable = true; 430 bool is_decomposable = true;
433 uint64_t prepare_tiles_id = 1; 431 uint64_t prepare_tiles_id = 1;
434 SkFilterQuality quality = kHigh_SkFilterQuality; 432 SkFilterQuality quality = kHigh_SkFilterQuality;
435 433
(...skipping 598 matching lines...) Expand 10 before | Expand all | Expand 10 after
1034 // SkImage object. 1032 // SkImage object.
1035 EXPECT_TRUE(decoded_draw_image.image() != image.get()); 1033 EXPECT_TRUE(decoded_draw_image.image() != image.get());
1036 EXPECT_EQ(kNone_SkFilterQuality, decoded_draw_image.filter_quality()); 1034 EXPECT_EQ(kNone_SkFilterQuality, decoded_draw_image.filter_quality());
1037 EXPECT_TRUE(decoded_draw_image.is_scale_adjustment_identity()); 1035 EXPECT_TRUE(decoded_draw_image.is_scale_adjustment_identity());
1038 1036
1039 controller.DrawWithImageFinished(draw_image, decoded_draw_image); 1037 controller.DrawWithImageFinished(draw_image, decoded_draw_image);
1040 controller.UnrefImage(draw_image); 1038 controller.UnrefImage(draw_image);
1041 } 1039 }
1042 } // namespace 1040 } // namespace
1043 } // namespace cc 1041 } // namespace cc
OLDNEW
« cc/tiles/software_image_decode_controller.cc ('K') | « cc/tiles/software_image_decode_controller.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698