| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "base/gfx/vector_device.h" | 5 #include "base/gfx/vector_device.h" |
| 6 | 6 |
| 7 #include "base/gfx/gdi_util.h" | 7 #include "base/gfx/gdi_util.h" |
| 8 #include "base/gfx/skia_utils.h" | 8 #include "base/gfx/skia_utils.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/scoped_handle.h" | 10 #include "base/scoped_handle.h" |
| (...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 576 // sure IE7 was doing so kind of bitmasking due to the way translucent image | 576 // sure IE7 was doing so kind of bitmasking due to the way translucent image |
| 577 // where renderered but after some windbg tracing, it is being done by the | 577 // where renderered but after some windbg tracing, it is being done by the |
| 578 // printer driver after all (mostly HP printers). IE7 always use AlphaBlend | 578 // printer driver after all (mostly HP printers). IE7 always use AlphaBlend |
| 579 // for bitmasked images. The trick seems to switch the stretching mode in | 579 // for bitmasked images. The trick seems to switch the stretching mode in |
| 580 // what the driver expects. | 580 // what the driver expects. |
| 581 DWORD previous_mode = GetStretchBltMode(dc); | 581 DWORD previous_mode = GetStretchBltMode(dc); |
| 582 BOOL result = SetStretchBltMode(dc, COLORONCOLOR); | 582 BOOL result = SetStretchBltMode(dc, COLORONCOLOR); |
| 583 DCHECK(result); | 583 DCHECK(result); |
| 584 // Note that this function expect premultiplied colors (!) | 584 // Note that this function expect premultiplied colors (!) |
| 585 BLENDFUNCTION blend_function = {AC_SRC_OVER, 0, alpha, AC_SRC_ALPHA}; | 585 BLENDFUNCTION blend_function = {AC_SRC_OVER, 0, alpha, AC_SRC_ALPHA}; |
| 586 result = AlphaBlend(dc, | 586 result = GdiAlphaBlend(dc, |
| 587 x, y, // Destination origin. | 587 x, y, // Destination origin. |
| 588 src_size_x, src_size_y, // Destination size. | 588 src_size_x, src_size_y, // Destination size. |
| 589 bitmap_dc, | 589 bitmap_dc, |
| 590 0, 0, // Source origin. | 590 0, 0, // Source origin. |
| 591 src_size_x, src_size_y, // Source size. | 591 src_size_x, src_size_y, // Source size. |
| 592 blend_function); | 592 blend_function); |
| 593 DCHECK(result); | 593 DCHECK(result); |
| 594 result = SetStretchBltMode(dc, previous_mode); | 594 result = SetStretchBltMode(dc, previous_mode); |
| 595 DCHECK(result); | 595 DCHECK(result); |
| 596 } else { | 596 } else { |
| 597 BOOL result = StretchDIBits(dc, | 597 BOOL result = StretchDIBits(dc, |
| 598 x, y, // Destination origin. | 598 x, y, // Destination origin. |
| 599 src_size_x, src_size_y, | 599 src_size_x, src_size_y, |
| 600 0, 0, // Source origin. | 600 0, 0, // Source origin. |
| 601 src_size_x, src_size_y, // Source size. | 601 src_size_x, src_size_y, // Source size. |
| 602 pixels, | 602 pixels, |
| 603 reinterpret_cast<const BITMAPINFO*>(&hdr), | 603 reinterpret_cast<const BITMAPINFO*>(&hdr), |
| 604 DIB_RGB_COLORS, | 604 DIB_RGB_COLORS, |
| 605 SRCCOPY); | 605 SRCCOPY); |
| 606 DCHECK(result); | 606 DCHECK(result); |
| 607 } | 607 } |
| 608 Cleanup(); | 608 Cleanup(); |
| 609 } | 609 } |
| 610 | 610 |
| 611 } // namespace gfx | 611 } // namespace gfx |
| 612 | 612 |
| OLD | NEW |