| Index: media/remoting/interstitial.cc
|
| diff --git a/media/remoting/remoting_interstitial_ui.cc b/media/remoting/interstitial.cc
|
| similarity index 82%
|
| rename from media/remoting/remoting_interstitial_ui.cc
|
| rename to media/remoting/interstitial.cc
|
| index 5a703db8bf80ba254babaa22f810c98bf34f0ae6..c41f439a795728e55f2bda6477e9fa6807d08ca9 100644
|
| --- a/media/remoting/remoting_interstitial_ui.cc
|
| +++ b/media/remoting/interstitial.cc
|
| @@ -2,7 +2,7 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#include "media/remoting/remoting_interstitial_ui.h"
|
| +#include "media/remoting/interstitial.h"
|
|
|
| #include <algorithm> // for std::max()
|
|
|
| @@ -11,6 +11,7 @@
|
| #include "media/base/video_renderer_sink.h"
|
| #include "media/base/video_util.h"
|
| #include "skia/ext/image_operations.h"
|
| +#include "third_party/skia/include/core/SkBitmap.h"
|
| #include "third_party/skia/include/core/SkCanvas.h"
|
| #include "third_party/skia/include/core/SkTypeface.h"
|
| #include "third_party/skia/include/effects/SkBlurImageFilter.h"
|
| @@ -21,6 +22,7 @@
|
| #include "ui/gfx/vector_icons_public.h"
|
|
|
| namespace media {
|
| +namespace remoting {
|
|
|
| namespace {
|
|
|
| @@ -43,10 +45,10 @@ SkBitmap ResizeImage(const SkBitmap& image, const gfx::Size& scaled_size) {
|
| }
|
|
|
| void RenderCastMessage(const gfx::Size& canvas_size,
|
| - RemotingInterstitialType type,
|
| + InterstitialType type,
|
| SkCanvas* canvas) {
|
| DCHECK(canvas);
|
| - if (type == RemotingInterstitialType::BETWEEN_SESSIONS)
|
| + if (type == InterstitialType::BETWEEN_SESSIONS)
|
| return;
|
|
|
| // Blur the background image.
|
| @@ -79,7 +81,7 @@ void RenderCastMessage(const gfx::Size& canvas_size,
|
|
|
| // Draw the appropriate text.
|
| const std::string remote_playback_message =
|
| - (type == RemotingInterstitialType::IN_SESSION
|
| + (type == InterstitialType::IN_SESSION
|
| ? GetLocalizedStringUTF8(MEDIA_REMOTING_CASTING_VIDEO_TEXT)
|
| : GetLocalizedStringUTF8(MEDIA_REMOTING_CAST_ERROR_TEXT));
|
| size_t display_text_width = paint.measureText(remote_playback_message.data(),
|
| @@ -92,7 +94,7 @@ void RenderCastMessage(const gfx::Size& canvas_size,
|
|
|
| // Draw the appropriate Cast icon.
|
| gfx::VectorIconId current_icon =
|
| - (type == RemotingInterstitialType::IN_SESSION
|
| + (type == InterstitialType::IN_SESSION
|
| ? gfx::VectorIconId::MEDIA_ROUTER_ACTIVE
|
| : gfx::VectorIconId::MEDIA_ROUTER_WARNING);
|
| gfx::ImageSkia icon_image = gfx::CreateVectorIcon(
|
| @@ -117,10 +119,9 @@ gfx::Size GetCanvasSize(const gfx::Size& image_size,
|
| : result;
|
| }
|
|
|
| -scoped_refptr<VideoFrame> RenderInterstitialFrame(
|
| - const SkBitmap& image,
|
| - const gfx::Size& natural_size,
|
| - RemotingInterstitialType type) {
|
| +scoped_refptr<VideoFrame> RenderInterstitialFrame(const SkBitmap& image,
|
| + const gfx::Size& natural_size,
|
| + InterstitialType type) {
|
| gfx::Size canvas_size =
|
| GetCanvasSize(gfx::Size(image.width(), image.height()), natural_size);
|
| SkBitmap canvas_bitmap;
|
| @@ -133,7 +134,7 @@ scoped_refptr<VideoFrame> RenderInterstitialFrame(
|
| gfx::Rect centered_rect = ComputeLetterboxRegion(
|
| gfx::Rect(canvas_size), gfx::Size(image.width(), image.height()));
|
| SkBitmap processed_image = ResizeImage(image, centered_rect.size());
|
| - if (type != RemotingInterstitialType::BETWEEN_SESSIONS) {
|
| + if (type != InterstitialType::BETWEEN_SESSIONS) {
|
| color_utils::HSL shift = {-1, 0, 0.2}; // Make monochromatic.
|
| processed_image =
|
| SkBitmapOperations::CreateHSLShiftedBitmap(processed_image, shift);
|
| @@ -144,24 +145,24 @@ scoped_refptr<VideoFrame> RenderInterstitialFrame(
|
| RenderCastMessage(canvas_size, type, &canvas);
|
|
|
| // Create a new VideoFrame, copy the bitmap, then return it.
|
| - scoped_refptr<media::VideoFrame> video_frame = media::VideoFrame::CreateFrame(
|
| - media::PIXEL_FORMAT_I420, canvas_size, gfx::Rect(canvas_size),
|
| - canvas_size, base::TimeDelta());
|
| + scoped_refptr<VideoFrame> video_frame = VideoFrame::CreateFrame(
|
| + PIXEL_FORMAT_I420, canvas_size, gfx::Rect(canvas_size), canvas_size,
|
| + base::TimeDelta());
|
| canvas_bitmap.lockPixels();
|
| - media::CopyRGBToVideoFrame(
|
| - reinterpret_cast<uint8_t*>(canvas_bitmap.getPixels()),
|
| - canvas_bitmap.rowBytes(),
|
| - gfx::Rect(canvas_size.width(), canvas_size.height()), video_frame.get());
|
| + CopyRGBToVideoFrame(reinterpret_cast<uint8_t*>(canvas_bitmap.getPixels()),
|
| + canvas_bitmap.rowBytes(),
|
| + gfx::Rect(canvas_size.width(), canvas_size.height()),
|
| + video_frame.get());
|
| canvas_bitmap.unlockPixels();
|
| return video_frame;
|
| }
|
|
|
| } // namespace
|
|
|
| -void PaintRemotingInterstitial(const SkBitmap& image,
|
| - const gfx::Size& natural_size,
|
| - RemotingInterstitialType interstitial_type,
|
| - VideoRendererSink* video_renderer_sink) {
|
| +void PaintInterstitial(const SkBitmap& image,
|
| + const gfx::Size& natural_size,
|
| + InterstitialType interstitial_type,
|
| + VideoRendererSink* video_renderer_sink) {
|
| if (!video_renderer_sink)
|
| return;
|
|
|
| @@ -171,4 +172,5 @@ void PaintRemotingInterstitial(const SkBitmap& image,
|
| video_renderer_sink->PaintSingleFrame(interstitial);
|
| }
|
|
|
| +} // namespace remoting
|
| } // namespace media
|
|
|