Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(208)

Unified Diff: remoting/client/decoder_verbatim.cc

Issue 2865019: remoting: Extract the utility to get the BytesPerPixel from PixelFormat into a function. (Closed)
Patch Set: sort order Created 10 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « remoting/base/protocol_util.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/client/decoder_verbatim.cc
diff --git a/remoting/client/decoder_verbatim.cc b/remoting/client/decoder_verbatim.cc
index 69b04ae00cb5a7af9fd885a60e4cad065a9055ec..aba5dceb4b0b941157c62870f9b73a0a00826c17 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();
« no previous file with comments | « remoting/base/protocol_util.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698