blob: 26601ca70c6ba2428765cd3482f95ae8d397b27c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
// Copyright (c) 2009 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "base/gfx/gtk_util.h"
#include <gdk/gdk.h>
#include "base/gfx/rect.h"
namespace gfx {
void SubtractRectanglesFromRegion(GdkRegion* region,
const std::vector<gfx::Rect>& cutouts) {
for (size_t i = 0; i < cutouts.size(); ++i) {
GdkRectangle rect = cutouts[i].ToGdkRectangle();
GdkRegion* rect_region = gdk_region_rectangle(&rect);
gdk_region_subtract(region, rect_region);
// TODO(deanm): It would be nice to be able to reuse the GdkRegion here.
gdk_region_destroy(rect_region);
}
}
} // namespace gfx
|