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

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: Use scratch texture Created 6 years, 3 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 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 } 190 }
191 191
192 SkCanvasVideoRendererTest::~SkCanvasVideoRendererTest() {} 192 SkCanvasVideoRendererTest::~SkCanvasVideoRendererTest() {}
193 193
194 void SkCanvasVideoRendererTest::PaintWithoutFrame(SkCanvas* canvas) { 194 void SkCanvasVideoRendererTest::PaintWithoutFrame(SkCanvas* canvas) {
195 renderer_.Paint(NULL, 195 renderer_.Paint(NULL,
196 canvas, 196 canvas,
197 kNaturalRect, 197 kNaturalRect,
198 0xFF, 198 0xFF,
199 SkXfermode::kSrcOver_Mode, 199 SkXfermode::kSrcOver_Mode,
200 VIDEO_ROTATION_0); 200 VIDEO_ROTATION_0,
201 NULL);
201 } 202 }
202 203
203 void SkCanvasVideoRendererTest::Paint(VideoFrame* video_frame, 204 void SkCanvasVideoRendererTest::Paint(VideoFrame* video_frame,
204 SkCanvas* canvas, 205 SkCanvas* canvas,
205 Color color) { 206 Color color) {
206 PaintRotated( 207 PaintRotated(
207 video_frame, canvas, color, SkXfermode::kSrcOver_Mode, VIDEO_ROTATION_0); 208 video_frame, canvas, color, SkXfermode::kSrcOver_Mode, VIDEO_ROTATION_0);
208 } 209 }
209 210
210 void SkCanvasVideoRendererTest::PaintRotated(VideoFrame* video_frame, 211 void SkCanvasVideoRendererTest::PaintRotated(VideoFrame* video_frame,
211 SkCanvas* canvas, 212 SkCanvas* canvas,
212 Color color, 213 Color color,
213 SkXfermode::Mode mode, 214 SkXfermode::Mode mode,
214 VideoRotation video_rotation) { 215 VideoRotation video_rotation) {
215 switch (color) { 216 switch (color) {
216 case kNone: 217 case kNone:
217 break; 218 break;
218 case kRed: 219 case kRed:
219 media::FillYUV(video_frame, 76, 84, 255); 220 media::FillYUV(video_frame, 76, 84, 255);
220 break; 221 break;
221 case kGreen: 222 case kGreen:
222 media::FillYUV(video_frame, 149, 43, 21); 223 media::FillYUV(video_frame, 149, 43, 21);
223 break; 224 break;
224 case kBlue: 225 case kBlue:
225 media::FillYUV(video_frame, 29, 255, 107); 226 media::FillYUV(video_frame, 29, 255, 107);
226 break; 227 break;
227 } 228 }
228 renderer_.Paint( 229 renderer_.Paint(
229 video_frame, canvas, kNaturalRect, 0xFF, mode, video_rotation); 230 video_frame, canvas, kNaturalRect, 0xFF, mode, video_rotation, NULL);
230 } 231 }
231 232
232 void SkCanvasVideoRendererTest::Copy(VideoFrame* video_frame, 233 void SkCanvasVideoRendererTest::Copy(VideoFrame* video_frame,
233 SkCanvas* canvas) { 234 SkCanvas* canvas) {
234 renderer_.Copy(video_frame, canvas); 235 renderer_.Copy(video_frame, canvas);
235 } 236 }
236 237
237 TEST_F(SkCanvasVideoRendererTest, NoFrame) { 238 TEST_F(SkCanvasVideoRendererTest, NoFrame) {
238 // Test that black gets painted over canvas. 239 // Test that black gets painted over canvas.
239 FillCanvas(target_canvas(), SK_ColorRED); 240 FillCanvas(target_canvas(), SK_ColorRED);
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
399 SkXfermode::kSrcOver_Mode, 400 SkXfermode::kSrcOver_Mode,
400 VIDEO_ROTATION_270); 401 VIDEO_ROTATION_270);
401 // Check the corners. 402 // Check the corners.
402 EXPECT_EQ(SK_ColorRED, GetColorAt(&canvas, 0, 0)); 403 EXPECT_EQ(SK_ColorRED, GetColorAt(&canvas, 0, 0));
403 EXPECT_EQ(SK_ColorBLUE, GetColorAt(&canvas, kWidth - 1, 0)); 404 EXPECT_EQ(SK_ColorBLUE, GetColorAt(&canvas, kWidth - 1, 0));
404 EXPECT_EQ(SK_ColorGREEN, GetColorAt(&canvas, kWidth - 1, kHeight - 1)); 405 EXPECT_EQ(SK_ColorGREEN, GetColorAt(&canvas, kWidth - 1, kHeight - 1));
405 EXPECT_EQ(SK_ColorBLACK, GetColorAt(&canvas, 0, kHeight - 1)); 406 EXPECT_EQ(SK_ColorBLACK, GetColorAt(&canvas, 0, kHeight - 1));
406 } 407 }
407 408
408 } // namespace media 409 } // namespace media
OLDNEW
« media/filters/skcanvas_video_renderer.cc ('K') | « media/filters/skcanvas_video_renderer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698