| Index: ui/gfx/gdi_util.cc
|
| diff --git a/ui/gfx/gdi_util.cc b/ui/gfx/gdi_util.cc
|
| index 13f141ae8028eb619541353e08b16f82e8ec9d55..88c09355a28fc8de7a600eaba6a3137c94e57b80 100644
|
| --- a/ui/gfx/gdi_util.cc
|
| +++ b/ui/gfx/gdi_util.cc
|
| @@ -4,6 +4,7 @@
|
|
|
| #include "ui/gfx/gdi_util.h"
|
|
|
| +#include "base/logging.h"
|
| #include "base/memory/scoped_ptr.h"
|
|
|
| namespace gfx {
|
| @@ -28,7 +29,6 @@ void CreateBitmapHeaderWithColorDepth(int width, int height, int color_depth,
|
| hdr->biClrImportant = 0;
|
| }
|
|
|
| -
|
| void CreateBitmapV4Header(int width, int height, BITMAPV4HEADER* hdr) {
|
| // Because bmp v4 header is just an extension, we just create a v3 header and
|
| // copy the bits over to the v4 header.
|
| @@ -119,4 +119,27 @@ bool ScaleDC(HDC dc, double scale_factor) {
|
| return !!ModifyWorldTransform(dc, &xform, MWT_LEFTMULTIPLY);
|
| }
|
|
|
| +void StretchDIBits(HDC hdc, int dest_x, int dest_y, int dest_w, int dest_h,
|
| + int src_x, int src_y, int src_w, int src_h, void* pixels,
|
| + const BITMAPINFO* bitmap_info) {
|
| + // When blitting a rectangle that touches the bottom, left corner of the
|
| + // bitmap, StretchDIBits looks at it top-down! For more details, see
|
| + // http://wiki.allegro.cc/index.php?title=StretchDIBits.
|
| + int rv;
|
| + int bitmap_h = -bitmap_info->bmiHeader.biHeight;
|
| + int bottom_up_src_y = bitmap_h - src_y - src_h;
|
| + if (bottom_up_src_y == 0 && src_x == 0 && src_h != bitmap_h) {
|
| + rv = ::StretchDIBits(hdc,
|
| + dest_x, dest_h + dest_y - 1, dest_w, -dest_h,
|
| + src_x, bitmap_h - src_y + 1, src_w, -src_h,
|
| + pixels, bitmap_info, DIB_RGB_COLORS, SRCCOPY);
|
| + } else {
|
| + rv = ::StretchDIBits(hdc,
|
| + dest_x, dest_y, dest_w, dest_h,
|
| + src_x, bottom_up_src_y, src_w, src_h,
|
| + pixels, bitmap_info, DIB_RGB_COLORS, SRCCOPY);
|
| + }
|
| + DCHECK(rv != GDI_ERROR);
|
| +}
|
| +
|
| } // namespace gfx
|
|
|