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

Side by Side Diff: gpu/ipc/service/direct_composition_surface_win_unittest.cc

Issue 2888783002: Update scaling of video layers on every swap. (Closed)
Patch Set: 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
« no previous file with comments | « gpu/ipc/service/direct_composition_surface_win.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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 "gpu/ipc/service/direct_composition_surface_win.h" 5 #include "gpu/ipc/service/direct_composition_surface_win.h"
6 6
7 #include "base/memory/ref_counted_memory.h" 7 #include "base/memory/ref_counted_memory.h"
8 #include "base/memory/weak_ptr.h" 8 #include "base/memory/weak_ptr.h"
9 #include "base/run_loop.h" 9 #include "base/run_loop.h"
10 #include "base/synchronization/waitable_event.h" 10 #include "base/synchronization/waitable_event.h"
(...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after
495 base::win::ScopedComPtr<ID3D11Texture2D> texture = 495 base::win::ScopedComPtr<ID3D11Texture2D> texture =
496 CreateNV12Texture(d3d11_device, texture_size); 496 CreateNV12Texture(d3d11_device, texture_size);
497 497
498 scoped_refptr<gl::GLImageDXGI> image_dxgi( 498 scoped_refptr<gl::GLImageDXGI> image_dxgi(
499 new gl::GLImageDXGI(texture_size, nullptr)); 499 new gl::GLImageDXGI(texture_size, nullptr));
500 image_dxgi->SetTexture(texture, 0); 500 image_dxgi->SetTexture(texture, 0);
501 501
502 ui::DCRendererLayerParams params( 502 ui::DCRendererLayerParams params(
503 false, gfx::Rect(), 1, gfx::Transform(), 503 false, gfx::Rect(), 1, gfx::Transform(),
504 std::vector<scoped_refptr<gl::GLImage>>{image_dxgi}, 504 std::vector<scoped_refptr<gl::GLImage>>{image_dxgi},
505 gfx::RectF(gfx::Rect(texture_size)), gfx::Rect(texture_size), 0, 0, 1.0,
506 0);
507 surface_->ScheduleDCLayer(params);
508
509 EXPECT_EQ(gfx::SwapResult::SWAP_ACK, surface_->SwapBuffers());
510
511 // Scaling up the swapchain with the same image should cause it to be
512 // transformed again, but not presented again.
513 ui::DCRendererLayerParams params2(
514 false, gfx::Rect(), 1, gfx::Transform(),
515 std::vector<scoped_refptr<gl::GLImage>>{image_dxgi},
505 gfx::RectF(gfx::Rect(texture_size)), gfx::Rect(window_size), 0, 0, 1.0, 516 gfx::RectF(gfx::Rect(texture_size)), gfx::Rect(window_size), 0, 0, 1.0,
506 0); 517 0);
507 surface_->ScheduleDCLayer(params); 518 surface_->ScheduleDCLayer(params2);
508 519
509 EXPECT_EQ(gfx::SwapResult::SWAP_ACK, surface_->SwapBuffers()); 520 EXPECT_EQ(gfx::SwapResult::SWAP_ACK, surface_->SwapBuffers());
510 Sleep(1000); 521 Sleep(1000);
511 522
512 SkColor expected_color = SkColorSetRGB(0xff, 0xb7, 0xff); 523 SkColor expected_color = SkColorSetRGB(0xff, 0xb7, 0xff);
513 SkColor actual_color = 524 SkColor actual_color =
514 ReadBackWindowPixel(window_.hwnd(), gfx::Point(75, 75)); 525 ReadBackWindowPixel(window_.hwnd(), gfx::Point(75, 75));
515 EXPECT_TRUE(AreColorsSimilar(expected_color, actual_color)) 526 EXPECT_TRUE(AreColorsSimilar(expected_color, actual_color))
516 << std::hex << "Expected " << expected_color << " Actual " 527 << std::hex << "Expected " << expected_color << " Actual "
517 << actual_color; 528 << actual_color;
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
566 ReadBackWindowPixel(window_.hwnd(), gfx::Point(75, 75)); 577 ReadBackWindowPixel(window_.hwnd(), gfx::Point(75, 75));
567 EXPECT_TRUE(AreColorsSimilar(expected_color, actual_color)) 578 EXPECT_TRUE(AreColorsSimilar(expected_color, actual_color))
568 << std::hex << "Expected " << expected_color << " Actual " 579 << std::hex << "Expected " << expected_color << " Actual "
569 << actual_color; 580 << actual_color;
570 581
571 context = nullptr; 582 context = nullptr;
572 DestroySurface(std::move(surface_)); 583 DestroySurface(std::move(surface_));
573 } 584 }
574 } // namespace 585 } // namespace
575 } // namespace gpu 586 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/ipc/service/direct_composition_surface_win.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698