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 "third_party/skia/include/core/SkDevice.h" | 9 #include "third_party/skia/include/core/SkDevice.h" |
10 #include "media/filters/skcanvas_video_renderer.h" | 10 #include "media/filters/skcanvas_video_renderer.h" |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 virtual ~SkCanvasVideoRendererTest(); | 51 virtual ~SkCanvasVideoRendererTest(); |
52 | 52 |
53 // Paints to |canvas| using |renderer_| without any frame data. | 53 // Paints to |canvas| using |renderer_| without any frame data. |
54 void PaintWithoutFrame(SkCanvas* canvas); | 54 void PaintWithoutFrame(SkCanvas* canvas); |
55 | 55 |
56 // Paints the |video_frame| to the |canvas| using |renderer_|, setting the | 56 // Paints the |video_frame| to the |canvas| using |renderer_|, setting the |
57 // color of |video_frame| to |color| first. | 57 // color of |video_frame| to |color| first. |
58 void Paint(VideoFrame* video_frame, SkCanvas* canvas, Color color); | 58 void Paint(VideoFrame* video_frame, SkCanvas* canvas, Color color); |
59 | 59 |
60 // Getters for various frame sizes. | 60 // Getters for various frame sizes. |
61 VideoFrame* natural_frame() { return natural_frame_; } | 61 VideoFrame* natural_frame() { return natural_frame_.get(); } |
62 VideoFrame* larger_frame() { return larger_frame_; } | 62 VideoFrame* larger_frame() { return larger_frame_.get(); } |
63 VideoFrame* smaller_frame() { return smaller_frame_; } | 63 VideoFrame* smaller_frame() { return smaller_frame_.get(); } |
64 VideoFrame* cropped_frame() { return cropped_frame_; } | 64 VideoFrame* cropped_frame() { return cropped_frame_.get(); } |
65 | 65 |
66 // Getters for canvases that trigger the various painting paths. | 66 // Getters for canvases that trigger the various painting paths. |
67 SkCanvas* fast_path_canvas() { return &fast_path_canvas_; } | 67 SkCanvas* fast_path_canvas() { return &fast_path_canvas_; } |
68 SkCanvas* slow_path_canvas() { return &slow_path_canvas_; } | 68 SkCanvas* slow_path_canvas() { return &slow_path_canvas_; } |
69 | 69 |
70 private: | 70 private: |
71 SkCanvasVideoRenderer renderer_; | 71 SkCanvasVideoRenderer renderer_; |
72 | 72 |
73 scoped_refptr<VideoFrame> natural_frame_; | 73 scoped_refptr<VideoFrame> natural_frame_; |
74 scoped_refptr<VideoFrame> larger_frame_; | 74 scoped_refptr<VideoFrame> larger_frame_; |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
339 kHeight * 1 / 6 - 1)); | 339 kHeight * 1 / 6 - 1)); |
340 EXPECT_EQ(SK_ColorRED, GetColorAt(slow_path_canvas(), kWidth * 3 / 8, | 340 EXPECT_EQ(SK_ColorRED, GetColorAt(slow_path_canvas(), kWidth * 3 / 8, |
341 kHeight * 1 / 6 - 1)); | 341 kHeight * 1 / 6 - 1)); |
342 EXPECT_EQ(SK_ColorGREEN, GetColorAt(slow_path_canvas(), kWidth * 1 / 8 - 1, | 342 EXPECT_EQ(SK_ColorGREEN, GetColorAt(slow_path_canvas(), kWidth * 1 / 8 - 1, |
343 kHeight * 3 / 6)); | 343 kHeight * 3 / 6)); |
344 EXPECT_EQ(SK_ColorBLUE, GetColorAt(slow_path_canvas(), kWidth * 3 / 8, | 344 EXPECT_EQ(SK_ColorBLUE, GetColorAt(slow_path_canvas(), kWidth * 3 / 8, |
345 kHeight * 3 / 6)); | 345 kHeight * 3 / 6)); |
346 } | 346 } |
347 | 347 |
348 } // namespace media | 348 } // namespace media |
OLD | NEW |