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/blink/skcanvas_video_renderer.h" | 5 #include "media/blink/skcanvas_video_renderer.h" |
6 | 6 |
7 #include "gpu/GLES2/gl2extchromium.h" | 7 #include "gpu/GLES2/gl2extchromium.h" |
8 #include "gpu/command_buffer/client/gles2_interface.h" | 8 #include "gpu/command_buffer/client/gles2_interface.h" |
9 #include "gpu/command_buffer/common/mailbox_holder.h" | 9 #include "gpu/command_buffer/common/mailbox_holder.h" |
10 #include "media/base/video_frame.h" | 10 #include "media/base/video_frame.h" |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 desc.fSampleCnt = 0; | 72 desc.fSampleCnt = 0; |
73 desc.fOrigin = kTopLeft_GrSurfaceOrigin; | 73 desc.fOrigin = kTopLeft_GrSurfaceOrigin; |
74 desc.fWidth = size.width(); | 74 desc.fWidth = size.width(); |
75 desc.fHeight = size.height(); | 75 desc.fHeight = size.height(); |
76 skia::RefPtr<GrTexture> texture = skia::AdoptRef( | 76 skia::RefPtr<GrTexture> texture = skia::AdoptRef( |
77 gr->textureProvider()->refScratchTexture( | 77 gr->textureProvider()->refScratchTexture( |
78 desc, GrTextureProvider::kExact_ScratchTexMatch)); | 78 desc, GrTextureProvider::kExact_ScratchTexMatch)); |
79 if (!texture.get()) | 79 if (!texture.get()) |
80 return false; | 80 return false; |
81 | 81 |
82 // A recycled texture may have pending writes. Make sure they are flushed | |
83 // before the texture is handed over for subsequent operations done outside | |
84 // of Skia. | |
85 texture->flushWrites(); | |
86 | |
87 SkImageInfo info = SkImageInfo::MakeN32Premul(desc.fWidth, desc.fHeight); | 82 SkImageInfo info = SkImageInfo::MakeN32Premul(desc.fWidth, desc.fHeight); |
88 SkGrPixelRef* pixel_ref = SkNEW_ARGS(SkGrPixelRef, (info, texture.get())); | 83 SkGrPixelRef* pixel_ref = SkNEW_ARGS(SkGrPixelRef, (info, texture.get())); |
89 if (!pixel_ref) | 84 if (!pixel_ref) |
90 return false; | 85 return false; |
91 bitmap->setInfo(info); | 86 bitmap->setInfo(info); |
92 bitmap->setPixelRef(pixel_ref)->unref(); | 87 bitmap->setPixelRef(pixel_ref)->unref(); |
93 return true; | 88 return true; |
94 } | 89 } |
95 | 90 |
96 class SyncPointClientImpl : public VideoFrame::SyncPointClient { | 91 class SyncPointClientImpl : public VideoFrame::SyncPointClient { |
(...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
678 } | 673 } |
679 | 674 |
680 void SkCanvasVideoRenderer::ResetAcceleratedLastFrame() { | 675 void SkCanvasVideoRenderer::ResetAcceleratedLastFrame() { |
681 accelerated_last_image_.reset(); | 676 accelerated_last_image_.reset(); |
682 accelerated_last_frame_.reset(); | 677 accelerated_last_frame_.reset(); |
683 accelerated_generator_ = nullptr; | 678 accelerated_generator_ = nullptr; |
684 accelerated_last_frame_timestamp_ = media::kNoTimestamp(); | 679 accelerated_last_frame_timestamp_ = media::kNoTimestamp(); |
685 } | 680 } |
686 | 681 |
687 } // namespace media | 682 } // namespace media |
OLD | NEW |