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

Unified Diff: remoting/base/protocol_util.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.h ('k') | remoting/client/decoder_verbatim.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « remoting/base/protocol_util.h ('k') | remoting/client/decoder_verbatim.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698