summaryrefslogtreecommitdiffstats
path: root/skia
diff options
context:
space:
mode:
authorsky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-05 18:23:47 +0000
committersky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-05 18:23:47 +0000
commitf9526c75bd7c6febdfc99e98bb6355c9b4aa1500 (patch)
tree390340f3c75a036b4fd159b51856681064d07017 /skia
parent9dd9e83865f58d2c886f6be38575bdffc66fb074 (diff)
downloadchromium_src-f9526c75bd7c6febdfc99e98bb6355c9b4aa1500.zip
chromium_src-f9526c75bd7c6febdfc99e98bb6355c9b4aa1500.tar.gz
chromium_src-f9526c75bd7c6febdfc99e98bb6355c9b4aa1500.tar.bz2
Adds ability to change compositing operator used by CanvasPaint.
BUG=none TEST=none Review URL: http://codereview.chromium.org/119226 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@17744 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'skia')
-rw-r--r--skia/ext/platform_canvas_linux.h17
1 files changed, 15 insertions, 2 deletions
diff --git a/skia/ext/platform_canvas_linux.h b/skia/ext/platform_canvas_linux.h
index 1f237d7..47e8162 100644
--- a/skia/ext/platform_canvas_linux.h
+++ b/skia/ext/platform_canvas_linux.h
@@ -78,14 +78,16 @@ class CanvasPaintT : public T {
explicit CanvasPaintT(GdkEventExpose* event)
: surface_(NULL),
window_(event->window),
- rectangle_(event->area) {
+ rectangle_(event->area),
+ composite_alpha_(false) {
init(true);
}
CanvasPaintT(GdkEventExpose* event, bool opaque)
: surface_(NULL),
window_(event->window),
- rectangle_(event->area) {
+ rectangle_(event->area),
+ composite_alpha_(false) {
init(opaque);
}
@@ -95,6 +97,8 @@ class CanvasPaintT : public T {
// Blit the dirty rect to the window.
cairo_t* cr = gdk_cairo_create(window_);
+ if (composite_alpha_)
+ cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE);
cairo_set_source_surface(cr, surface_, rectangle_.x, rectangle_.y);
cairo_rectangle(cr, rectangle_.x, rectangle_.y,
rectangle_.width, rectangle_.height);
@@ -103,6 +107,13 @@ class CanvasPaintT : public T {
}
}
+ // Sets whether the bitmap is composited in such a way that the alpha channel
+ // is honored. This is only useful if you've enabled an RGBA colormap on the
+ // widget. The default is false.
+ void set_composite_alpha(bool composite_alpha) {
+ composite_alpha_ = composite_alpha;
+ }
+
// Returns true if the invalid region is empty. The caller should call this
// function to determine if anything needs painting.
bool isEmpty() const {
@@ -130,6 +141,8 @@ class CanvasPaintT : public T {
cairo_surface_t* surface_;
GdkWindow* window_;
GdkRectangle rectangle_;
+ // See description above setter.
+ bool composite_alpha_;
// Disallow copy and assign.
CanvasPaintT(const CanvasPaintT&);