| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc.
All rights reserved. | 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc.
All rights reserved. |
| 3 * Copyright (C) 2008, 2010 Nokia Corporation and/or its subsidiary(-ies) | 3 * Copyright (C) 2008, 2010 Nokia Corporation and/or its subsidiary(-ies) |
| 4 * Copyright (C) 2007 Alp Toker <alp@atoker.com> | 4 * Copyright (C) 2007 Alp Toker <alp@atoker.com> |
| 5 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> | 5 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> |
| 6 * Copyright (C) 2008 Dirk Schulze <krit@webkit.org> | 6 * Copyright (C) 2008 Dirk Schulze <krit@webkit.org> |
| 7 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved. | 7 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved. |
| 8 * Copyright (C) 2012, 2013 Intel Corporation. All rights reserved. | 8 * Copyright (C) 2012, 2013 Intel Corporation. All rights reserved. |
| 9 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. | 9 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. |
| 10 * | 10 * |
| (...skipping 1050 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1061 } | 1061 } |
| 1062 | 1062 |
| 1063 unsigned CanvasRenderingContext2D::hitRegionsCount() const | 1063 unsigned CanvasRenderingContext2D::hitRegionsCount() const |
| 1064 { | 1064 { |
| 1065 if (m_hitRegionManager) | 1065 if (m_hitRegionManager) |
| 1066 return m_hitRegionManager->getHitRegionsCount(); | 1066 return m_hitRegionManager->getHitRegionsCount(); |
| 1067 | 1067 |
| 1068 return 0; | 1068 return 0; |
| 1069 } | 1069 } |
| 1070 | 1070 |
| 1071 bool CanvasRenderingContext2D::isAccelerationOptimalForCanvasContent() const |
| 1072 { |
| 1073 // Simple heuristic to determine if the GPU accelerated pipeline should be |
| 1074 // used to maximize performance of 2D canvas based on past usage. |
| 1075 |
| 1076 int numDrawPathCalls = |
| 1077 m_usageCounters.numDrawCalls[StrokePath] + |
| 1078 m_usageCounters.numDrawCalls[FillPath] + |
| 1079 m_usageCounters.numDrawCalls[FillText] + |
| 1080 m_usageCounters.numDrawCalls[StrokeText] + |
| 1081 m_usageCounters.numDrawCalls[FillRect] + |
| 1082 m_usageCounters.numDrawCalls[StrokeRect]; |
| 1083 |
| 1084 double acceleratedCost = |
| 1085 numDrawPathCalls * ExpensiveCanvasHeuristicParameters::AcceleratedDrawPa
thApproximateCost + |
| 1086 m_usageCounters.numGetImageDataCalls * ExpensiveCanvasHeuristicParameter
s::AcceleratedGetImageDataApproximateCost+ |
| 1087 m_usageCounters.numDrawCalls[DrawImage] * ExpensiveCanvasHeuristicParame
ters::AcceleratedDrawImageApproximateCost; |
| 1088 |
| 1089 double recordingCost = |
| 1090 numDrawPathCalls * ExpensiveCanvasHeuristicParameters::RecordingDrawPath
ApproximateCost + |
| 1091 m_usageCounters.numGetImageDataCalls * ExpensiveCanvasHeuristicParameter
s::UnacceleratedGetImageDataApproximateCost + |
| 1092 m_usageCounters.numDrawCalls[DrawImage] * ExpensiveCanvasHeuristicParame
ters::RecordingDrawImageApproximateCost; |
| 1093 |
| 1094 if (recordingCost * ExpensiveCanvasHeuristicParameters::AcceleratedHeuristic
Bias < acceleratedCost) { |
| 1095 return false; |
| 1096 } |
| 1097 return true; |
| 1098 } |
| 1099 |
| 1071 } // namespace blink | 1100 } // namespace blink |
| OLD | NEW |