Index: remoting/base/protocol_util.cc |
diff --git a/remoting/base/protocol_util.cc b/remoting/base/protocol_util.cc |
index 3ac738c5b838c1d43b2a70ea6f0088352003d2f0..508ae44afc20c07d9e1396312f65ac96fea9eed0 100644 |
--- a/remoting/base/protocol_util.cc |
+++ b/remoting/base/protocol_util.cc |
@@ -24,4 +24,19 @@ scoped_refptr<media::DataBuffer> SerializeAndFrameMessage( |
return buffer; |
} |
+int GetBytesPerPixel(PixelFormat format) { |
+ // Note: The order is important here for performace. This is sorted from the |
+ // most common to the less common (PixelFormatAscii is mostly used |
+ // just for testing). |
+ switch (format) { |
+ case PixelFormatRgb24: return 3; |
+ case PixelFormatRgb565: return 2; |
+ case PixelFormatRgb32: return 4; |
+ case PixelFormatAscii: return 1; |
+ default: |
+ NOTREACHED() << "Pixel format not supported"; |
+ return 0; |
+ } |
+} |
+ |
} // namespace remoting |