@@ -164,14 +164,6 @@ static inline bool getDeviceClipAsRect(const PlatformContextSkia* context, SkRec
164
164
return true ;
165
165
}
166
166
167
- static inline SkRect& currentTrackingOpaqueRect (SkRect& rootOpaqueRect, Vector<OpaqueRegionSkia::CanvasLayerState, 3 >& canvasLayerStack)
168
- {
169
- // If we are drawing into a canvas layer, then track the opaque rect in that layer.
170
- if (!canvasLayerStack.isEmpty ())
171
- return canvasLayerStack.last ().opaqueRect ;
172
- return rootOpaqueRect;
173
- }
174
-
175
167
void OpaqueRegionSkia::pushCanvasLayer (const SkPaint* paint)
176
168
{
177
169
CanvasLayerState state;
@@ -333,7 +325,7 @@ void OpaqueRegionSkia::applyOpaqueRegionFromLayer(const PlatformContextSkia* con
333
325
334
326
SkRect sourceOpaqueRect = layerOpaqueRect;
335
327
// Save the opaque area in the destination, so we can preserve the parts of it under the source opaque area if possible.
336
- SkRect destinationOpaqueRect = currentTrackingOpaqueRect (m_opaqueRect, m_canvasLayerStack );
328
+ SkRect destinationOpaqueRect = currentTrackingOpaqueRect ();
337
329
338
330
bool outsideSourceOpaqueRectPreservesOpaque = xfermodePreservesOpaque (paint, false );
339
331
if (!outsideSourceOpaqueRectPreservesOpaque)
@@ -363,7 +355,7 @@ void OpaqueRegionSkia::markRectAsOpaque(const SkRect& rect)
363
355
// rectangle then we do that, as that is the cheapest way to increase the area returned
364
356
// without increasing the complexity.
365
357
366
- SkRect& opaqueRect = currentTrackingOpaqueRect (m_opaqueRect, m_canvasLayerStack );
358
+ SkRect& opaqueRect = currentTrackingOpaqueRect ();
367
359
368
360
if (rect.isEmpty ())
369
361
return ;
@@ -397,7 +389,7 @@ void OpaqueRegionSkia::markRectAsNonOpaque(const SkRect& rect)
397
389
// We want to keep as much of the current opaque rectangle as we can, so find the one largest
398
390
// rectangle inside m_opaqueRect that does not intersect with |rect|.
399
391
400
- SkRect& opaqueRect = currentTrackingOpaqueRect (m_opaqueRect, m_canvasLayerStack );
392
+ SkRect& opaqueRect = currentTrackingOpaqueRect ();
401
393
402
394
if (!SkRect::Intersects (rect, opaqueRect))
403
395
return ;
@@ -432,8 +424,14 @@ void OpaqueRegionSkia::markRectAsNonOpaque(const SkRect& rect)
432
424
433
425
void OpaqueRegionSkia::markAllAsNonOpaque ()
434
426
{
435
- SkRect& opaqueRect = currentTrackingOpaqueRect (m_opaqueRect, m_canvasLayerStack );
427
+ SkRect& opaqueRect = currentTrackingOpaqueRect ();
436
428
opaqueRect.setEmpty ();
437
429
}
438
430
431
+ SkRect& OpaqueRegionSkia::currentTrackingOpaqueRect ()
432
+ {
433
+ // If we are drawing into a canvas layer, then track the opaque rect in that layer.
434
+ return m_canvasLayerStack.isEmpty () ? m_opaqueRect : m_canvasLayerStack.last ().opaqueRect ;
435
+ }
436
+
439
437
} // namespace WebCore
0 commit comments