1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef ExpensiveCanvasHeuristicParameters_h
6 #define ExpensiveCanvasHeuristicParameters_h
10 namespace ExpensiveCanvasHeuristicParameters
{
13 // Layer promotion heuristic parameters
14 //======================================
16 // FIXME (crbug.com/463239):
17 // The Layer promotion heuristics should go away after slimming paint
18 // is completely phased in and display list canvases are modified to
19 // use a lightweight layering primitive instead of the
20 // SkCanvas::saveLayer.
22 // Heuristic: Canvases that are overdrawn beyond this factor in a
23 // single frame are promoted to a direct composited layer so that
24 // their contents not be re-rasterized by the compositor when the
25 // containing layer is the object of a paint invalidation.
26 ExpensiveOverdrawThreshold
= 3,
28 ExpensivePathPointCount
= 50,
30 SVGImageSourcesAreExpensive
= 1,
32 ConcavePathsAreExpensive
= 1,
34 ComplexClipsAreExpensive
= 1,
36 BlurredShadowsAreExpensive
= 1,
38 // Heuristic: When drawing a source image that has more pixels than
39 // the destination canvas by the following factor or more, the draw
40 // is considered expensive.
41 ExpensiveImageSizeRatio
= 4,
43 // Display list fallback heuristic parameters
44 //============================================
46 // Frames ending with more than this number of levels remaining
47 // on the state stack at the end of a frame are too expensive to
48 // remain in display list mode. This criterion is motivated by an
49 // O(N) cost in carying over state from one frame to the next when
50 // in display list mode. The value of this parameter should be high
51 // enough to almost never kick in other than for cases with unmatched
52 // save()/restore() calls are low enough to kick in before state
53 // management becomes measurably expensive.
54 ExpensiveRecordingStackDepth
= 50,
56 // GPU vs. display list heuristic parameters
57 //===========================================
59 // Pixel count beyond which we should always prefer to use display
60 // lists. Rationale: The allocation of large textures for canvas
61 // tends to starve the compositor, and increase the probability of
62 // failure of subsequent allocations required for double buffering.
63 PreferDisplayListOverGpuSizeThreshold
= 4096 * 4096,
67 } // ExpensiveCanvasHeuristicParameters