Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(953)

Unified Diff: third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2D.cpp

Issue 2903053002: Removing canvas rendering mode switching feature (Closed)
Patch Set: fix test failure Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2D.cpp
diff --git a/third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2D.cpp b/third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2D.cpp
index 0f4f5478db3d30dd078d04a8ca5479390e2721d8..94951470432f398999a38cb17268886fe42c885f 100644
--- a/third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2D.cpp
+++ b/third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2D.cpp
@@ -54,8 +54,8 @@
#include "modules/canvas2d/HitRegion.h"
#include "modules/canvas2d/Path2D.h"
#include "platform/fonts/FontCache.h"
+#include "platform/graphics/CanvasHeuristicParameters.h"
#include "platform/graphics/DrawLooperBuilder.h"
-#include "platform/graphics/ExpensiveCanvasHeuristicParameters.h"
#include "platform/graphics/ImageBuffer.h"
#include "platform/graphics/StrokeData.h"
#include "platform/graphics/paint/PaintCanvas.h"
@@ -366,7 +366,7 @@ void CanvasRenderingContext2D::DidDraw(const SkIRect& dirty_rect) {
if (dirty_rect.isEmpty())
return;
- if (ExpensiveCanvasHeuristicParameters::kBlurredShadowsAreExpensive &&
+ if (CanvasHeuristicParameters::kBlurredShadowsAreExpensive &&
GetState().ShouldDrawShadows() && GetState().ShadowBlur() > 0) {
ImageBuffer* buffer = GetImageBuffer();
if (buffer)
@@ -737,7 +737,6 @@ void CanvasRenderingContext2D::setDirection(const String& direction_string) {
void CanvasRenderingContext2D::fillText(const String& text,
double x,
double y) {
- TrackDrawCall(kFillText);
DrawTextInternal(text, x, y, CanvasRenderingContext2DState::kFillPaintType);
}
@@ -745,7 +744,6 @@ void CanvasRenderingContext2D::fillText(const String& text,
double x,
double y,
double max_width) {
- TrackDrawCall(kFillText);
DrawTextInternal(text, x, y, CanvasRenderingContext2DState::kFillPaintType,
&max_width);
}
@@ -753,7 +751,6 @@ void CanvasRenderingContext2D::fillText(const String& text,
void CanvasRenderingContext2D::strokeText(const String& text,
double x,
double y) {
- TrackDrawCall(kStrokeText);
DrawTextInternal(text, x, y, CanvasRenderingContext2DState::kStrokePaintType);
}
@@ -761,7 +758,6 @@ void CanvasRenderingContext2D::strokeText(const String& text,
double x,
double y,
double max_width) {
- TrackDrawCall(kStrokeText);
DrawTextInternal(text, x, y, CanvasRenderingContext2DState::kStrokePaintType,
&max_width);
}
@@ -1164,36 +1160,4 @@ unsigned CanvasRenderingContext2D::HitRegionsCount() const {
return 0;
}
-bool CanvasRenderingContext2D::IsAccelerationOptimalForCanvasContent() const {
- // Heuristic to determine if the GPU accelerated rendering pipeline is optimal
- // for performance based on past usage. It has a bias towards suggesting that
- // the accelerated pipeline is optimal.
-
- float accelerated_cost = EstimateRenderingCost(
- ExpensiveCanvasHeuristicParameters::kAcceleratedModeIndex);
-
- float recording_cost = EstimateRenderingCost(
- ExpensiveCanvasHeuristicParameters::kRecordingModeIndex);
-
- float cost_difference = accelerated_cost - recording_cost;
- float percent_cost_reduction = cost_difference / accelerated_cost * 100.0;
- float cost_difference_per_frame =
- cost_difference / usage_counters_.num_frames_since_reset;
-
- if (percent_cost_reduction >=
- ExpensiveCanvasHeuristicParameters::
- kMinPercentageImprovementToSuggestDisableAcceleration &&
- cost_difference_per_frame >=
- ExpensiveCanvasHeuristicParameters::
- kMinCostPerFrameImprovementToSuggestDisableAcceleration) {
- return false;
- }
- return true;
-}
-
-void CanvasRenderingContext2D::ResetUsageTracking() {
- UsageCounters new_counters;
- usage_counters_ = new_counters;
-}
-
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698