mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
This is an optimization to avoid painting backgrounds that are obscured. It's a lot of complexity that it's not clear we'll need given that we're using a GL backend. Also, we can add it back in more easily/efficiently in the future once we have a display list architecture. This also means we can remove the needsPaintInvalidation dirty bit and some opacity information on filters. R=esprehn@chromium.org Review URL: https://codereview.chromium.org/856563006
66 lines
2.1 KiB
C++
66 lines
2.1 KiB
C++
// Copyright 2014 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.
|
|
|
|
#ifndef SKY_ENGINE_CORE_RENDERING_STYLE_STYLEDIFFERENCE_H_
|
|
#define SKY_ENGINE_CORE_RENDERING_STYLE_STYLEDIFFERENCE_H_
|
|
|
|
#include "sky/engine/wtf/Assertions.h"
|
|
|
|
namespace blink {
|
|
|
|
class StyleDifference {
|
|
public:
|
|
enum PropertyDifference {
|
|
TransformChanged = 1 << 0,
|
|
OpacityChanged = 1 << 1,
|
|
ZIndexChanged = 1 << 2,
|
|
FilterChanged = 1 << 3,
|
|
};
|
|
|
|
StyleDifference()
|
|
: m_layoutType(NoLayout)
|
|
, m_propertySpecificDifferences(0)
|
|
{ }
|
|
|
|
bool needsLayout() const { return m_layoutType != NoLayout; }
|
|
void clearNeedsLayout() { m_layoutType = NoLayout; }
|
|
|
|
// The offset of this positioned object has been updated.
|
|
bool needsPositionedMovementLayout() const { return m_layoutType == PositionedMovement; }
|
|
void setNeedsPositionedMovementLayout()
|
|
{
|
|
ASSERT(!needsFullLayout());
|
|
m_layoutType = PositionedMovement;
|
|
}
|
|
|
|
bool needsFullLayout() const { return m_layoutType == FullLayout; }
|
|
void setNeedsFullLayout() { m_layoutType = FullLayout; }
|
|
|
|
bool transformChanged() const { return m_propertySpecificDifferences & TransformChanged; }
|
|
void setTransformChanged() { m_propertySpecificDifferences |= TransformChanged; }
|
|
|
|
bool opacityChanged() const { return m_propertySpecificDifferences & OpacityChanged; }
|
|
void setOpacityChanged() { m_propertySpecificDifferences |= OpacityChanged; }
|
|
|
|
bool zIndexChanged() const { return m_propertySpecificDifferences & ZIndexChanged; }
|
|
void setZIndexChanged() { m_propertySpecificDifferences |= ZIndexChanged; }
|
|
|
|
bool filterChanged() const { return m_propertySpecificDifferences & FilterChanged; }
|
|
void setFilterChanged() { m_propertySpecificDifferences |= FilterChanged; }
|
|
|
|
private:
|
|
enum LayoutType {
|
|
NoLayout = 0,
|
|
PositionedMovement,
|
|
FullLayout
|
|
};
|
|
unsigned m_layoutType : 2;
|
|
|
|
unsigned m_propertySpecificDifferences : 5;
|
|
};
|
|
|
|
} // namespace blink
|
|
|
|
#endif // SKY_ENGINE_CORE_RENDERING_STYLE_STYLEDIFFERENCE_H_
|