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/renderers/skcanvas_video_renderer.h" | 5 #include "media/renderers/skcanvas_video_renderer.h" |
6 | 6 |
7 #include <GLES3/gl3.h> | 7 #include <GLES3/gl3.h> |
8 #include <limits> | 8 #include <limits> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
413 // This is a workaround for crbug.com/524717. A texture backed image is not | 413 // This is a workaround for crbug.com/524717. A texture backed image is not |
414 // safe to access on another thread or GL context. So if we're drawing into a | 414 // safe to access on another thread or GL context. So if we're drawing into a |
415 // recording canvas we read the texture back into CPU memory and record that | 415 // recording canvas we read the texture back into CPU memory and record that |
416 // sw image into the SkPicture. The long term solution is for Skia to provide | 416 // sw image into the SkPicture. The long term solution is for Skia to provide |
417 // a SkPicture filter that makes a picture safe for multiple CPU raster | 417 // a SkPicture filter that makes a picture safe for multiple CPU raster |
418 // threads. (skbug.com/4321). | 418 // threads. (skbug.com/4321). |
419 if (canvas->imageInfo().colorType() == kUnknown_SkColorType) { | 419 if (canvas->imageInfo().colorType() == kUnknown_SkColorType) { |
420 sk_sp<SkImage> swImage = last_image_->makeNonTextureImage(); | 420 sk_sp<SkImage> swImage = last_image_->makeNonTextureImage(); |
421 canvas->drawImage(swImage, 0, 0, &video_flags); | 421 canvas->drawImage(swImage, 0, 0, &video_flags); |
422 } else { | 422 } else { |
423 canvas->drawImage(last_image_.get(), 0, 0, &video_flags); | 423 canvas->drawImage(last_image_, 0, 0, &video_flags); |
424 } | 424 } |
425 | 425 |
426 if (need_transform) | 426 if (need_transform) |
427 canvas->restore(); | 427 canvas->restore(); |
428 // Make sure to flush so we can remove the videoframe from the generator. | 428 // Make sure to flush so we can remove the videoframe from the generator. |
429 canvas->flush(); | 429 canvas->flush(); |
430 | 430 |
431 if (video_frame->HasTextures()) { | 431 if (video_frame->HasTextures()) { |
432 DCHECK(gl); | 432 DCHECK(gl); |
433 SyncTokenClientImpl client(gl); | 433 SyncTokenClientImpl client(gl); |
(...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
957 last_image_->bounds().contains(visible_rect)) { | 957 last_image_->bounds().contains(visible_rect)) { |
958 last_image_ = last_image_->makeSubset(visible_rect); | 958 last_image_ = last_image_->makeSubset(visible_rect); |
959 } | 959 } |
960 } | 960 } |
961 | 961 |
962 SkISize SkCanvasVideoRenderer::LastImageDimensionsForTesting() { | 962 SkISize SkCanvasVideoRenderer::LastImageDimensionsForTesting() { |
963 return last_image_dimensions_for_testing_; | 963 return last_image_dimensions_for_testing_; |
964 } | 964 } |
965 | 965 |
966 } // namespace media | 966 } // namespace media |
OLD | NEW |