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

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

Issue 445013002: media: Optimize HW Video to 2D Canvas copy. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Resolve comments, rebase to ToT Created 6 years, 1 month 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 (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
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,
201 canvas, 201 canvas,
202 kNaturalRect, 202 kNaturalRect,
203 0xFF, 203 0xFF,
204 SkXfermode::kSrcOver_Mode, 204 SkXfermode::kSrcOver_Mode,
205 VIDEO_ROTATION_0); 205 VIDEO_ROTATION_0,
206 Context3DProvider());
206 } 207 }
207 208
208 void SkCanvasVideoRendererTest::Paint( 209 void SkCanvasVideoRendererTest::Paint(
209 const scoped_refptr<VideoFrame>& video_frame, 210 const scoped_refptr<VideoFrame>& video_frame,
210 SkCanvas* canvas, 211 SkCanvas* canvas,
211 Color color) { 212 Color color) {
212 PaintRotated(video_frame, 213 PaintRotated(video_frame,
213 canvas, 214 canvas,
214 kNaturalRect, 215 kNaturalRect,
215 color, 216 color,
(...skipping 14 matching lines...) Expand all
230 case kRed: 231 case kRed:
231 media::FillYUV(video_frame.get(), 76, 84, 255); 232 media::FillYUV(video_frame.get(), 76, 84, 255);
232 break; 233 break;
233 case kGreen: 234 case kGreen:
234 media::FillYUV(video_frame.get(), 149, 43, 21); 235 media::FillYUV(video_frame.get(), 149, 43, 21);
235 break; 236 break;
236 case kBlue: 237 case kBlue:
237 media::FillYUV(video_frame.get(), 29, 255, 107); 238 media::FillYUV(video_frame.get(), 29, 255, 107);
238 break; 239 break;
239 } 240 }
240 renderer_.Paint(video_frame, canvas, dest_rect, 0xFF, mode, video_rotation); 241 renderer_.Paint(video_frame,
242 canvas,
243 dest_rect,
244 0xFF,
245 mode,
246 video_rotation,
247 Context3DProvider());
241 } 248 }
242 249
243 void SkCanvasVideoRendererTest::Copy( 250 void SkCanvasVideoRendererTest::Copy(
244 const scoped_refptr<VideoFrame>& video_frame, 251 const scoped_refptr<VideoFrame>& video_frame,
245 SkCanvas* canvas) { 252 SkCanvas* canvas) {
246 renderer_.Copy(video_frame, canvas); 253 renderer_.Copy(video_frame, canvas);
247 } 254 }
248 255
249 TEST_F(SkCanvasVideoRendererTest, NoFrame) { 256 TEST_F(SkCanvasVideoRendererTest, NoFrame) {
250 // Test that black gets painted over canvas. 257 // Test that black gets painted over canvas.
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
502 EXPECT_EQ(SK_ColorMAGENTA, 509 EXPECT_EQ(SK_ColorMAGENTA,
503 GetColorAt(&canvas, (kWidth / 2) - 1, (kHeight / 2) - 1)); 510 GetColorAt(&canvas, (kWidth / 2) - 1, (kHeight / 2) - 1));
504 EXPECT_EQ(SK_ColorMAGENTA, GetColorAt(&canvas, 0, (kHeight / 2) - 1)); 511 EXPECT_EQ(SK_ColorMAGENTA, GetColorAt(&canvas, 0, (kHeight / 2) - 1));
505 EXPECT_EQ(SK_ColorRED, GetColorAt(&canvas, kWidth / 2, kHeight / 2)); 512 EXPECT_EQ(SK_ColorRED, GetColorAt(&canvas, kWidth / 2, kHeight / 2));
506 EXPECT_EQ(SK_ColorBLUE, GetColorAt(&canvas, kWidth - 1, kHeight / 2)); 513 EXPECT_EQ(SK_ColorBLUE, GetColorAt(&canvas, kWidth - 1, kHeight / 2));
507 EXPECT_EQ(SK_ColorGREEN, GetColorAt(&canvas, kWidth - 1, kHeight - 1)); 514 EXPECT_EQ(SK_ColorGREEN, GetColorAt(&canvas, kWidth - 1, kHeight - 1));
508 EXPECT_EQ(SK_ColorBLACK, GetColorAt(&canvas, kWidth / 2, kHeight - 1)); 515 EXPECT_EQ(SK_ColorBLACK, GetColorAt(&canvas, kWidth / 2, kHeight - 1));
509 } 516 }
510 517
511 } // namespace media 518 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698