Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(323)

Unified Diff: skia/ext/platform_canvas_linux.h

Issue 119226: Adds ability to change compositing operator used by CanvasPaint.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: skia/ext/platform_canvas_linux.h
===================================================================
--- skia/ext/platform_canvas_linux.h (revision 17496)
+++ skia/ext/platform_canvas_linux.h (working copy)
@@ -78,14 +78,16 @@
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 @@
// 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 @@
}
}
+ // 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 @@
cairo_surface_t* surface_;
GdkWindow* window_;
GdkRectangle rectangle_;
+ // See description above setter.
+ bool composite_alpha_;
// Disallow copy and assign.
CanvasPaintT(const CanvasPaintT&);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698