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

Side by Side Diff: media/renderers/skcanvas_video_renderer_unittest.cc

Issue 2690583002: Make cc/paint have concrete types (Closed)
Patch Set: PaintRecord as typedef, fixup playback calls Created 3 years, 9 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 | « content/renderer/gpu/gpu_benchmarking_extension.cc ('k') | printing/pdf_metafile_skia.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 <GLES3/gl3.h> 5 #include <GLES3/gl3.h>
6 #include <stdint.h> 6 #include <stdint.h>
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/memory/aligned_memory.h" 9 #include "base/memory/aligned_memory.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 656 matching lines...) Expand 10 before | Expand all | Expand 10 after
667 TEST_F(SkCanvasVideoRendererTest, CorrectFrameSizeToVisibleRect) { 667 TEST_F(SkCanvasVideoRendererTest, CorrectFrameSizeToVisibleRect) {
668 int fWidth{16}, fHeight{16}; 668 int fWidth{16}, fHeight{16};
669 SkImageInfo imInfo = 669 SkImageInfo imInfo =
670 SkImageInfo::MakeN32(fWidth, fHeight, kOpaque_SkAlphaType); 670 SkImageInfo::MakeN32(fWidth, fHeight, kOpaque_SkAlphaType);
671 671
672 sk_sp<const GrGLInterface> glInterface(GrGLCreateNullInterface()); 672 sk_sp<const GrGLInterface> glInterface(GrGLCreateNullInterface());
673 sk_sp<GrContext> grContext( 673 sk_sp<GrContext> grContext(
674 GrContext::Create(kOpenGL_GrBackend, 674 GrContext::Create(kOpenGL_GrBackend,
675 reinterpret_cast<GrBackendContext>(glInterface.get()))); 675 reinterpret_cast<GrBackendContext>(glInterface.get())));
676 676
677 sk_sp<cc::PaintSurface> surface = cc::PaintSurface::MakeRenderTarget( 677 sk_sp<SkSurface> surface =
678 grContext.get(), SkBudgeted::kYes, imInfo); 678 SkSurface::MakeRenderTarget(grContext.get(), SkBudgeted::kYes, imInfo);
679 cc::PaintCanvas* canvas = surface->getCanvas(); 679 cc::PaintCanvas canvas(surface->getCanvas());
680 680
681 TestGLES2Interface gles2; 681 TestGLES2Interface gles2;
682 Context3D context_3d(&gles2, grContext.get()); 682 Context3D context_3d(&gles2, grContext.get());
683 gfx::Size coded_size(fWidth, fHeight); 683 gfx::Size coded_size(fWidth, fHeight);
684 gfx::Size visible_size(fWidth / 2, fHeight / 2); 684 gfx::Size visible_size(fWidth / 2, fHeight / 2);
685 685
686 gpu::MailboxHolder mailbox_holders[VideoFrame::kMaxPlanes]; 686 gpu::MailboxHolder mailbox_holders[VideoFrame::kMaxPlanes];
687 for (size_t i = 0; i < VideoFrame::kMaxPlanes; i++) { 687 for (size_t i = 0; i < VideoFrame::kMaxPlanes; i++) {
688 mailbox_holders[i] = gpu::MailboxHolder( 688 mailbox_holders[i] = gpu::MailboxHolder(
689 gpu::Mailbox::Generate(), gpu::SyncToken(), GL_TEXTURE_RECTANGLE_ARB); 689 gpu::Mailbox::Generate(), gpu::SyncToken(), GL_TEXTURE_RECTANGLE_ARB);
690 } 690 }
691 691
692 auto video_frame = VideoFrame::WrapNativeTextures( 692 auto video_frame = VideoFrame::WrapNativeTextures(
693 PIXEL_FORMAT_I420, mailbox_holders, base::Bind(EmptyCallback), coded_size, 693 PIXEL_FORMAT_I420, mailbox_holders, base::Bind(EmptyCallback), coded_size,
694 gfx::Rect(visible_size), visible_size, 694 gfx::Rect(visible_size), visible_size,
695 base::TimeDelta::FromMilliseconds(4)); 695 base::TimeDelta::FromMilliseconds(4));
696 696
697 gfx::RectF visible_rect(visible_size.width(), visible_size.height()); 697 gfx::RectF visible_rect(visible_size.width(), visible_size.height());
698 cc::PaintFlags flags; 698 cc::PaintFlags flags;
699 renderer_.Paint(video_frame, canvas, visible_rect, flags, VIDEO_ROTATION_0, 699 renderer_.Paint(video_frame, &canvas, visible_rect, flags, VIDEO_ROTATION_0,
700 context_3d); 700 context_3d);
701 701
702 EXPECT_EQ(fWidth / 2, renderer_.LastImageDimensionsForTesting().width()); 702 EXPECT_EQ(fWidth / 2, renderer_.LastImageDimensionsForTesting().width());
703 EXPECT_EQ(fWidth / 2, renderer_.LastImageDimensionsForTesting().height()); 703 EXPECT_EQ(fWidth / 2, renderer_.LastImageDimensionsForTesting().height());
704 } 704 }
705 705
706 TEST_F(SkCanvasVideoRendererTest, TexImage2D_Y16_RGBA32F) { 706 TEST_F(SkCanvasVideoRendererTest, TexImage2D_Y16_RGBA32F) {
707 // Create test frame. 707 // Create test frame.
708 // |offset_x| and |offset_y| define visible rect's offset to coded rect. 708 // |offset_x| and |offset_y| define visible rect's offset to coded rect.
709 const int offset_x = 3; 709 const int offset_x = 3;
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
803 EXPECT_EQ(expected_value, data[(i + j * width)]); 803 EXPECT_EQ(expected_value, data[(i + j * width)]);
804 } 804 }
805 } 805 }
806 }); 806 });
807 SkCanvasVideoRenderer::TexSubImage2D(GL_TEXTURE_2D, &gles2, video_frame.get(), 807 SkCanvasVideoRenderer::TexSubImage2D(GL_TEXTURE_2D, &gles2, video_frame.get(),
808 0, GL_RED, GL_FLOAT, 2 /*xoffset*/, 808 0, GL_RED, GL_FLOAT, 2 /*xoffset*/,
809 1 /*yoffset*/, false /*flip_y*/, true); 809 1 /*yoffset*/, false /*flip_y*/, true);
810 } 810 }
811 811
812 } // namespace media 812 } // namespace media
OLDNEW
« no previous file with comments | « content/renderer/gpu/gpu_benchmarking_extension.cc ('k') | printing/pdf_metafile_skia.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698