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

Side by Side Diff: third_party/WebKit/Source/modules/canvas2d/BaseRenderingContext2D.cpp

Issue 2645613003: Fix unused lambda captures in Blink (Closed)
Patch Set: Created 3 years, 11 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 unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2D.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "modules/canvas2d/BaseRenderingContext2D.h" 5 #include "modules/canvas2d/BaseRenderingContext2D.h"
6 6
7 #include "bindings/core/v8/ExceptionMessages.h" 7 #include "bindings/core/v8/ExceptionMessages.h"
8 #include "bindings/core/v8/ExceptionState.h" 8 #include "bindings/core/v8/ExceptionState.h"
9 #include "core/css/cssom/CSSURLImageValue.h" 9 #include "core/css/cssom/CSSURLImageValue.h"
10 #include "core/css/parser/CSSParser.h" 10 #include "core/css/parser/CSSParser.h"
(...skipping 604 matching lines...) Expand 10 before | Expand all | Expand 10 after
615 SkPath skPath = path.getSkPath(); 615 SkPath skPath = path.getSkPath();
616 FloatRect bounds = path.boundingRect(); 616 FloatRect bounds = path.boundingRect();
617 skPath.setFillType(fillType); 617 skPath.setFillType(fillType);
618 618
619 if (paintType == CanvasRenderingContext2DState::StrokePaintType) 619 if (paintType == CanvasRenderingContext2DState::StrokePaintType)
620 inflateStrokeRect(bounds); 620 inflateStrokeRect(bounds);
621 621
622 if (!drawingCanvas()) 622 if (!drawingCanvas())
623 return; 623 return;
624 624
625 if (draw([&skPath, this](SkCanvas* c, const SkPaint* paint) // draw lambda 625 if (draw([&skPath](SkCanvas* c, const SkPaint* paint) // draw lambda
626 { c->drawPath(skPath, *paint); }, 626 { c->drawPath(skPath, *paint); },
627 [](const SkIRect& rect) // overdraw test lambda 627 [](const SkIRect& rect) // overdraw test lambda
628 { return false; }, 628 { return false; },
629 bounds, paintType)) { 629 bounds, paintType)) {
630 if (isPathExpensive(path)) { 630 if (isPathExpensive(path)) {
631 ImageBuffer* buffer = imageBuffer(); 631 ImageBuffer* buffer = imageBuffer();
632 if (buffer) 632 if (buffer)
633 buffer->setHasExpensiveOp(); 633 buffer->setHasExpensiveOp();
634 } 634 }
635 } 635 }
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
675 double width, 675 double width,
676 double height) { 676 double height) {
677 trackDrawCall(FillRect, nullptr, width, height); 677 trackDrawCall(FillRect, nullptr, width, height);
678 if (!validateRectForCanvas(x, y, width, height)) 678 if (!validateRectForCanvas(x, y, width, height))
679 return; 679 return;
680 680
681 if (!drawingCanvas()) 681 if (!drawingCanvas())
682 return; 682 return;
683 683
684 SkRect rect = SkRect::MakeXYWH(x, y, width, height); 684 SkRect rect = SkRect::MakeXYWH(x, y, width, height);
685 draw([&rect, this](SkCanvas* c, const SkPaint* paint) // draw lambda 685 draw([&rect](SkCanvas* c, const SkPaint* paint) // draw lambda
686 { c->drawRect(rect, *paint); }, 686 { c->drawRect(rect, *paint); },
687 [&rect, this](const SkIRect& clipBounds) // overdraw test lambda 687 [&rect, this](const SkIRect& clipBounds) // overdraw test lambda
688 { return rectContainsTransformedRect(rect, clipBounds); }, 688 { return rectContainsTransformedRect(rect, clipBounds); },
689 rect, CanvasRenderingContext2DState::FillPaintType); 689 rect, CanvasRenderingContext2DState::FillPaintType);
690 } 690 }
691 691
692 static void strokeRectOnCanvas(const FloatRect& rect, 692 static void strokeRectOnCanvas(const FloatRect& rect,
693 SkCanvas* canvas, 693 SkCanvas* canvas,
694 const SkPaint* paint) { 694 const SkPaint* paint) {
695 ASSERT(paint->getStyle() == SkPaint::kStroke_Style); 695 ASSERT(paint->getStyle() == SkPaint::kStroke_Style);
(...skipping 16 matching lines...) Expand all
712 trackDrawCall(StrokeRect, nullptr, width, height); 712 trackDrawCall(StrokeRect, nullptr, width, height);
713 if (!validateRectForCanvas(x, y, width, height)) 713 if (!validateRectForCanvas(x, y, width, height))
714 return; 714 return;
715 715
716 if (!drawingCanvas()) 716 if (!drawingCanvas())
717 return; 717 return;
718 718
719 SkRect rect = SkRect::MakeXYWH(x, y, width, height); 719 SkRect rect = SkRect::MakeXYWH(x, y, width, height);
720 FloatRect bounds = rect; 720 FloatRect bounds = rect;
721 inflateStrokeRect(bounds); 721 inflateStrokeRect(bounds);
722 draw([&rect, this](SkCanvas* c, const SkPaint* paint) // draw lambda 722 draw([&rect](SkCanvas* c, const SkPaint* paint) // draw lambda
723 { strokeRectOnCanvas(rect, c, paint); }, 723 { strokeRectOnCanvas(rect, c, paint); },
724 [](const SkIRect& clipBounds) // overdraw test lambda 724 [](const SkIRect& clipBounds) // overdraw test lambda
725 { return false; }, 725 { return false; },
726 bounds, CanvasRenderingContext2DState::StrokePaintType); 726 bounds, CanvasRenderingContext2DState::StrokePaintType);
727 } 727 }
728 728
729 void BaseRenderingContext2D::clipInternal(const Path& path, 729 void BaseRenderingContext2D::clipInternal(const Path& path,
730 const String& windingRuleString) { 730 const String& windingRuleString) {
731 SkCanvas* c = drawingCanvas(); 731 SkCanvas* c = drawingCanvas();
732 if (!c) { 732 if (!c) {
(...skipping 1284 matching lines...) Expand 10 before | Expand all | Expand 10 after
2017 ExpensiveCanvasHeuristicParameters::ShadowFixedCost[index] * 2017 ExpensiveCanvasHeuristicParameters::ShadowFixedCost[index] *
2018 m_usageCounters.numBlurredShadows + 2018 m_usageCounters.numBlurredShadows +
2019 ExpensiveCanvasHeuristicParameters:: 2019 ExpensiveCanvasHeuristicParameters::
2020 ShadowVariableCostPerAreaTimesShadowBlurSquared[index] * 2020 ShadowVariableCostPerAreaTimesShadowBlurSquared[index] *
2021 m_usageCounters.boundingBoxAreaTimesShadowBlurSquared; 2021 m_usageCounters.boundingBoxAreaTimesShadowBlurSquared;
2022 2022
2023 return basicCostOfDrawCalls + fillTypeAdjustment + shadowAdjustment; 2023 return basicCostOfDrawCalls + fillTypeAdjustment + shadowAdjustment;
2024 } 2024 }
2025 2025
2026 } // namespace blink 2026 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2D.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698