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

Unified Diff: chrome/browser/renderer_host/backing_store_win.cc

Issue 131002: Enable off-by-default monitor color management on Windows. This is enabled vi... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 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
Index: chrome/browser/renderer_host/backing_store_win.cc
===================================================================
--- chrome/browser/renderer_host/backing_store_win.cc (revision 18625)
+++ chrome/browser/renderer_host/backing_store_win.cc (working copy)
@@ -4,16 +4,37 @@
#include "chrome/browser/renderer_host/backing_store.h"
+#include "base/command_line.h"
#include "base/gfx/gdi_util.h"
#include "chrome/browser/renderer_host/render_widget_host.h"
+#include "chrome/common/chrome_switches.h"
#include "chrome/common/transport_dib.h"
namespace {
// Creates a dib conforming to the height/width/section parameters passed in.
HANDLE CreateDIB(HDC dc, int width, int height, int color_depth) {
- BITMAPINFOHEADER hdr;
- gfx::CreateBitmapHeaderWithColorDepth(width, height, color_depth, &hdr);
+ BITMAPV5HEADER hdr = {0};
+ ZeroMemory(&hdr, sizeof(BITMAPV5HEADER));
+
+ // These values are shared with gfx::PlatformDevice
+ hdr.bV5Size = sizeof(BITMAPINFOHEADER);
+ hdr.bV5Width = width;
+ hdr.bV5Height = -height; // minus means top-down bitmap
+ hdr.bV5Planes = 1;
+ hdr.bV5BitCount = color_depth;
+ hdr.bV5Compression = BI_RGB; // no compression
+ hdr.bV5SizeImage = 0;
+ hdr.bV5XPelsPerMeter = 1;
+ hdr.bV5YPelsPerMeter = 1;
+ hdr.bV5ClrUsed = 0;
M-A Ruel 2009/06/18 00:19:09 nit: Do you really want to keep the = 0?
+ hdr.bV5ClrImportant = 0;
+
+ if (BackingStore::ColorManagementEnabled()) {
+ hdr.bV5CSType = LCS_sRGB;
+ hdr.bV5Intent = LCS_GM_IMAGES;
+ }
+
void* data = NULL;
HANDLE dib = CreateDIBSection(dc, reinterpret_cast<BITMAPINFO*>(&hdr),
0, &data, NULL, 0);
@@ -53,6 +74,18 @@
DeleteDC(hdc_);
}
+// static
+bool BackingStore::ColorManagementEnabled() {
+ static bool enabled = false;
M-A Ruel 2009/06/18 00:19:09 humm... There's one issue I easily see is RDP ses
+ static bool checked = false;
+ if (!checked) {
+ checked = true;
+ const CommandLine& command = *CommandLine::ForCurrentProcess();
+ enabled = command.HasSwitch(switches::kEnableMonitorProfile);
+ }
+ return enabled;
+}
+
void BackingStore::PaintRect(base::ProcessHandle process,
TransportDIB* bitmap,
const gfx::Rect& bitmap_rect) {
« no previous file with comments | « chrome/browser/renderer_host/backing_store.h ('k') | chrome/browser/renderer_host/render_widget_host_view_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698