diff options
author | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-26 03:58:37 +0000 |
---|---|---|
committer | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-26 03:58:37 +0000 |
commit | 0bf0ce3331ea4e597b47126dd71c6448fdc4fc5f (patch) | |
tree | e4ef214610266318497ec72d64aa4e0f53d792f8 /remoting/client | |
parent | 193b0b89b4b49f8e8eb985b8f1a16e3c8506ee66 (diff) | |
download | chromium_src-0bf0ce3331ea4e597b47126dd71c6448fdc4fc5f.zip chromium_src-0bf0ce3331ea4e597b47126dd71c6448fdc4fc5f.tar.gz chromium_src-0bf0ce3331ea4e597b47126dd71c6448fdc4fc5f.tar.bz2 |
remoting: Extract the utility to get the BytesPerPixel from PixelFormat into a function.
Note: That was a TODO for hclam.
BUG=None
TEST=trybots
Review URL: http://codereview.chromium.org/2865019
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@50928 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/client')
-rw-r--r-- | remoting/client/decoder_verbatim.cc | 17 |
1 files changed, 3 insertions, 14 deletions
diff --git a/remoting/client/decoder_verbatim.cc b/remoting/client/decoder_verbatim.cc index 69b04ae..aba5dce 100644 --- a/remoting/client/decoder_verbatim.cc +++ b/remoting/client/decoder_verbatim.cc @@ -4,6 +4,8 @@ #include "remoting/client/decoder_verbatim.h" +#include "remoting/base/protocol_util.h" + namespace remoting { DecoderVerbatim::DecoderVerbatim() @@ -37,20 +39,6 @@ bool DecoderVerbatim::PartialDecode(HostMessage* message) { int y = message->update_stream_packet().header().y(); PixelFormat pixel_format = message->update_stream_packet().header().pixel_format(); - int bytes_per_pixel = 0; - - // TODO(hclam): Extract the following to an util function. - if (pixel_format == PixelFormatRgb24) { - bytes_per_pixel = 3; - } else if (pixel_format == PixelFormatRgb565) { - bytes_per_pixel = 2; - } else if (pixel_format == PixelFormatRgb32) { - bytes_per_pixel = 4; - } else if (pixel_format == PixelFormatAscii) { - bytes_per_pixel = 1; - } else { - NOTREACHED() << "Pixel format not supported"; - } if (static_cast<PixelFormat>(frame_->format()) != pixel_format) { NOTREACHED() << "Pixel format of message doesn't match the video frame. " @@ -59,6 +47,7 @@ bool DecoderVerbatim::PartialDecode(HostMessage* message) { << " Color space conversion required."; } + int bytes_per_pixel = GetBytesPerPixel(pixel_format); // Copy the data line by line. const int src_stride = bytes_per_pixel * width; const char* src = message->update_stream_packet().data().c_str(); |