OLD | NEW |
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 536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
547 scoped_refptr<media::VideoFrame> video_frame = | 547 scoped_refptr<media::VideoFrame> video_frame = |
548 CreateTestY16Frame(gfx::Size(stride, offset_y + bitmap.height()), rect, | 548 CreateTestY16Frame(gfx::Size(stride, offset_y + bitmap.height()), rect, |
549 memory.get(), cropped_frame()->timestamp()); | 549 memory.get(), cropped_frame()->timestamp()); |
550 | 550 |
551 cc::SkiaPaintCanvas canvas(bitmap); | 551 cc::SkiaPaintCanvas canvas(bitmap); |
552 cc::PaintFlags flags; | 552 cc::PaintFlags flags; |
553 flags.setFilterQuality(kNone_SkFilterQuality); | 553 flags.setFilterQuality(kNone_SkFilterQuality); |
554 renderer_.Paint(video_frame, &canvas, | 554 renderer_.Paint(video_frame, &canvas, |
555 gfx::RectF(bitmap.width(), bitmap.height()), flags, | 555 gfx::RectF(bitmap.width(), bitmap.height()), flags, |
556 VIDEO_ROTATION_0, Context3D()); | 556 VIDEO_ROTATION_0, Context3D()); |
557 SkAutoLockPixels lock(bitmap); | |
558 for (int j = 0; j < bitmap.height(); j++) { | 557 for (int j = 0; j < bitmap.height(); j++) { |
559 for (int i = 0; i < bitmap.width(); i++) { | 558 for (int i = 0; i < bitmap.width(); i++) { |
560 const int value = i + j * bitmap.width(); | 559 const int value = i + j * bitmap.width(); |
561 EXPECT_EQ(SkColorSetRGB(value, value, value), bitmap.getColor(i, j)); | 560 EXPECT_EQ(SkColorSetRGB(value, value, value), bitmap.getColor(i, j)); |
562 } | 561 } |
563 } | 562 } |
564 } | 563 } |
565 | 564 |
566 namespace { | 565 namespace { |
567 class TestGLES2Interface : public gpu::gles2::GLES2InterfaceStub { | 566 class TestGLES2Interface : public gpu::gles2::GLES2InterfaceStub { |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
793 EXPECT_EQ(expected_value, data[(i + j * width)]); | 792 EXPECT_EQ(expected_value, data[(i + j * width)]); |
794 } | 793 } |
795 } | 794 } |
796 }); | 795 }); |
797 SkCanvasVideoRenderer::TexSubImage2D(GL_TEXTURE_2D, &gles2, video_frame.get(), | 796 SkCanvasVideoRenderer::TexSubImage2D(GL_TEXTURE_2D, &gles2, video_frame.get(), |
798 0, GL_RED, GL_FLOAT, 2 /*xoffset*/, | 797 0, GL_RED, GL_FLOAT, 2 /*xoffset*/, |
799 1 /*yoffset*/, false /*flip_y*/, true); | 798 1 /*yoffset*/, false /*flip_y*/, true); |
800 } | 799 } |
801 | 800 |
802 } // namespace media | 801 } // namespace media |
OLD | NEW |