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 <stdint.h> | 5 #include <stdint.h> |
6 | 6 |
7 #include "base/macros.h" | 7 #include "base/macros.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "gpu/GLES2/gl2extchromium.h" | 9 #include "gpu/GLES2/gl2extchromium.h" |
10 #include "gpu/command_buffer/client/gles2_interface_stub.h" | 10 #include "gpu/command_buffer/client/gles2_interface_stub.h" |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
199 cropped_frame()->stride(VideoFrame::kYPlane), | 199 cropped_frame()->stride(VideoFrame::kYPlane), |
200 cropped_frame()->data(VideoFrame::kUPlane), | 200 cropped_frame()->data(VideoFrame::kUPlane), |
201 cropped_frame()->stride(VideoFrame::kUPlane), | 201 cropped_frame()->stride(VideoFrame::kUPlane), |
202 cropped_frame()->data(VideoFrame::kVPlane), | 202 cropped_frame()->data(VideoFrame::kVPlane), |
203 cropped_frame()->stride(VideoFrame::kVPlane), 16, 16); | 203 cropped_frame()->stride(VideoFrame::kVPlane), 16, 16); |
204 } | 204 } |
205 | 205 |
206 SkCanvasVideoRendererTest::~SkCanvasVideoRendererTest() {} | 206 SkCanvasVideoRendererTest::~SkCanvasVideoRendererTest() {} |
207 | 207 |
208 void SkCanvasVideoRendererTest::PaintWithoutFrame(SkCanvas* canvas) { | 208 void SkCanvasVideoRendererTest::PaintWithoutFrame(SkCanvas* canvas) { |
209 renderer_.Paint(nullptr, canvas, kNaturalRect, 0xFF, | 209 SkPaint paint; |
210 SkXfermode::kSrcOver_Mode, VIDEO_ROTATION_0, Context3D()); | 210 paint.setXfermodeMode(SkXfermode::kSrc_Mode); |
Justin Novosad
2016/08/25 19:18:19
You changed SrcOver to Src. SrcOver is the default
xidachen
2016/08/26 02:21:39
Done.
| |
211 paint.setAlpha(0xFF); | |
Justin Novosad
2016/08/25 19:18:19
This is a no-op. 0xFF is the default
xidachen
2016/08/26 02:21:39
Done.
| |
212 paint.setFilterQuality(kLow_SkFilterQuality); | |
Justin Novosad
2016/08/25 19:18:19
This is also a no-op
xidachen
2016/08/26 02:21:39
I believe the default filter quality is kNone.
| |
213 renderer_.Paint(nullptr, canvas, kNaturalRect, &paint, VIDEO_ROTATION_0, | |
214 Context3D()); | |
211 } | 215 } |
212 | 216 |
213 void SkCanvasVideoRendererTest::Paint( | 217 void SkCanvasVideoRendererTest::Paint( |
214 const scoped_refptr<VideoFrame>& video_frame, | 218 const scoped_refptr<VideoFrame>& video_frame, |
215 SkCanvas* canvas, | 219 SkCanvas* canvas, |
216 Color color) { | 220 Color color) { |
217 PaintRotated(video_frame, canvas, kNaturalRect, color, | 221 PaintRotated(video_frame, canvas, kNaturalRect, color, |
218 SkXfermode::kSrcOver_Mode, VIDEO_ROTATION_0); | 222 SkXfermode::kSrcOver_Mode, VIDEO_ROTATION_0); |
219 } | 223 } |
220 | 224 |
(...skipping 10 matching lines...) Expand all Loading... | |
231 case kRed: | 235 case kRed: |
232 media::FillYUV(video_frame.get(), 76, 84, 255); | 236 media::FillYUV(video_frame.get(), 76, 84, 255); |
233 break; | 237 break; |
234 case kGreen: | 238 case kGreen: |
235 media::FillYUV(video_frame.get(), 149, 43, 21); | 239 media::FillYUV(video_frame.get(), 149, 43, 21); |
236 break; | 240 break; |
237 case kBlue: | 241 case kBlue: |
238 media::FillYUV(video_frame.get(), 29, 255, 107); | 242 media::FillYUV(video_frame.get(), 29, 255, 107); |
239 break; | 243 break; |
240 } | 244 } |
241 renderer_.Paint(video_frame, canvas, dest_rect, 0xFF, mode, video_rotation, | 245 SkPaint paint; |
246 paint.setXfermodeMode(mode); | |
247 paint.setAlpha(0xFF); | |
248 paint.setFilterQuality(kLow_SkFilterQuality); | |
249 renderer_.Paint(video_frame, canvas, dest_rect, &paint, video_rotation, | |
242 Context3D()); | 250 Context3D()); |
243 } | 251 } |
244 | 252 |
245 void SkCanvasVideoRendererTest::Copy( | 253 void SkCanvasVideoRendererTest::Copy( |
246 const scoped_refptr<VideoFrame>& video_frame, | 254 const scoped_refptr<VideoFrame>& video_frame, |
247 SkCanvas* canvas) { | 255 SkCanvas* canvas) { |
248 renderer_.Copy(video_frame, canvas, Context3D()); | 256 renderer_.Copy(video_frame, canvas, Context3D()); |
249 } | 257 } |
250 | 258 |
251 TEST_F(SkCanvasVideoRendererTest, NoFrame) { | 259 TEST_F(SkCanvasVideoRendererTest, NoFrame) { |
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
529 | 537 |
530 TestGLES2Interface gles2; | 538 TestGLES2Interface gles2; |
531 Context3D context_3d(&gles2, gr_context.get()); | 539 Context3D context_3d(&gles2, gr_context.get()); |
532 gfx::Size size(kWidth, kHeight); | 540 gfx::Size size(kWidth, kHeight); |
533 gpu::MailboxHolder holders[VideoFrame::kMaxPlanes] = {gpu::MailboxHolder( | 541 gpu::MailboxHolder holders[VideoFrame::kMaxPlanes] = {gpu::MailboxHolder( |
534 gpu::Mailbox::Generate(), gpu::SyncToken(), GL_TEXTURE_RECTANGLE_ARB)}; | 542 gpu::Mailbox::Generate(), gpu::SyncToken(), GL_TEXTURE_RECTANGLE_ARB)}; |
535 auto video_frame = VideoFrame::WrapNativeTextures( | 543 auto video_frame = VideoFrame::WrapNativeTextures( |
536 PIXEL_FORMAT_UYVY, holders, base::Bind(MailboxHoldersReleased), size, | 544 PIXEL_FORMAT_UYVY, holders, base::Bind(MailboxHoldersReleased), size, |
537 gfx::Rect(size), size, kNoTimestamp); | 545 gfx::Rect(size), size, kNoTimestamp); |
538 | 546 |
539 renderer_.Paint(video_frame, &canvas, kNaturalRect, 0xFF, | 547 SkPaint paint; |
540 SkXfermode::kSrcOver_Mode, VIDEO_ROTATION_90, context_3d); | 548 paint.setXfermodeMode(SkXfermode::kSrc_Mode); |
Justin Novosad
2016/08/25 19:18:19
You change this from SrcOver to Src. Accident?
xidachen
2016/08/26 02:21:39
Done.
| |
549 paint.setAlpha(0xFF); | |
550 paint.setFilterQuality(kLow_SkFilterQuality); | |
Justin Novosad
2016/08/25 19:18:19
These setting are the defaults; You could just use
| |
551 renderer_.Paint(video_frame, &canvas, kNaturalRect, &paint, VIDEO_ROTATION_90, | |
552 context_3d); | |
541 } | 553 } |
542 } // namespace media | 554 } // namespace media |
OLD | NEW |