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

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

Powered by Google App Engine
This is Rietveld 408576698