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

Side by Side Diff: cc/output/software_renderer_unittest.cc

Issue 2693723002: cc: Move output color space from DrawingFrame to RenderPass (Closed)
Patch Set: Fix typo Created 3 years, 10 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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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/output/software_renderer.h" 5 #include "cc/output/software_renderer.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 gfx::Size viewport_size) { 60 gfx::Size viewport_size) {
61 std::unique_ptr<SkBitmap> bitmap_result; 61 std::unique_ptr<SkBitmap> bitmap_result;
62 base::RunLoop loop; 62 base::RunLoop loop;
63 63
64 list->back()->copy_requests.push_back( 64 list->back()->copy_requests.push_back(
65 CopyOutputRequest::CreateBitmapRequest( 65 CopyOutputRequest::CreateBitmapRequest(
66 base::Bind(&SoftwareRendererTest::SaveBitmapResult, 66 base::Bind(&SoftwareRendererTest::SaveBitmapResult,
67 base::Unretained(&bitmap_result), 67 base::Unretained(&bitmap_result),
68 loop.QuitClosure()))); 68 loop.QuitClosure())));
69 69
70 renderer()->DrawFrame(list, device_scale_factor, gfx::ColorSpace(), 70 renderer()->DrawFrame(list, device_scale_factor, viewport_size);
71 viewport_size);
72 loop.Run(); 71 loop.Run();
73 return bitmap_result; 72 return bitmap_result;
74 } 73 }
75 74
76 static void SaveBitmapResult(std::unique_ptr<SkBitmap>* bitmap_result, 75 static void SaveBitmapResult(std::unique_ptr<SkBitmap>* bitmap_result,
77 const base::Closure& quit_closure, 76 const base::Closure& quit_closure,
78 std::unique_ptr<CopyOutputResult> result) { 77 std::unique_ptr<CopyOutputResult> result) {
79 DCHECK(result->HasBitmap()); 78 DCHECK(result->HasBitmap());
80 *bitmap_result = result->TakeBitmap(); 79 *bitmap_result = result->TakeBitmap();
81 quit_closure.Run(); 80 quit_closure.Run();
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 RenderPass* root_pass = 416 RenderPass* root_pass =
418 AddRenderPass(&list, root_pass_id, gfx::Rect(viewport_size), 417 AddRenderPass(&list, root_pass_id, gfx::Rect(viewport_size),
419 gfx::Transform(), FilterOperations()); 418 gfx::Transform(), FilterOperations());
420 AddQuad(root_pass, gfx::Rect(viewport_size), SK_ColorGREEN); 419 AddQuad(root_pass, gfx::Rect(viewport_size), SK_ColorGREEN);
421 420
422 // Partial frame, we should pass this rect to the SoftwareOutputDevice. 421 // Partial frame, we should pass this rect to the SoftwareOutputDevice.
423 // partial swap is enabled. 422 // partial swap is enabled.
424 root_pass->damage_rect = gfx::Rect(2, 2, 3, 3); 423 root_pass->damage_rect = gfx::Rect(2, 2, 3, 3);
425 424
426 renderer()->DecideRenderPassAllocationsForFrame(list); 425 renderer()->DecideRenderPassAllocationsForFrame(list);
427 renderer()->DrawFrame(&list, device_scale_factor, gfx::ColorSpace(), 426 renderer()->DrawFrame(&list, device_scale_factor, viewport_size);
428 viewport_size);
429 427
430 // The damage rect should be reported to the SoftwareOutputDevice. 428 // The damage rect should be reported to the SoftwareOutputDevice.
431 EXPECT_EQ(gfx::Rect(2, 2, 3, 3), device->damage_rect_at_start()); 429 EXPECT_EQ(gfx::Rect(2, 2, 3, 3), device->damage_rect_at_start());
432 // The SkCanvas should be clipped to the damage rect. 430 // The SkCanvas should be clipped to the damage rect.
433 EXPECT_EQ(gfx::Rect(2, 2, 3, 3), device->clip_rect_at_end()); 431 EXPECT_EQ(gfx::Rect(2, 2, 3, 3), device->clip_rect_at_end());
434 } 432 }
435 433
436 } // namespace 434 } // namespace
437 } // namespace cc 435 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698