summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--base/base.gyp1
-rw-r--r--base/base.gypi1
-rw-r--r--base/win/scoped_hdc.cc116
-rw-r--r--base/win/scoped_hdc.h112
-rw-r--r--base/win/scoped_hdc_unittest.cc88
-rw-r--r--chrome/browser/aeropeek_manager.cc8
-rw-r--r--chrome/browser/ui/window_snapshot/window_snapshot_win.cc33
-rw-r--r--chrome/renderer/print_web_view_helper_win.cc12
-rw-r--r--chrome/service/cloud_print/print_system_win.cc31
-rw-r--r--printing/emf_win_unittest.cc8
-rw-r--r--remoting/host/disconnect_window_win.cc4
-rw-r--r--ui/gfx/native_theme_win.cc18
12 files changed, 104 insertions, 328 deletions
diff --git a/base/base.gyp b/base/base.gyp
index 359426a..324c812 100644
--- a/base/base.gyp
+++ b/base/base.gyp
@@ -260,7 +260,6 @@
'win/sampling_profiler_unittest.cc',
'win/scoped_bstr_unittest.cc',
'win/scoped_comptr_unittest.cc',
- 'win/scoped_hdc_unittest.cc',
'win/scoped_variant_unittest.cc',
'win/win_util_unittest.cc',
'win/wrapped_window_proc_unittest.cc',
diff --git a/base/base.gypi b/base/base.gypi
index 3374515..36400ed 100644
--- a/base/base.gypi
+++ b/base/base.gypi
@@ -404,7 +404,6 @@
'win/scoped_comptr.h',
'win/scoped_gdi_object.h',
'win/scoped_handle.h',
- 'win/scoped_hdc.cc',
'win/scoped_hdc.h',
'win/scoped_hglobal.h',
'win/scoped_select_object.h',
diff --git a/base/win/scoped_hdc.cc b/base/win/scoped_hdc.cc
deleted file mode 100644
index f767a82..0000000
--- a/base/win/scoped_hdc.cc
+++ /dev/null
@@ -1,116 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "base/win/scoped_hdc.h"
-
-#include "base/logging.h"
-
-namespace base {
-namespace win {
-
-ScopedDC::ScopedDC(HDC hdc)
- : hdc_(hdc),
- bitmap_(0),
- font_(0),
- brush_(0),
- pen_(0),
- region_(0) {
-}
-
-ScopedDC::~ScopedDC() {}
-
-void ScopedDC::SelectBitmap(HBITMAP bitmap) {
- Select(bitmap, &bitmap_);
-}
-
-void ScopedDC::SelectFont(HFONT font) {
- Select(font, &font_);
-}
-
-void ScopedDC::SelectBrush(HBRUSH brush) {
- Select(brush, &brush_);
-}
-
-void ScopedDC::SelectPen(HPEN pen) {
- Select(pen, &pen_);
-}
-
-void ScopedDC::SelectRegion(HRGN region) {
- Select(region, &region_);
-}
-
-void ScopedDC::Close() {
- if (!hdc_)
- return;
- ResetObjects();
- DisposeDC(hdc_);
-}
-
-void ScopedDC::Reset(HDC hdc) {
- Close();
- hdc_ = hdc;
-}
-
-void ScopedDC::ResetObjects() {
- if (bitmap_) {
- SelectObject(hdc_, bitmap_);
- bitmap_ = 0;
- }
- if (font_) {
- SelectObject(hdc_, font_);
- font_ = 0;
- }
- if (brush_) {
- SelectObject(hdc_, brush_);
- brush_ = 0;
- }
- if (pen_) {
- SelectObject(hdc_, pen_);
- pen_ = 0;
- }
- if (region_) {
- SelectObject(hdc_, region_);
- region_ = 0;
- }
-}
-
-void ScopedDC::Select(HGDIOBJ object, HGDIOBJ* holder) {
- HGDIOBJ old = SelectObject(hdc_, object);
- DCHECK(old);
- // We only want to store the first |old| object.
- if (!*holder)
- *holder = old;
-}
-
-ScopedGetDC::ScopedGetDC(HWND hwnd) : ScopedDC(GetDC(hwnd)), hwnd_(hwnd) {
-}
-
-ScopedGetDC::~ScopedGetDC() {
- Close();
-}
-
-void ScopedGetDC::DisposeDC(HDC hdc) {
- ReleaseDC(hwnd_, hdc);
-}
-
-ScopedCreateDC::ScopedCreateDC() : ScopedDC(0) {
-}
-
-ScopedCreateDC::ScopedCreateDC(HDC hdc) : ScopedDC(hdc) {
-}
-
-ScopedCreateDC::~ScopedCreateDC() {
- Close();
-}
-
-void ScopedCreateDC::Set(HDC hdc) {
- Reset(hdc);
-}
-
-void ScopedCreateDC::DisposeDC(HDC hdc) {
- DeleteDC(hdc);
-}
-
-} // namespace win
-} // namespace base
diff --git a/base/win/scoped_hdc.h b/base/win/scoped_hdc.h
index 2a93b95..9e2ea62 100644
--- a/base/win/scoped_hdc.h
+++ b/base/win/scoped_hdc.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -9,91 +9,69 @@
#include <windows.h>
#include "base/basictypes.h"
-#include "base/compiler_specific.h"
+#include "base/logging.h"
namespace base {
namespace win {
-// The ScopedGetDC and ScopedCreateDC classes manage the default GDI objects
-// that are initially selected into a DC. They help you avoid the following
-// common mistake:
-//
-// HDC hdc = GetDC(NULL);
-// SelectObject(hdc, new_bitmap);
-// .. drawing code here ..
-// ReleaseDC(hdc); <--- error: the DC has a custom object still selected!
-//
-// This code should be:
-//
-// HDC hdc = GetDC(NULL);
-// HGDIOBJ old_obj = SelectObject(hdc, new_bitmap);
-// .. drawing code here ..
-// SelectObject(hdc, old_obj);
-// ReleaseDC(hdc); <--- ok to release now.
-//
-// But why work so hard? Use our handy classes:
-//
-// ScopedGetDC dc(NULL);
-// dc.SelectBitmap(hdc, new_bitmap);
-// .. drawing here
-// .. when dc goes out of scope it will select the original object before
-// .. being released.
-//
-class ScopedDC {
+// Like ScopedHandle but for HDC. Only use this on HDCs returned from
+// GetDC.
+class ScopedGetDC {
public:
- virtual ~ScopedDC();
-
- virtual void DisposeDC(HDC hdc) = 0;
-
- HDC get() { return hdc_; }
+ explicit ScopedGetDC(HWND hwnd)
+ : hwnd_(hwnd),
+ hdc_(GetDC(hwnd)) {
+ DCHECK(!hwnd_ || IsWindow(hwnd_));
+ DCHECK(hdc_);
+ }
- void SelectBitmap(HBITMAP bitmap);
- void SelectFont(HFONT font);
- void SelectBrush(HBRUSH brush);
- void SelectPen(HPEN pen);
- void SelectRegion(HRGN region);
+ ~ScopedGetDC() {
+ if (hdc_)
+ ReleaseDC(hwnd_, hdc_);
+ }
- protected:
- ScopedDC(HDC hdc);
- void Close();
- void Reset(HDC hdc);
+ operator HDC() { return hdc_; }
private:
- void ResetObjects();
- void Select(HGDIOBJ object, HGDIOBJ* holder);
-
+ HWND hwnd_;
HDC hdc_;
- HGDIOBJ bitmap_;
- HGDIOBJ font_;
- HGDIOBJ brush_;
- HGDIOBJ pen_;
- HGDIOBJ region_;
-};
-
-// Creates and manages an HDC obtained by GetDC.
-class ScopedGetDC : public ScopedDC {
- public:
- explicit ScopedGetDC(HWND hwnd);
- virtual ~ScopedGetDC();
- private:
- virtual void DisposeDC(HDC hdc) OVERRIDE;
-
- HWND hwnd_;
DISALLOW_COPY_AND_ASSIGN(ScopedGetDC);
};
// Like ScopedHandle but for HDC. Only use this on HDCs returned from
// CreateCompatibleDC, CreateDC and CreateIC.
-class ScopedCreateDC : public ScopedDC {
+class ScopedCreateDC {
public:
- ScopedCreateDC();
- explicit ScopedCreateDC(HDC hdc);
- virtual ~ScopedCreateDC();
- void Set(HDC hdc);
+ ScopedCreateDC() : hdc_(NULL) { }
+ explicit ScopedCreateDC(HDC h) : hdc_(h) { }
+
+ ~ScopedCreateDC() {
+ Close();
+ }
+
+ HDC Get() {
+ return hdc_;
+ }
+
+ void Set(HDC h) {
+ Close();
+ hdc_ = h;
+ }
+
+ operator HDC() { return hdc_; }
private:
- virtual void DisposeDC(HDC hdc) OVERRIDE;
+ void Close() {
+#ifdef NOGDI
+ assert(false);
+#else
+ if (hdc_)
+ DeleteDC(hdc_);
+#endif // NOGDI
+ }
+
+ HDC hdc_;
DISALLOW_COPY_AND_ASSIGN(ScopedCreateDC);
};
diff --git a/base/win/scoped_hdc_unittest.cc b/base/win/scoped_hdc_unittest.cc
deleted file mode 100644
index 014a1d1..0000000
--- a/base/win/scoped_hdc_unittest.cc
+++ /dev/null
@@ -1,88 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include <windows.h>
-
-#include "base/basictypes.h"
-#include "base/win/scoped_hdc.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-namespace {
-
-// Helper class that allows testing ScopedDC<T>.
-class TestScopedDC : public base::win::ScopedDC {
- public:
- explicit TestScopedDC(HDC hdc)
- : ScopedDC(hdc) {
- }
-
- virtual ~TestScopedDC() {
- Close();
- }
-
- private:
- virtual void DisposeDC(HDC hdc) OVERRIDE {
- // We leak the DC, so we can test its state. The test itself
- // will dispose of the dc later.
- }
-
- DISALLOW_COPY_AND_ASSIGN(TestScopedDC);
-};
-
-bool IsValidDC(HDC hdc) {
- // The theory here is that any (cheap) GDI operation should fail for
- // an invalid dc.
- return GetCurrentObject(hdc, OBJ_BITMAP) != NULL;
-}
-
-} // namespace
-
-TEST(BaseWinScopedDC, CreateDestroy) {
- HDC hdc1;
- {
- base::win::ScopedGetDC dc1(NULL);
- hdc1 = dc1.get();
- EXPECT_TRUE(IsValidDC(hdc1));
- }
- EXPECT_FALSE(IsValidDC(hdc1));
-
- HDC hdc2 = CreateDC(L"DISPLAY", NULL, NULL, NULL);
- ASSERT_TRUE(IsValidDC(hdc2));
- {
- base::win::ScopedCreateDC dc2(hdc2);
- EXPECT_TRUE(IsValidDC(hdc2));
- }
- EXPECT_FALSE(IsValidDC(hdc2));
-}
-
-TEST(BaseWinScopedDC, SelectObjects) {
- HDC hdc = CreateCompatibleDC(NULL);
- ASSERT_TRUE(IsValidDC(hdc));
- HGDIOBJ bitmap = GetCurrentObject(hdc, OBJ_BITMAP);
- HGDIOBJ brush = GetCurrentObject(hdc, OBJ_BRUSH);
- HGDIOBJ pen = GetCurrentObject(hdc, OBJ_PEN);
- HGDIOBJ font = GetCurrentObject(hdc, OBJ_FONT);
-
- HBITMAP compat_bitmap = CreateCompatibleBitmap(hdc, 24, 24);
- ASSERT_TRUE(compat_bitmap != NULL);
- HBRUSH solid_brush = CreateSolidBrush(RGB(22, 33, 44));
- ASSERT_TRUE(solid_brush != NULL);
-
- {
- TestScopedDC dc2(hdc);
- dc2.SelectBitmap(compat_bitmap);
- dc2.SelectBrush(solid_brush);
- EXPECT_TRUE(bitmap != GetCurrentObject(hdc, OBJ_BITMAP));
- EXPECT_TRUE(brush != GetCurrentObject(hdc, OBJ_BRUSH));
- }
-
- EXPECT_TRUE(bitmap == GetCurrentObject(hdc, OBJ_BITMAP));
- EXPECT_TRUE(brush == GetCurrentObject(hdc, OBJ_BRUSH));
- EXPECT_TRUE(pen == GetCurrentObject(hdc, OBJ_PEN));
- EXPECT_TRUE(font == GetCurrentObject(hdc, OBJ_FONT));
-
- EXPECT_TRUE(DeleteDC(hdc));
- EXPECT_TRUE(DeleteObject(compat_bitmap));
- EXPECT_TRUE(DeleteObject(solid_brush));
-}
diff --git a/chrome/browser/aeropeek_manager.cc b/chrome/browser/aeropeek_manager.cc
index f701d74..b387364 100644
--- a/chrome/browser/aeropeek_manager.cc
+++ b/chrome/browser/aeropeek_manager.cc
@@ -211,7 +211,7 @@ void SendThumbnailCallback(
// We can delete this DIB after sending it to Windows since Windows creates
// a copy of the DIB and use it.
base::win::ScopedCreateDC hdc(CreateCompatibleDC(NULL));
- if (!hdc.get()) {
+ if (!hdc.Get()) {
LOG(ERROR) << "cannot create a memory DC: " << GetLastError();
return;
}
@@ -222,7 +222,7 @@ void SendThumbnailCallback(
void* bitmap_data = NULL;
base::win::ScopedBitmap bitmap(
- CreateDIBSection(hdc.get(), reinterpret_cast<BITMAPINFO*>(&header),
+ CreateDIBSection(hdc, reinterpret_cast<BITMAPINFO*>(&header),
DIB_RGB_COLORS, &bitmap_data, NULL, 0));
if (!bitmap.Get() || !bitmap_data) {
@@ -274,7 +274,7 @@ void SendLivePreviewCallback(
// We don't need to paste this tab image onto the frame image since Windows
// automatically pastes it for us.
base::win::ScopedCreateDC hdc(CreateCompatibleDC(NULL));
- if (!hdc.get()) {
+ if (!hdc.Get()) {
LOG(ERROR) << "cannot create a memory DC: " << GetLastError();
return;
}
@@ -285,7 +285,7 @@ void SendLivePreviewCallback(
void* bitmap_data = NULL;
base::win::ScopedBitmap bitmap(
- CreateDIBSection(hdc.get(), reinterpret_cast<BITMAPINFO*>(&header),
+ CreateDIBSection(hdc.Get(), reinterpret_cast<BITMAPINFO*>(&header),
DIB_RGB_COLORS, &bitmap_data, NULL, 0));
if (!bitmap.Get() || !bitmap_data) {
LOG(ERROR) << "cannot create a bitmap: " << GetLastError();
diff --git a/chrome/browser/ui/window_snapshot/window_snapshot_win.cc b/chrome/browser/ui/window_snapshot/window_snapshot_win.cc
index d38ed5c..f3c5269 100644
--- a/chrome/browser/ui/window_snapshot/window_snapshot_win.cc
+++ b/chrome/browser/ui/window_snapshot/window_snapshot_win.cc
@@ -43,29 +43,36 @@ bool GrabWindowSnapshot(gfx::NativeWindow window_handle,
&hdr);
unsigned char *bit_ptr = NULL;
base::win::ScopedBitmap bitmap(
- CreateDIBSection(mem_hdc.get(),
+ CreateDIBSection(mem_hdc,
reinterpret_cast<BITMAPINFO*>(&hdr),
DIB_RGB_COLORS,
reinterpret_cast<void **>(&bit_ptr),
NULL, 0));
- base::win::ScopedSelectObject select_bitmap(mem_hdc.get(), bitmap);
+ base::win::ScopedSelectObject select_bitmap(mem_hdc, bitmap);
// Clear the bitmap to white (so that rounded corners on windows
// show up on a white background, and strangely-shaped windows
// look reasonable). Not capturing an alpha mask saves a
// bit of space.
- PatBlt(mem_hdc.get(), 0, 0, snapshot_bounds.width(), snapshot_bounds.height(),
+ PatBlt(mem_hdc, 0, 0, snapshot_bounds.width(), snapshot_bounds.height(),
WHITENESS);
-
- if (snapshot_bounds.origin() != gfx::Point()) {
- BitBlt(mem_hdc.get(),
- 0, 0, snapshot_bounds.width(), snapshot_bounds.height(),
- window_hdc,
- snapshot_bounds.x(), snapshot_bounds.y(),
- SRCCOPY);
- } else if (!PrintWindow(window_handle, mem_hdc.get(), 0)) {
- NOTREACHED();
- }
+ // Grab a copy of the window
+ // First, see if PrintWindow is defined (it's not in Windows 2000).
+ typedef BOOL (WINAPI *PrintWindowPointer)(HWND, HDC, UINT);
+ PrintWindowPointer print_window =
+ reinterpret_cast<PrintWindowPointer>(
+ GetProcAddress(GetModuleHandle(L"User32.dll"), "PrintWindow"));
+
+ // If PrintWindow is defined, use it. It will work on partially
+ // obscured windows, and works better for out of process sub-windows.
+ // Otherwise grab the bits we can get with BitBlt; it's better
+ // than nothing and will work fine in the average case (window is
+ // completely on screen).
+ if (snapshot_bounds.origin() == gfx::Point() && print_window)
+ (*print_window)(window_handle, mem_hdc, 0);
+ else
+ BitBlt(mem_hdc, 0, 0, snapshot_bounds.width(), snapshot_bounds.height(),
+ window_hdc, snapshot_bounds.x(), snapshot_bounds.y(), SRCCOPY);
// We now have a copy of the window contents in a DIB, so
// encode it into a useful format for posting to the bug report
diff --git a/chrome/renderer/print_web_view_helper_win.cc b/chrome/renderer/print_web_view_helper_win.cc
index 1cac932..3ed93fd 100644
--- a/chrome/renderer/print_web_view_helper_win.cc
+++ b/chrome/renderer/print_web_view_helper_win.cc
@@ -279,23 +279,23 @@ Metafile* PrintWebViewHelper::RenderPage(
// Page used alpha blend, but printer doesn't support it. Rewrite the
// metafile and flatten out the transparency.
base::win::ScopedGetDC screen_dc(NULL);
- base::win::ScopedCreateDC bitmap_dc(CreateCompatibleDC(screen_dc.get()));
- if (!bitmap_dc.get())
+ base::win::ScopedCreateDC bitmap_dc(CreateCompatibleDC(screen_dc));
+ if (!bitmap_dc)
NOTREACHED() << "Bitmap DC creation failed";
- SetGraphicsMode(bitmap_dc.get(), GM_ADVANCED);
+ SetGraphicsMode(bitmap_dc, GM_ADVANCED);
void* bits = NULL;
BITMAPINFO hdr;
gfx::CreateBitmapHeader(page_size.width(), page_size.height(),
&hdr.bmiHeader);
base::win::ScopedBitmap hbitmap(CreateDIBSection(
- bitmap_dc.get(), &hdr, DIB_RGB_COLORS, &bits, NULL, 0));
+ bitmap_dc, &hdr, DIB_RGB_COLORS, &bits, NULL, 0));
if (!hbitmap)
NOTREACHED() << "Raster bitmap creation for printing failed";
- base::win::ScopedSelectObject selectBitmap(bitmap_dc.get(), hbitmap);
+ base::win::ScopedSelectObject selectBitmap(bitmap_dc, hbitmap);
RECT rect = { 0, 0, page_size.width(), page_size.height() };
HBRUSH whiteBrush = static_cast<HBRUSH>(GetStockObject(WHITE_BRUSH));
- FillRect(bitmap_dc.get(), &rect, whiteBrush);
+ FillRect(bitmap_dc, &rect, whiteBrush);
Metafile* metafile2(new printing::NativeMetafile);
metafile2->Init();
diff --git a/chrome/service/cloud_print/print_system_win.cc b/chrome/service/cloud_print/print_system_win.cc
index 7ab5b21..d9d7dbf 100644
--- a/chrome/service/cloud_print/print_system_win.cc
+++ b/chrome/service/cloud_print/print_system_win.cc
@@ -406,10 +406,10 @@ class PrintSystemWin : public PrintSystem {
HDC dc = CreateDC(L"WINSPOOL", UTF8ToWide(printer_name).c_str(),
NULL, pt_dev_mode.dm_);
- if (!dc)
+ if (!dc) {
+ NOTREACHED();
return false;
-
- printer_dc_.Set(dc);
+ }
hr = E_FAIL;
DOCINFO di = {0};
di.cbSize = sizeof(DOCINFO);
@@ -419,7 +419,8 @@ class PrintSystemWin : public PrintSystem {
if (job_id_ <= 0)
return false;
- saved_dc_ = SaveDC(printer_dc_.get());
+ printer_dc_.Set(dc);
+ saved_dc_ = SaveDC(printer_dc_.Get());
print_data_file_path_ = print_data_file_path;
delegate_ = delegate;
RenderNextPDFPages();
@@ -439,18 +440,18 @@ class PrintSystemWin : public PrintSystem {
}
void PreparePageDCForPrinting(HDC, double scale_factor) {
- SetGraphicsMode(printer_dc_.get(), GM_ADVANCED);
+ SetGraphicsMode(printer_dc_.Get(), GM_ADVANCED);
// Setup the matrix to translate and scale to the right place. Take in
// account the scale factor.
// Note that the printing output is relative to printable area of
// the page. That is 0,0 is offset by PHYSICALOFFSETX/Y from the page.
- int offset_x = ::GetDeviceCaps(printer_dc_.get(), PHYSICALOFFSETX);
- int offset_y = ::GetDeviceCaps(printer_dc_.get(), PHYSICALOFFSETY);
+ int offset_x = ::GetDeviceCaps(printer_dc_.Get(), PHYSICALOFFSETX);
+ int offset_y = ::GetDeviceCaps(printer_dc_.Get(), PHYSICALOFFSETY);
XFORM xform = {0};
xform.eDx = static_cast<float>(-offset_x);
xform.eDy = static_cast<float>(-offset_y);
xform.eM11 = xform.eM22 = 1.0 / scale_factor;
- SetWorldTransform(printer_dc_.get(), &xform);
+ SetWorldTransform(printer_dc_.Get(), &xform);
}
// ServiceUtilityProcessHost::Client implementation.
@@ -458,8 +459,8 @@ class PrintSystemWin : public PrintSystem {
const printing::Emf& metafile,
int highest_rendered_page_number,
double scale_factor) OVERRIDE {
- PreparePageDCForPrinting(printer_dc_.get(), scale_factor);
- metafile.SafePlayback(printer_dc_.get());
+ PreparePageDCForPrinting(printer_dc_.Get(), scale_factor);
+ metafile.SafePlayback(printer_dc_.Get());
bool done_printing = (highest_rendered_page_number !=
last_page_printed_ + kPageCountPerBatch);
last_page_printed_ = highest_rendered_page_number;
@@ -513,8 +514,8 @@ class PrintSystemWin : public PrintSystem {
// If there is no delegate, then there is nothing pending to process.
if (!delegate_)
return;
- RestoreDC(printer_dc_.get(), saved_dc_);
- EndDoc(printer_dc_.get());
+ RestoreDC(printer_dc_.Get(), saved_dc_);
+ EndDoc(printer_dc_.Get());
if (-1 == last_page_printed_) {
delegate_->OnJobSpoolFailed();
} else {
@@ -531,9 +532,9 @@ class PrintSystemWin : public PrintSystem {
std::vector<printing::PageRange> page_ranges;
page_ranges.push_back(range);
- int printer_dpi = ::GetDeviceCaps(printer_dc_.get(), LOGPIXELSX);
- int dc_width = GetDeviceCaps(printer_dc_.get(), PHYSICALWIDTH);
- int dc_height = GetDeviceCaps(printer_dc_.get(), PHYSICALHEIGHT);
+ int printer_dpi = ::GetDeviceCaps(printer_dc_.Get(), LOGPIXELSX);
+ int dc_width = GetDeviceCaps(printer_dc_.Get(), PHYSICALWIDTH);
+ int dc_height = GetDeviceCaps(printer_dc_.Get(), PHYSICALHEIGHT);
gfx::Rect render_area(0, 0, dc_width, dc_height);
g_service_process->io_thread()->message_loop_proxy()->PostTask(
FROM_HERE,
diff --git a/printing/emf_win_unittest.cc b/printing/emf_win_unittest.cc
index 5ed83d1..add23f9 100644
--- a/printing/emf_win_unittest.cc
+++ b/printing/emf_win_unittest.cc
@@ -127,7 +127,7 @@ TEST_F(EmfPrintingTest, Enumerate) {
TEST_F(EmfPrintingTest, PageBreak) {
base::win::ScopedCreateDC dc(
CreateDC(L"WINSPOOL", L"UnitTest Printer", NULL, NULL));
- if (!dc.get())
+ if (!dc.Get())
return;
uint32 size;
std::vector<BYTE> data;
@@ -153,11 +153,11 @@ TEST_F(EmfPrintingTest, PageBreak) {
DOCINFO di = {0};
di.cbSize = sizeof(DOCINFO);
di.lpszDocName = L"Test Job";
- int job_id = ::StartDoc(dc.get(), &di);
+ int job_id = ::StartDoc(dc.Get(), &di);
Emf emf;
EXPECT_TRUE(emf.InitFromData(&data.front(), size));
- EXPECT_TRUE(emf.SafePlayback(dc.get()));
- ::EndDoc(dc.get());
+ EXPECT_TRUE(emf.SafePlayback(dc.Get()));
+ ::EndDoc(dc.Get());
// Since presumably the printer is not real, let us just delete the job from
// the queue.
HANDLE printer = NULL;
diff --git a/remoting/host/disconnect_window_win.cc b/remoting/host/disconnect_window_win.cc
index 63d420f..a9f7742 100644
--- a/remoting/host/disconnect_window_win.cc
+++ b/remoting/host/disconnect_window_win.cc
@@ -214,8 +214,8 @@ static int GetControlTextWidth(HWND control) {
if (result) {
base::win::ScopedGetDC dc(control);
base::win::ScopedSelectObject font(
- dc.get(), (HFONT)SendMessage(control, WM_GETFONT, 0, 0));
- DrawText(dc.get(), text, -1, &rect, DT_CALCRECT|DT_SINGLELINE);
+ dc, (HFONT)SendMessage(control, WM_GETFONT, 0, 0));
+ DrawText(dc, text, -1, &rect, DT_CALCRECT|DT_SINGLELINE);
}
return rect.right;
}
diff --git a/ui/gfx/native_theme_win.cc b/ui/gfx/native_theme_win.cc
index bba3ad1..66a9130 100644
--- a/ui/gfx/native_theme_win.cc
+++ b/ui/gfx/native_theme_win.cc
@@ -635,18 +635,18 @@ HRESULT NativeThemeWin::PaintMenuArrow(HDC hdc,
base::win::ScopedCreateDC mem_dc(CreateCompatibleDC(hdc));
base::win::ScopedBitmap mem_bitmap(CreateCompatibleBitmap(hdc, r.width(),
r.height()));
- base::win::ScopedSelectObject select_bitmap(mem_dc.get(), mem_bitmap);
+ base::win::ScopedSelectObject select_bitmap(mem_dc, mem_bitmap);
// Copy and horizontally mirror the background from hdc into mem_dc. Use
// a negative-width source rect, starting at the rightmost pixel.
- StretchBlt(mem_dc.get(), 0, 0, r.width(), r.height(),
+ StretchBlt(mem_dc, 0, 0, r.width(), r.height(),
hdc, r.right()-1, r.y(), -r.width(), r.height(), SRCCOPY);
// Draw the arrow.
RECT theme_rect = {0, 0, r.width(), r.height()};
- HRESULT result = draw_theme_(handle, mem_dc.get(), MENU_POPUPSUBMENU,
+ HRESULT result = draw_theme_(handle, mem_dc, MENU_POPUPSUBMENU,
state_id, &theme_rect, NULL);
// Copy and mirror the result back into mem_dc.
StretchBlt(hdc, r.x(), r.y(), r.width(), r.height(),
- mem_dc.get(), r.width()-1, 0, -r.width(), r.height(), SRCCOPY);
+ mem_dc, r.width()-1, 0, -r.width(), r.height(), SRCCOPY);
return result;
}
}
@@ -1668,9 +1668,9 @@ HRESULT NativeThemeWin::PaintFrameControl(HDC hdc,
return E_OUTOFMEMORY;
base::win::ScopedCreateDC bitmap_dc(CreateCompatibleDC(NULL));
- base::win::ScopedSelectObject select_bitmap(bitmap_dc.get(), mask_bitmap);
+ base::win::ScopedSelectObject select_bitmap(bitmap_dc, mask_bitmap);
RECT local_rect = { 0, 0, width, height };
- DrawFrameControl(bitmap_dc.get(), &local_rect, type, state);
+ DrawFrameControl(bitmap_dc, &local_rect, type, state);
// We're going to use BitBlt with a b&w mask. This results in using the dest
// dc's text color for the black bits in the mask, and the dest dc's
@@ -1699,11 +1699,7 @@ HRESULT NativeThemeWin::PaintFrameControl(HDC hdc,
}
COLORREF old_bg_color = SetBkColor(hdc, GetSysColor(bg_color_key));
COLORREF old_text_color = SetTextColor(hdc, GetSysColor(text_color_key));
- BitBlt(hdc,
- rect.x(), rect.y(), width, height,
- bitmap_dc.get(),
- 0, 0,
- SRCCOPY);
+ BitBlt(hdc, rect.x(), rect.y(), width, height, bitmap_dc, 0, 0, SRCCOPY);
SetBkColor(hdc, old_bg_color);
SetTextColor(hdc, old_text_color);