| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "chrome/test/activex_test_control/chrome_test_control.h" | |
| 6 | |
| 7 // CChromeTestControl | |
| 8 HRESULT ChromeTestControl::OnDraw(ATL_DRAWINFO& di) { | |
| 9 RECT& rc = *(RECT*)di.prcBounds; | |
| 10 // Set Clip region to the rectangle specified by di.prcBounds | |
| 11 HRGN rgn_old = NULL; | |
| 12 if (GetClipRgn(di.hdcDraw, rgn_old) != 1) | |
| 13 rgn_old = NULL; | |
| 14 bool select_old_rgn = false; | |
| 15 | |
| 16 HRGN rgn_new = CreateRectRgn(rc.left, rc.top, rc.right, rc.bottom); | |
| 17 | |
| 18 if (rgn_new != NULL) | |
| 19 select_old_rgn = (SelectClipRgn(di.hdcDraw, rgn_new) != ERROR); | |
| 20 | |
| 21 Rectangle(di.hdcDraw, rc.left, rc.top, rc.right, rc.bottom); | |
| 22 SetTextAlign(di.hdcDraw, TA_CENTER|TA_BASELINE); | |
| 23 LPCTSTR pszText = _T("ATL 8.0 : ChromeTestControl"); | |
| 24 TextOut(di.hdcDraw, | |
| 25 (rc.left + rc.right) / 2, | |
| 26 (rc.top + rc.bottom) / 2, | |
| 27 pszText, | |
| 28 lstrlen(pszText)); | |
| 29 | |
| 30 if (select_old_rgn) | |
| 31 SelectClipRgn(di.hdcDraw, rgn_old); | |
| 32 | |
| 33 return S_OK; | |
| 34 } | |
| OLD | NEW |