| 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
|
|
|
|
|