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

Unified Diff: remoting/base/util.cc

Issue 10024072: Cull unnecessary media::VideoFrame::Formats from the enum. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: shader_bench builds after having RGBA experimental code ripped out. Created 8 years, 8 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/util.h ('k') | remoting/host/capturer_fake_ascii.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/base/util.cc
diff --git a/remoting/base/util.cc b/remoting/base/util.cc
index 26886cad268d6315c1980ff24dbc3bf0cf0d3e60..b126f1547d43406baa4b7df910a6545e0c831481 100644
--- a/remoting/base/util.cc
+++ b/remoting/base/util.cc
@@ -17,6 +17,8 @@ using media::VideoFrame;
namespace remoting {
+enum { kBytesPerPixelRGB32 = 4 };
+
// Do not write LOG messages in this routine since it is called from within
// our LOG message handler. Bad things will happen.
std::string GetTimestampString() {
@@ -28,24 +30,9 @@ std::string GetTimestampString() {
tex.hour, tex.minute, tex.second);
}
-int GetBytesPerPixel(VideoFrame::Format format) {
- // Note: The order is important here for performance. This is sorted from the
- // most common to the less common (PIXEL_FORMAT_ASCII is mostly used
- // just for testing).
- switch (format) {
- case VideoFrame::RGB24: return 3;
- case VideoFrame::RGB565: return 2;
- case VideoFrame::RGB32: return 4;
- case VideoFrame::ASCII: return 1;
- default:
- NOTREACHED() << "Pixel format not supported";
- return 0;
- }
-}
-
// Helper methods to calculate plane offset given the coordinates.
static int CalculateRGBOffset(int x, int y, int stride) {
- return stride * y + GetBytesPerPixel(media::VideoFrame::RGB32) * x;
+ return stride * y + kBytesPerPixelRGB32 * x;
}
static int CalculateYOffset(int x, int y, int stride) {
@@ -274,7 +261,7 @@ void CopyRGB32Rect(const uint8* source_buffer,
source_stride,
dest_buffer + dest_offset,
dest_stride,
- GetBytesPerPixel(media::VideoFrame::RGB32),
+ kBytesPerPixelRGB32,
SkIRect::MakeWH(dest_rect.width(), dest_rect.height()));
}
« no previous file with comments | « remoting/base/util.h ('k') | remoting/host/capturer_fake_ascii.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698