| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "content/renderer/media/android/webmediaplayer_android.h" | 5 #include "content/renderer/media/android/webmediaplayer_android.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <limits> | 9 #include <limits> |
| 10 | 10 |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 GrTextureDesc desc; | 121 GrTextureDesc desc; |
| 122 // Use kRGBA_8888_GrPixelConfig, not kSkia8888_GrPixelConfig, to avoid | 122 // Use kRGBA_8888_GrPixelConfig, not kSkia8888_GrPixelConfig, to avoid |
| 123 // RGBA to BGRA conversion. | 123 // RGBA to BGRA conversion. |
| 124 desc.fConfig = kRGBA_8888_GrPixelConfig; | 124 desc.fConfig = kRGBA_8888_GrPixelConfig; |
| 125 // kRenderTarget_GrTextureFlagBit avoids a copy before readback in skia. | 125 // kRenderTarget_GrTextureFlagBit avoids a copy before readback in skia. |
| 126 desc.fFlags = kRenderTarget_GrSurfaceFlag; | 126 desc.fFlags = kRenderTarget_GrSurfaceFlag; |
| 127 desc.fSampleCnt = 0; | 127 desc.fSampleCnt = 0; |
| 128 desc.fOrigin = kTopLeft_GrSurfaceOrigin; | 128 desc.fOrigin = kTopLeft_GrSurfaceOrigin; |
| 129 desc.fWidth = size.width(); | 129 desc.fWidth = size.width(); |
| 130 desc.fHeight = size.height(); | 130 desc.fHeight = size.height(); |
| 131 skia::RefPtr<GrTexture> texture = skia::AdoptRef( | 131 sk_sp<GrTexture> texture(gr->textureProvider()->refScratchTexture( |
| 132 gr->textureProvider()->refScratchTexture( | 132 desc, GrTextureProvider::kExact_ScratchTexMatch)); |
| 133 desc, GrTextureProvider::kExact_ScratchTexMatch)); | |
| 134 if (!texture.get()) | 133 if (!texture.get()) |
| 135 return false; | 134 return false; |
| 136 | 135 |
| 137 SkImageInfo info = SkImageInfo::MakeN32Premul(desc.fWidth, desc.fHeight); | 136 SkImageInfo info = SkImageInfo::MakeN32Premul(desc.fWidth, desc.fHeight); |
| 138 SkGrPixelRef* pixel_ref = new SkGrPixelRef(info, texture.get()); | 137 SkGrPixelRef* pixel_ref = new SkGrPixelRef(info, texture.get()); |
| 139 if (!pixel_ref) | 138 if (!pixel_ref) |
| 140 return false; | 139 return false; |
| 141 bitmap->setInfo(info); | 140 bitmap->setInfo(info); |
| 142 bitmap->setPixelRef(pixel_ref)->unref(); | 141 bitmap->setPixelRef(pixel_ref)->unref(); |
| 143 return true; | 142 return true; |
| (...skipping 1535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1679 result = PREDICTION_RESULT_PATH_BASED_WAS_BETTER; | 1678 result = PREDICTION_RESULT_PATH_BASED_WAS_BETTER; |
| 1680 } else if (is_hls_url == is_hls) { | 1679 } else if (is_hls_url == is_hls) { |
| 1681 result = PREDICTION_RESULT_URL_BASED_WAS_BETTER; | 1680 result = PREDICTION_RESULT_URL_BASED_WAS_BETTER; |
| 1682 } | 1681 } |
| 1683 UMA_HISTOGRAM_ENUMERATION( | 1682 UMA_HISTOGRAM_ENUMERATION( |
| 1684 "Media.Android.IsHttpLiveStreamingMediaPredictionResult", | 1683 "Media.Android.IsHttpLiveStreamingMediaPredictionResult", |
| 1685 result, PREDICTION_RESULT_MAX); | 1684 result, PREDICTION_RESULT_MAX); |
| 1686 } | 1685 } |
| 1687 | 1686 |
| 1688 } // namespace content | 1687 } // namespace content |
| OLD | NEW |