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/bitmap_header.h" | 5 #include "base/gfx/gdi_util.h" |
6 | 6 |
7 namespace gfx { | 7 namespace gfx { |
8 | 8 |
9 void CreateBitmapHeader(int width, int height, BITMAPINFOHEADER* hdr) { | 9 void CreateBitmapHeader(int width, int height, BITMAPINFOHEADER* hdr) { |
10 CreateBitmapHeaderWithColorDepth(width, height, 32, hdr); | 10 CreateBitmapHeaderWithColorDepth(width, height, 32, hdr); |
11 } | 11 } |
12 | 12 |
13 void CreateBitmapHeaderWithColorDepth(int width, int height, int color_depth, | 13 void CreateBitmapHeaderWithColorDepth(int width, int height, int color_depth, |
14 BITMAPINFOHEADER* hdr) { | 14 BITMAPINFOHEADER* hdr) { |
15 // These values are shared with gfx::PlatformDevice | 15 // These values are shared with gfx::PlatformDevice |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 hdr->biPlanes = 1; | 53 hdr->biPlanes = 1; |
54 hdr->biBitCount = 1; | 54 hdr->biBitCount = 1; |
55 hdr->biCompression = BI_RGB; | 55 hdr->biCompression = BI_RGB; |
56 hdr->biSizeImage = 0; | 56 hdr->biSizeImage = 0; |
57 hdr->biXPelsPerMeter = 1; | 57 hdr->biXPelsPerMeter = 1; |
58 hdr->biYPelsPerMeter = 1; | 58 hdr->biYPelsPerMeter = 1; |
59 hdr->biClrUsed = 0; | 59 hdr->biClrUsed = 0; |
60 hdr->biClrImportant = 0; | 60 hdr->biClrImportant = 0; |
61 } | 61 } |
62 | 62 |
| 63 void SubtractRectanglesFromRegion(HRGN hrgn, |
| 64 const std::vector<gfx::Rect>& cutouts) { |
| 65 if (cutouts.size()) { |
| 66 HRGN cutout = ::CreateRectRgn(0, 0, 0, 0); |
| 67 for (size_t i = 0; i < cutouts.size(); i++) { |
| 68 ::SetRectRgn(cutout, |
| 69 cutouts[i].x(), |
| 70 cutouts[i].y(), |
| 71 cutouts[i].right(), |
| 72 cutouts[i].bottom()); |
| 73 ::CombineRgn(hrgn, hrgn, cutout, RGN_DIFF); |
| 74 } |
| 75 ::DeleteObject(cutout); |
| 76 } |
| 77 } |
| 78 |
63 } // namespace gfx | 79 } // namespace gfx |
64 | 80 |
OLD | NEW |