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 "base/message_loop/message_loop.h" | 5 #include "base/message_loop/message_loop.h" |
6 #include "media/base/video_frame.h" | 6 #include "media/base/video_frame.h" |
7 #include "media/base/video_util.h" | 7 #include "media/base/video_util.h" |
8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
9 #include "third_party/skia/include/core/SkCanvas.h" | 9 #include "third_party/skia/include/core/SkCanvas.h" |
10 #include "media/filters/skcanvas_video_renderer.h" | 10 #include "media/filters/skcanvas_video_renderer.h" |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 }; | 190 }; |
191 | 191 |
192 media::CopyYPlane(cropped_y_plane, 16, 16, cropped_frame().get()); | 192 media::CopyYPlane(cropped_y_plane, 16, 16, cropped_frame().get()); |
193 media::CopyUPlane(cropped_u_plane, 8, 8, cropped_frame().get()); | 193 media::CopyUPlane(cropped_u_plane, 8, 8, cropped_frame().get()); |
194 media::CopyVPlane(cropped_v_plane, 8, 8, cropped_frame().get()); | 194 media::CopyVPlane(cropped_v_plane, 8, 8, cropped_frame().get()); |
195 } | 195 } |
196 | 196 |
197 SkCanvasVideoRendererTest::~SkCanvasVideoRendererTest() {} | 197 SkCanvasVideoRendererTest::~SkCanvasVideoRendererTest() {} |
198 | 198 |
199 void SkCanvasVideoRendererTest::PaintWithoutFrame(SkCanvas* canvas) { | 199 void SkCanvasVideoRendererTest::PaintWithoutFrame(SkCanvas* canvas) { |
200 renderer_.Paint(NULL, | 200 renderer_.Paint(nullptr, canvas, kNaturalRect, 0xFF, |
201 canvas, | 201 SkXfermode::kSrcOver_Mode, VIDEO_ROTATION_0, Context3D()); |
202 kNaturalRect, | |
203 0xFF, | |
204 SkXfermode::kSrcOver_Mode, | |
205 VIDEO_ROTATION_0); | |
206 } | 202 } |
207 | 203 |
208 void SkCanvasVideoRendererTest::Paint( | 204 void SkCanvasVideoRendererTest::Paint( |
209 const scoped_refptr<VideoFrame>& video_frame, | 205 const scoped_refptr<VideoFrame>& video_frame, |
210 SkCanvas* canvas, | 206 SkCanvas* canvas, |
211 Color color) { | 207 Color color) { |
212 PaintRotated(video_frame, | 208 PaintRotated(video_frame, |
213 canvas, | 209 canvas, |
214 kNaturalRect, | 210 kNaturalRect, |
215 color, | 211 color, |
(...skipping 14 matching lines...) Expand all Loading... |
230 case kRed: | 226 case kRed: |
231 media::FillYUV(video_frame.get(), 76, 84, 255); | 227 media::FillYUV(video_frame.get(), 76, 84, 255); |
232 break; | 228 break; |
233 case kGreen: | 229 case kGreen: |
234 media::FillYUV(video_frame.get(), 149, 43, 21); | 230 media::FillYUV(video_frame.get(), 149, 43, 21); |
235 break; | 231 break; |
236 case kBlue: | 232 case kBlue: |
237 media::FillYUV(video_frame.get(), 29, 255, 107); | 233 media::FillYUV(video_frame.get(), 29, 255, 107); |
238 break; | 234 break; |
239 } | 235 } |
240 renderer_.Paint(video_frame, canvas, dest_rect, 0xFF, mode, video_rotation); | 236 renderer_.Paint(video_frame, canvas, dest_rect, 0xFF, mode, video_rotation, |
| 237 Context3D()); |
241 } | 238 } |
242 | 239 |
243 void SkCanvasVideoRendererTest::Copy( | 240 void SkCanvasVideoRendererTest::Copy( |
244 const scoped_refptr<VideoFrame>& video_frame, | 241 const scoped_refptr<VideoFrame>& video_frame, |
245 SkCanvas* canvas) { | 242 SkCanvas* canvas) { |
246 renderer_.Copy(video_frame, canvas); | 243 renderer_.Copy(video_frame, canvas); |
247 } | 244 } |
248 | 245 |
249 TEST_F(SkCanvasVideoRendererTest, NoFrame) { | 246 TEST_F(SkCanvasVideoRendererTest, NoFrame) { |
250 // Test that black gets painted over canvas. | 247 // Test that black gets painted over canvas. |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
502 EXPECT_EQ(SK_ColorMAGENTA, | 499 EXPECT_EQ(SK_ColorMAGENTA, |
503 GetColorAt(&canvas, (kWidth / 2) - 1, (kHeight / 2) - 1)); | 500 GetColorAt(&canvas, (kWidth / 2) - 1, (kHeight / 2) - 1)); |
504 EXPECT_EQ(SK_ColorMAGENTA, GetColorAt(&canvas, 0, (kHeight / 2) - 1)); | 501 EXPECT_EQ(SK_ColorMAGENTA, GetColorAt(&canvas, 0, (kHeight / 2) - 1)); |
505 EXPECT_EQ(SK_ColorRED, GetColorAt(&canvas, kWidth / 2, kHeight / 2)); | 502 EXPECT_EQ(SK_ColorRED, GetColorAt(&canvas, kWidth / 2, kHeight / 2)); |
506 EXPECT_EQ(SK_ColorBLUE, GetColorAt(&canvas, kWidth - 1, kHeight / 2)); | 503 EXPECT_EQ(SK_ColorBLUE, GetColorAt(&canvas, kWidth - 1, kHeight / 2)); |
507 EXPECT_EQ(SK_ColorGREEN, GetColorAt(&canvas, kWidth - 1, kHeight - 1)); | 504 EXPECT_EQ(SK_ColorGREEN, GetColorAt(&canvas, kWidth - 1, kHeight - 1)); |
508 EXPECT_EQ(SK_ColorBLACK, GetColorAt(&canvas, kWidth / 2, kHeight - 1)); | 505 EXPECT_EQ(SK_ColorBLACK, GetColorAt(&canvas, kWidth / 2, kHeight - 1)); |
509 } | 506 } |
510 | 507 |
511 } // namespace media | 508 } // namespace media |
OLD | NEW |