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

Unified Diff: core/cross/cairo/layer.h

Issue 6255003: O2D:... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/o3d/
Patch Set: '' Created 9 years, 11 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 | core/cross/cairo/layer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/cross/cairo/layer.h
===================================================================
--- core/cross/cairo/layer.h (revision 71475)
+++ core/cross/cairo/layer.h (working copy)
@@ -50,8 +50,17 @@
public:
typedef SmartPointer<Layer> Ref;
+ enum PaintOperator {
+ BLEND,
+ BLEND_WITH_TRANSPARENCY,
+ COPY,
+ COPY_WITH_FADING,
+ };
+
virtual ~Layer();
+ // Methods exposed to JS.
+
Pattern* pattern() const {
return pattern_;
}
@@ -60,6 +69,14 @@
pattern_ = Pattern::Ref(pattern);
}
+ bool visible() const {
+ return visible_;
+ }
+
+ void set_visible(bool visible) {
+ visible_ = visible;
+ }
+
double alpha() const {
return alpha_;
}
@@ -124,6 +141,30 @@
scale_y_ = scale_y;
}
+ PaintOperator paint_operator() const {
+ return paint_operator_;
+ }
+
+ void set_paint_operator(PaintOperator paint_operator) {
+ paint_operator_ = paint_operator;
+ }
+
+ // Methods not exposed to JS.
+
+ // Whether we should currently paint this layer.
+ bool ShouldPaint() const {
+ return visible() && pattern() != NULL;
+ }
+
+ // Whether this layer should currently clip content behind it (i.e.,
+ // prevent it from being drawn in the first place).
+ bool ShouldClip() const {
+ // When alpha blending is used we cannot clip the background because our
+ // content will be blended with it.
+ return ShouldPaint() &&
+ (paint_operator() == COPY || paint_operator() == COPY_WITH_FADING);
+ }
+
private:
explicit Layer(ServiceLocator* service_locator);
@@ -133,7 +174,11 @@
// The pattern used to paint this Layer.
Pattern::Ref pattern_;
- // Transparancy of this layer.
+ // Whether this layer should be visible or not.
+ bool visible_;
+
+ // The transparency for the BLEND_WITH_TRANSPARENCY operator or the fading for
+ // the COPY_WITH_FADING operator.
double alpha_;
// The x coordinate of the top-left corner of this layer.
@@ -157,6 +202,9 @@
// A scaling factor to apply to the pattern's y-axis.
double scale_y_;
+ // The paint operator to use for painting this Layer.
+ PaintOperator paint_operator_;
+
O3D_DECL_CLASS(Layer, ObjectBase)
}; // Layer
« no previous file with comments | « no previous file | core/cross/cairo/layer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698