diff options
author | deanm@chromium.org <deanm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-11 18:05:07 +0000 |
---|---|---|
committer | deanm@chromium.org <deanm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-11 18:05:07 +0000 |
commit | 9bae4b9a123cda92bc3bd0da16784d9ec75d1494 (patch) | |
tree | 3b45d3f8c1be8d4647cec0840e33e1081d4cd3bd /base/gfx/gtk_util.cc | |
parent | e232e00e73a93453328cf8634001df93860d8d1e (diff) | |
download | chromium_src-9bae4b9a123cda92bc3bd0da16784d9ec75d1494.zip chromium_src-9bae4b9a123cda92bc3bd0da16784d9ec75d1494.tar.gz chromium_src-9bae4b9a123cda92bc3bd0da16784d9ec75d1494.tar.bz2 |
Add a gtk_utils (like gdi_utils), with region rectangle subtraction.
This will be used like the gdi functions, for constructing clipping regions.
Add ToGdkRectangle() on gfx::Rect, similar to the win32 and CG methods.
Make the scons file better reflect which files are platform specific.
Review URL: http://codereview.chromium.org/20259
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@9574 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/gfx/gtk_util.cc')
-rwxr-xr-x | base/gfx/gtk_util.cc | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/base/gfx/gtk_util.cc b/base/gfx/gtk_util.cc new file mode 100755 index 0000000..26601ca --- /dev/null +++ b/base/gfx/gtk_util.cc @@ -0,0 +1,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 |