summaryrefslogtreecommitdiffstats
path: root/base/gfx
diff options
context:
space:
mode:
Diffstat (limited to 'base/gfx')
-rw-r--r--base/gfx/bitmap_platform_device_win.cc2
-rw-r--r--base/gfx/gdi_util.cc (renamed from base/gfx/bitmap_header.cc)18
-rw-r--r--base/gfx/gdi_util.h (renamed from base/gfx/bitmap_header.h)12
-rw-r--r--base/gfx/native_theme.cc2
-rw-r--r--base/gfx/vector_canvas_unittest.cc2
-rw-r--r--base/gfx/vector_device.cc2
6 files changed, 29 insertions, 9 deletions
diff --git a/base/gfx/bitmap_platform_device_win.cc b/base/gfx/bitmap_platform_device_win.cc
index 1209db1..2031027 100644
--- a/base/gfx/bitmap_platform_device_win.cc
+++ b/base/gfx/bitmap_platform_device_win.cc
@@ -4,7 +4,7 @@
#include "base/gfx/bitmap_platform_device_win.h"
-#include "base/gfx/bitmap_header.h"
+#include "base/gfx/gdi_util.h"
#include "base/logging.h"
#include "base/process_util.h"
#include "SkMatrix.h"
diff --git a/base/gfx/bitmap_header.cc b/base/gfx/gdi_util.cc
index acaf0c0..48df853 100644
--- a/base/gfx/bitmap_header.cc
+++ b/base/gfx/gdi_util.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "base/gfx/bitmap_header.h"
+#include "base/gfx/gdi_util.h"
namespace gfx {
@@ -60,5 +60,21 @@ void CreateMonochromeBitmapHeader(int width,
hdr->biClrImportant = 0;
}
+void SubtractRectanglesFromRegion(HRGN hrgn,
+ const std::vector<gfx::Rect>& cutouts) {
+ if (cutouts.size()) {
+ HRGN cutout = ::CreateRectRgn(0, 0, 0, 0);
+ for (size_t i = 0; i < cutouts.size(); i++) {
+ ::SetRectRgn(cutout,
+ cutouts[i].x(),
+ cutouts[i].y(),
+ cutouts[i].right(),
+ cutouts[i].bottom());
+ ::CombineRgn(hrgn, hrgn, cutout, RGN_DIFF);
+ }
+ ::DeleteObject(cutout);
+ }
+}
+
} // namespace gfx
diff --git a/base/gfx/bitmap_header.h b/base/gfx/gdi_util.h
index 0c8066b..cc15e92 100644
--- a/base/gfx/bitmap_header.h
+++ b/base/gfx/gdi_util.h
@@ -2,10 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef BASE_GFX_BITMAP_HEADER_H__
-#define BASE_GFX_BITMAP_HEADER_H__
+#ifndef BASE_GFX_GDI_UTIL_H__
+#define BASE_GFX_GDI_UTIL_H__
+#include <vector>
#include <windows.h>
+#include "base/gfx/rect.h"
namespace gfx {
@@ -25,8 +27,10 @@ void CreateBitmapV4Header(int width, int height, BITMAPV4HEADER* hdr);
// Creates a monochrome bitmap header.
void CreateMonochromeBitmapHeader(int width, int height, BITMAPINFOHEADER* hdr);
+// Modify the given hrgn by subtracting the given rectangles.
+void SubtractRectanglesFromRegion(HRGN hrgn,
+ const std::vector<gfx::Rect>& cutouts);
} // namespace gfx
-#endif // BASE_GFX_BITMAP_HEADER_H__
-
+#endif // BASE_GFX_GDI_UTIL_H__
diff --git a/base/gfx/native_theme.cc b/base/gfx/native_theme.cc
index ea55502..b8aa30c 100644
--- a/base/gfx/native_theme.cc
+++ b/base/gfx/native_theme.cc
@@ -9,7 +9,7 @@
#include <vsstyle.h>
#include <vssym32.h>
-#include "base/gfx/bitmap_header.h"
+#include "base/gfx/gdi_util.h"
#include "base/gfx/platform_canvas_win.h"
#include "base/gfx/skia_utils.h"
#include "base/gfx/rect.h"
diff --git a/base/gfx/vector_canvas_unittest.cc b/base/gfx/vector_canvas_unittest.cc
index 65d3d5f..60a79ba 100644
--- a/base/gfx/vector_canvas_unittest.cc
+++ b/base/gfx/vector_canvas_unittest.cc
@@ -8,7 +8,7 @@
#include "base/command_line.h"
#include "base/file_util.h"
-#include "base/gfx/bitmap_header.h"
+#include "base/gfx/gdi_util.h"
#include "base/gfx/png_decoder.h"
#include "base/gfx/png_encoder.h"
#include "base/gfx/size.h"
diff --git a/base/gfx/vector_device.cc b/base/gfx/vector_device.cc
index 8778299..7230e2b 100644
--- a/base/gfx/vector_device.cc
+++ b/base/gfx/vector_device.cc
@@ -4,7 +4,7 @@
#include "base/gfx/vector_device.h"
-#include "base/gfx/bitmap_header.h"
+#include "base/gfx/gdi_util.h"
#include "base/gfx/skia_utils.h"
#include "base/logging.h"
#include "base/scoped_handle.h"