| 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 "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 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 }; | 178 }; |
| 179 | 179 |
| 180 media::CopyYPlane(cropped_y_plane, 16, 16, cropped_frame()); | 180 media::CopyYPlane(cropped_y_plane, 16, 16, cropped_frame()); |
| 181 media::CopyUPlane(cropped_u_plane, 8, 8, cropped_frame()); | 181 media::CopyUPlane(cropped_u_plane, 8, 8, cropped_frame()); |
| 182 media::CopyVPlane(cropped_v_plane, 8, 8, cropped_frame()); | 182 media::CopyVPlane(cropped_v_plane, 8, 8, cropped_frame()); |
| 183 } | 183 } |
| 184 | 184 |
| 185 SkCanvasVideoRendererTest::~SkCanvasVideoRendererTest() {} | 185 SkCanvasVideoRendererTest::~SkCanvasVideoRendererTest() {} |
| 186 | 186 |
| 187 void SkCanvasVideoRendererTest::PaintWithoutFrame(SkCanvas* canvas) { | 187 void SkCanvasVideoRendererTest::PaintWithoutFrame(SkCanvas* canvas) { |
| 188 renderer_.Paint(NULL, canvas, kNaturalRect, 0xFF); | 188 renderer_.Paint(NULL, canvas, kNaturalRect, 0xFF, 0); |
| 189 } | 189 } |
| 190 | 190 |
| 191 void SkCanvasVideoRendererTest::Paint(VideoFrame* video_frame, | 191 void SkCanvasVideoRendererTest::Paint(VideoFrame* video_frame, |
| 192 SkCanvas* canvas, | 192 SkCanvas* canvas, |
| 193 Color color) { | 193 Color color) { |
| 194 switch (color) { | 194 switch (color) { |
| 195 case kNone: | 195 case kNone: |
| 196 break; | 196 break; |
| 197 case kRed: | 197 case kRed: |
| 198 media::FillYUV(video_frame, 76, 84, 255); | 198 media::FillYUV(video_frame, 76, 84, 255); |
| 199 break; | 199 break; |
| 200 case kGreen: | 200 case kGreen: |
| 201 media::FillYUV(video_frame, 149, 43, 21); | 201 media::FillYUV(video_frame, 149, 43, 21); |
| 202 break; | 202 break; |
| 203 case kBlue: | 203 case kBlue: |
| 204 media::FillYUV(video_frame, 29, 255, 107); | 204 media::FillYUV(video_frame, 29, 255, 107); |
| 205 break; | 205 break; |
| 206 } | 206 } |
| 207 renderer_.Paint(video_frame, canvas, kNaturalRect, 0xFF); | 207 renderer_.Paint(video_frame, canvas, kNaturalRect, 0xFF, 0); |
| 208 } | 208 } |
| 209 | 209 |
| 210 TEST_F(SkCanvasVideoRendererTest, NoFrame) { | 210 TEST_F(SkCanvasVideoRendererTest, NoFrame) { |
| 211 // Test that black gets painted over canvas. | 211 // Test that black gets painted over canvas. |
| 212 FillCanvas(target_canvas(), SK_ColorRED); | 212 FillCanvas(target_canvas(), SK_ColorRED); |
| 213 PaintWithoutFrame(target_canvas()); | 213 PaintWithoutFrame(target_canvas()); |
| 214 EXPECT_EQ(SK_ColorBLACK, GetColor(target_canvas())); | 214 EXPECT_EQ(SK_ColorBLACK, GetColor(target_canvas())); |
| 215 } | 215 } |
| 216 | 216 |
| 217 TEST_F(SkCanvasVideoRendererTest, TransparentFrame) { | 217 TEST_F(SkCanvasVideoRendererTest, TransparentFrame) { |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 GetColorAt(&canvas, offset_x + crop_rect.width() - 1, offset_y)); | 305 GetColorAt(&canvas, offset_x + crop_rect.width() - 1, offset_y)); |
| 306 EXPECT_EQ(SK_ColorGREEN, | 306 EXPECT_EQ(SK_ColorGREEN, |
| 307 GetColorAt(&canvas, offset_x, offset_y + crop_rect.height() - 1)); | 307 GetColorAt(&canvas, offset_x, offset_y + crop_rect.height() - 1)); |
| 308 EXPECT_EQ(SK_ColorBLUE, | 308 EXPECT_EQ(SK_ColorBLUE, |
| 309 GetColorAt(&canvas, | 309 GetColorAt(&canvas, |
| 310 offset_x + crop_rect.width() - 1, | 310 offset_x + crop_rect.width() - 1, |
| 311 offset_y + crop_rect.height() - 1)); | 311 offset_y + crop_rect.height() - 1)); |
| 312 } | 312 } |
| 313 | 313 |
| 314 } // namespace media | 314 } // namespace media |
| OLD | NEW |