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

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

Issue 2900893002: 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/weak_ptr.h" 7 #include "base/memory/weak_ptr.h"
8 #include "base/run_loop.h" 8 #include "base/run_loop.h"
9 #include "base/synchronization/waitable_event.h" 9 #include "base/synchronization/waitable_event.h"
10 #include "base/threading/thread_task_runner_handle.h" 10 #include "base/threading/thread_task_runner_handle.h"
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after
486 gl::QueryD3D11DeviceObjectFromANGLE(); 486 gl::QueryD3D11DeviceObjectFromANGLE();
487 487
488 gfx::Size texture_size(50, 50); 488 gfx::Size texture_size(50, 50);
489 base::win::ScopedComPtr<ID3D11Texture2D> texture = 489 base::win::ScopedComPtr<ID3D11Texture2D> texture =
490 CreateNV12Texture(d3d11_device, texture_size); 490 CreateNV12Texture(d3d11_device, texture_size);
491 491
492 scoped_refptr<gl::GLImageDXGI> image_dxgi( 492 scoped_refptr<gl::GLImageDXGI> image_dxgi(
493 new gl::GLImageDXGI(texture_size, nullptr)); 493 new gl::GLImageDXGI(texture_size, nullptr));
494 image_dxgi->SetTexture(texture, 0); 494 image_dxgi->SetTexture(texture, 0);
495 495
496 ui::DCRendererLayerParams params(false, gfx::Rect(), 1, gfx::Transform(), 496 ui::DCRendererLayerParams params(
497 image_dxgi.get(), 497 false, gfx::Rect(), 1, gfx::Transform(),
498 gfx::RectF(gfx::Rect(texture_size)), 498 image_dxgi.get(),
499 gfx::Rect(window_size), 0, 0, 1.0, 0); 499 gfx::RectF(gfx::Rect(texture_size)), gfx::Rect(texture_size), 0, 0, 1.0,
500 0);
500 surface_->ScheduleDCLayer(params); 501 surface_->ScheduleDCLayer(params);
501 502
502 EXPECT_EQ(gfx::SwapResult::SWAP_ACK, surface_->SwapBuffers()); 503 EXPECT_EQ(gfx::SwapResult::SWAP_ACK, surface_->SwapBuffers());
504
505 // Scaling up the swapchain with the same image should cause it to be
506 // transformed again, but not presented again.
507 ui::DCRendererLayerParams params2(
508 false, gfx::Rect(), 1, gfx::Transform(),
509 image_dxgi.get(),
510 gfx::RectF(gfx::Rect(texture_size)), gfx::Rect(window_size), 0, 0, 1.0,
511 0);
512 surface_->ScheduleDCLayer(params2);
513
514 EXPECT_EQ(gfx::SwapResult::SWAP_ACK, surface_->SwapBuffers());
503 Sleep(1000); 515 Sleep(1000);
504 516
505 SkColor expected_color = SkColorSetRGB(0xff, 0xb7, 0xff); 517 SkColor expected_color = SkColorSetRGB(0xff, 0xb7, 0xff);
506 SkColor actual_color = 518 SkColor actual_color =
507 ReadBackWindowPixel(window_.hwnd(), gfx::Point(75, 75)); 519 ReadBackWindowPixel(window_.hwnd(), gfx::Point(75, 75));
508 EXPECT_TRUE(AreColorsSimilar(expected_color, actual_color)) 520 EXPECT_TRUE(AreColorsSimilar(expected_color, actual_color))
509 << std::hex << "Expected " << expected_color << " Actual " 521 << std::hex << "Expected " << expected_color << " Actual "
510 << actual_color; 522 << actual_color;
511 523
512 context = nullptr; 524 context = nullptr;
513 DestroySurface(std::move(surface_)); 525 DestroySurface(std::move(surface_));
514 } 526 }
515 527
516 } // namespace 528 } // namespace
517 } // namespace gpu 529 } // 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