@@ -21,9 +21,9 @@ static inline bool has_perspective(const SkM44& matrix) {
21
21
22
22
LayerStateStack::LayerStateStack (const SkRect* cull_rect) {
23
23
if (cull_rect) {
24
- cull_rect_ = *cull_rect;
24
+ initial_cull_rect_ = cull_rect_ = *cull_rect;
25
25
} else {
26
- cull_rect_ = kGiantRect ;
26
+ initial_cull_rect_ = cull_rect_ = kGiantRect ;
27
27
}
28
28
}
29
29
@@ -72,35 +72,35 @@ void LayerStateStack::set_delegate(MutatorsStack* stack) {
72
72
void LayerStateStack::set_initial_cull_rect (const SkRect& cull_rect) {
73
73
FML_CHECK (is_empty ()) << " set_initial_cull_rect() must be called before any "
74
74
" state is pushed onto the state stack" ;
75
- cull_rect_ = cull_rect;
75
+ initial_cull_rect_ = cull_rect_ = cull_rect;
76
76
}
77
77
78
78
void LayerStateStack::set_initial_transform (const SkMatrix& matrix) {
79
79
FML_CHECK (is_empty ()) << " set_initial_transform() must be called before any "
80
80
" state is pushed onto the state stack" ;
81
- matrix_ = SkM44 (matrix);
81
+ initial_matrix_ = matrix_ = SkM44 (matrix);
82
82
}
83
83
84
84
void LayerStateStack::set_initial_transform (const SkM44& matrix) {
85
85
FML_CHECK (is_empty ()) << " set_initial_transform() must be called before any "
86
86
" state is pushed onto the state stack" ;
87
- matrix_ = matrix;
87
+ initial_matrix_ = matrix_ = matrix;
88
88
}
89
89
90
90
void LayerStateStack::set_initial_state (const SkRect& cull_rect,
91
91
const SkMatrix& matrix) {
92
92
FML_CHECK (is_empty ()) << " set_initial_state() must be called before any "
93
93
" state is pushed onto the state stack" ;
94
- cull_rect_ = cull_rect;
95
- matrix_ = SkM44 (matrix);
94
+ initial_cull_rect_ = cull_rect_ = cull_rect;
95
+ initial_matrix_ = matrix_ = SkM44 (matrix);
96
96
}
97
97
98
98
void LayerStateStack::set_initial_state (const SkRect& cull_rect,
99
99
const SkM44& matrix) {
100
100
FML_CHECK (is_empty ()) << " set_initial_state() must be called before any "
101
101
" state is pushed onto the state stack" ;
102
- cull_rect_ = cull_rect;
103
- matrix_ = matrix;
102
+ initial_cull_rect_ = cull_rect_ = cull_rect;
103
+ initial_matrix_ = matrix_ = matrix;
104
104
}
105
105
106
106
void LayerStateStack::reapply_all () {
@@ -110,11 +110,17 @@ void LayerStateStack::reapply_all() {
110
110
// the stack. When we are finished, though, the local attributes
111
111
// contents should match the current outstanding_ values;
112
112
RenderingAttributes attributes = outstanding_;
113
+ SkM44 matrix = matrix_;
114
+ SkRect cull_rect = cull_rect_;
113
115
outstanding_ = {};
116
+ matrix_ = initial_matrix_;
117
+ cull_rect_ = initial_cull_rect_;
114
118
for (auto & state : state_stack_) {
115
119
state->reapply (this );
116
120
}
117
121
FML_DCHECK (attributes == outstanding_);
122
+ FML_DCHECK (matrix == matrix_);
123
+ FML_DCHECK (cull_rect == cull_rect_);
118
124
}
119
125
120
126
AutoRestore::AutoRestore (LayerStateStack* stack)
0 commit comments