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

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

Issue 818853004: Revert of media: Optimize HW Video to 2D Canvas copy. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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 | « media/filters/skcanvas_video_renderer.cc ('k') | media/media.gyp » ('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 "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(nullptr, canvas, kNaturalRect, 0xFF, 200 renderer_.Paint(NULL,
201 SkXfermode::kSrcOver_Mode, VIDEO_ROTATION_0, Context3D()); 201 canvas,
202 kNaturalRect,
203 0xFF,
204 SkXfermode::kSrcOver_Mode,
205 VIDEO_ROTATION_0);
202 } 206 }
203 207
204 void SkCanvasVideoRendererTest::Paint( 208 void SkCanvasVideoRendererTest::Paint(
205 const scoped_refptr<VideoFrame>& video_frame, 209 const scoped_refptr<VideoFrame>& video_frame,
206 SkCanvas* canvas, 210 SkCanvas* canvas,
207 Color color) { 211 Color color) {
208 PaintRotated(video_frame, 212 PaintRotated(video_frame,
209 canvas, 213 canvas,
210 kNaturalRect, 214 kNaturalRect,
211 color, 215 color,
(...skipping 14 matching lines...) Expand all
226 case kRed: 230 case kRed:
227 media::FillYUV(video_frame.get(), 76, 84, 255); 231 media::FillYUV(video_frame.get(), 76, 84, 255);
228 break; 232 break;
229 case kGreen: 233 case kGreen:
230 media::FillYUV(video_frame.get(), 149, 43, 21); 234 media::FillYUV(video_frame.get(), 149, 43, 21);
231 break; 235 break;
232 case kBlue: 236 case kBlue:
233 media::FillYUV(video_frame.get(), 29, 255, 107); 237 media::FillYUV(video_frame.get(), 29, 255, 107);
234 break; 238 break;
235 } 239 }
236 renderer_.Paint(video_frame, canvas, dest_rect, 0xFF, mode, video_rotation, 240 renderer_.Paint(video_frame, canvas, dest_rect, 0xFF, mode, video_rotation);
237 Context3D());
238 } 241 }
239 242
240 void SkCanvasVideoRendererTest::Copy( 243 void SkCanvasVideoRendererTest::Copy(
241 const scoped_refptr<VideoFrame>& video_frame, 244 const scoped_refptr<VideoFrame>& video_frame,
242 SkCanvas* canvas) { 245 SkCanvas* canvas) {
243 renderer_.Copy(video_frame, canvas); 246 renderer_.Copy(video_frame, canvas);
244 } 247 }
245 248
246 TEST_F(SkCanvasVideoRendererTest, NoFrame) { 249 TEST_F(SkCanvasVideoRendererTest, NoFrame) {
247 // 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
499 EXPECT_EQ(SK_ColorMAGENTA, 502 EXPECT_EQ(SK_ColorMAGENTA,
500 GetColorAt(&canvas, (kWidth / 2) - 1, (kHeight / 2) - 1)); 503 GetColorAt(&canvas, (kWidth / 2) - 1, (kHeight / 2) - 1));
501 EXPECT_EQ(SK_ColorMAGENTA, GetColorAt(&canvas, 0, (kHeight / 2) - 1)); 504 EXPECT_EQ(SK_ColorMAGENTA, GetColorAt(&canvas, 0, (kHeight / 2) - 1));
502 EXPECT_EQ(SK_ColorRED, GetColorAt(&canvas, kWidth / 2, kHeight / 2)); 505 EXPECT_EQ(SK_ColorRED, GetColorAt(&canvas, kWidth / 2, kHeight / 2));
503 EXPECT_EQ(SK_ColorBLUE, GetColorAt(&canvas, kWidth - 1, kHeight / 2)); 506 EXPECT_EQ(SK_ColorBLUE, GetColorAt(&canvas, kWidth - 1, kHeight / 2));
504 EXPECT_EQ(SK_ColorGREEN, GetColorAt(&canvas, kWidth - 1, kHeight - 1)); 507 EXPECT_EQ(SK_ColorGREEN, GetColorAt(&canvas, kWidth - 1, kHeight - 1));
505 EXPECT_EQ(SK_ColorBLACK, GetColorAt(&canvas, kWidth / 2, kHeight - 1)); 508 EXPECT_EQ(SK_ColorBLACK, GetColorAt(&canvas, kWidth / 2, kHeight - 1));
506 } 509 }
507 510
508 } // namespace media 511 } // namespace media
OLDNEW
« no previous file with comments | « media/filters/skcanvas_video_renderer.cc ('k') | media/media.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698