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

Side by Side Diff: content/browser/compositor/gl_helper_unittest.cc

Issue 1893473002: Decouple GLHelper from media (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed content_browsertests 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 <stddef.h> 5 #include <stddef.h>
6 #include <stdint.h> 6 #include <stdint.h>
7 #include <stdio.h> 7 #include <stdio.h>
8 #include <string.h> 8 #include <string.h>
9 #include <cmath> 9 #include <cmath>
10 #include <string> 10 #include <string>
(...skipping 17 matching lines...) Expand all
28 #include "base/test/launcher/unit_test_launcher.h" 28 #include "base/test/launcher/unit_test_launcher.h"
29 #include "base/test/test_suite.h" 29 #include "base/test/test_suite.h"
30 #include "base/time/time.h" 30 #include "base/time/time.h"
31 #include "base/trace_event/trace_event.h" 31 #include "base/trace_event/trace_event.h"
32 #include "content/browser/compositor/gl_helper.h" 32 #include "content/browser/compositor/gl_helper.h"
33 #include "content/browser/compositor/gl_helper_readback_support.h" 33 #include "content/browser/compositor/gl_helper_readback_support.h"
34 #include "content/browser/compositor/gl_helper_scaling.h" 34 #include "content/browser/compositor/gl_helper_scaling.h"
35 #include "gpu/command_buffer/client/gl_in_process_context.h" 35 #include "gpu/command_buffer/client/gl_in_process_context.h"
36 #include "gpu/command_buffer/client/gles2_implementation.h" 36 #include "gpu/command_buffer/client/gles2_implementation.h"
37 #include "media/base/video_frame.h" 37 #include "media/base/video_frame.h"
38 #include "media/base/video_util.h"
38 #include "testing/gtest/include/gtest/gtest.h" 39 #include "testing/gtest/include/gtest/gtest.h"
39 #include "third_party/skia/include/core/SkBitmap.h" 40 #include "third_party/skia/include/core/SkBitmap.h"
40 #include "third_party/skia/include/core/SkTypes.h" 41 #include "third_party/skia/include/core/SkTypes.h"
41 #include "ui/gl/gl_implementation.h" 42 #include "ui/gl/gl_implementation.h"
42 43
43 namespace content { 44 namespace content {
44 45
45 content::GLHelper::ScalerQuality kQualities[] = { 46 content::GLHelper::ScalerQuality kQualities[] = {
46 content::GLHelper::SCALER_QUALITY_BEST, 47 content::GLHelper::SCALER_QUALITY_BEST,
47 content::GLHelper::SCALER_QUALITY_GOOD, 48 content::GLHelper::SCALER_QUALITY_GOOD,
(...skipping 1275 matching lines...) Expand 10 before | Expand all | Expand 10 after
1323 gfx::Size(output_xsize, output_ysize), 1324 gfx::Size(output_xsize, output_ysize),
1324 base::TimeDelta::FromSeconds(0)); 1325 base::TimeDelta::FromSeconds(0));
1325 scoped_refptr<media::VideoFrame> truth_frame = 1326 scoped_refptr<media::VideoFrame> truth_frame =
1326 media::VideoFrame::CreateFrame( 1327 media::VideoFrame::CreateFrame(
1327 media::PIXEL_FORMAT_YV12, gfx::Size(output_xsize, output_ysize), 1328 media::PIXEL_FORMAT_YV12, gfx::Size(output_xsize, output_ysize),
1328 gfx::Rect(0, 0, output_xsize, output_ysize), 1329 gfx::Rect(0, 0, output_xsize, output_ysize),
1329 gfx::Size(output_xsize, output_ysize), 1330 gfx::Size(output_xsize, output_ysize),
1330 base::TimeDelta::FromSeconds(0)); 1331 base::TimeDelta::FromSeconds(0));
1331 1332
1332 base::RunLoop run_loop; 1333 base::RunLoop run_loop;
1333 yuv_reader->ReadbackYUV(mailbox, sync_token, output_frame.get(), 1334 yuv_reader->ReadbackYUV(mailbox, sync_token, output_frame->visible_rect(),
1335 output_frame->stride(media::VideoFrame::kYPlane),
1336 output_frame->data(media::VideoFrame::kYPlane),
1337 output_frame->stride(media::VideoFrame::kUPlane),
1338 output_frame->data(media::VideoFrame::kUPlane),
1339 output_frame->stride(media::VideoFrame::kVPlane),
1340 output_frame->data(media::VideoFrame::kVPlane),
1334 gfx::Point(xmargin, ymargin), 1341 gfx::Point(xmargin, ymargin),
1335 base::Bind(&callcallback, run_loop.QuitClosure())); 1342 base::Bind(&callcallback, run_loop.QuitClosure()));
1343
1344 const gfx::Rect paste_rect(gfx::Point(xmargin, ymargin),
1345 gfx::Size(xsize, ysize));
1346 media::LetterboxYUV(output_frame.get(), paste_rect);
1336 run_loop.Run(); 1347 run_loop.Run();
1337 1348
1338 if (flip) { 1349 if (flip) {
1339 FlipSKBitmap(&input_pixels); 1350 FlipSKBitmap(&input_pixels);
1340 } 1351 }
1341 1352
1342 unsigned char* Y = truth_frame->visible_data(media::VideoFrame::kYPlane); 1353 unsigned char* Y = truth_frame->visible_data(media::VideoFrame::kYPlane);
1343 unsigned char* U = truth_frame->visible_data(media::VideoFrame::kUPlane); 1354 unsigned char* U = truth_frame->visible_data(media::VideoFrame::kUPlane);
1344 unsigned char* V = truth_frame->visible_data(media::VideoFrame::kVPlane); 1355 unsigned char* V = truth_frame->visible_data(media::VideoFrame::kVPlane);
1345 int32_t y_stride = truth_frame->stride(media::VideoFrame::kYPlane); 1356 int32_t y_stride = truth_frame->stride(media::VideoFrame::kYPlane);
(...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after
1819 } 1830 }
1820 } 1831 }
1821 } 1832 }
1822 1833
1823 TEST_F(GLHelperTest, CheckOptimizations) { 1834 TEST_F(GLHelperTest, CheckOptimizations) {
1824 // Test in baseclass since it is friends with GLHelperScaling 1835 // Test in baseclass since it is friends with GLHelperScaling
1825 CheckOptimizationsTest(); 1836 CheckOptimizationsTest();
1826 } 1837 }
1827 1838
1828 } // namespace content 1839 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/compositor/gl_helper.cc ('k') | content/browser/media/capture/aura_window_capture_machine.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698