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

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

Issue 2716203002: blink: Fix cc/paint skia type mismatches (Closed)
Patch Set: Fix canvas Created 3 years, 9 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
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 "bindings/core/v8/ScriptState.h" 9 #include "bindings/core/v8/ScriptState.h"
10 #include "core/css/cssom/CSSURLImageValue.h" 10 #include "core/css/cssom/CSSURLImageValue.h"
(...skipping 677 matching lines...) Expand 10 before | Expand all | Expand 10 after
688 draw([&rect](PaintCanvas* c, const PaintFlags* flags) // draw lambda 688 draw([&rect](PaintCanvas* c, const PaintFlags* flags) // draw lambda
689 { c->drawRect(rect, *flags); }, 689 { c->drawRect(rect, *flags); },
690 [&rect, this](const SkIRect& clipBounds) // overdraw test lambda 690 [&rect, this](const SkIRect& clipBounds) // overdraw test lambda
691 { return rectContainsTransformedRect(rect, clipBounds); }, 691 { return rectContainsTransformedRect(rect, clipBounds); },
692 rect, CanvasRenderingContext2DState::FillPaintType); 692 rect, CanvasRenderingContext2DState::FillPaintType);
693 } 693 }
694 694
695 static void strokeRectOnCanvas(const FloatRect& rect, 695 static void strokeRectOnCanvas(const FloatRect& rect,
696 PaintCanvas* canvas, 696 PaintCanvas* canvas,
697 const PaintFlags* flags) { 697 const PaintFlags* flags) {
698 DCHECK_EQ(flags->getStyle(), SkPaint::kStroke_Style); 698 DCHECK_EQ(flags->getStyle(), PaintFlags::kStroke_Style);
699 if ((rect.width() > 0) != (rect.height() > 0)) { 699 if ((rect.width() > 0) != (rect.height() > 0)) {
700 // When stroking, we must skip the zero-dimension segments 700 // When stroking, we must skip the zero-dimension segments
701 SkPath path; 701 SkPath path;
702 path.moveTo(rect.x(), rect.y()); 702 path.moveTo(rect.x(), rect.y());
703 path.lineTo(rect.maxX(), rect.maxY()); 703 path.lineTo(rect.maxX(), rect.maxY());
704 path.close(); 704 path.close();
705 canvas->drawPath(path, *flags); 705 canvas->drawPath(path, *flags);
706 return; 706 return;
707 } 707 }
708 canvas->drawRect(rect, *flags); 708 canvas->drawRect(rect, *flags);
(...skipping 1313 matching lines...) Expand 10 before | Expand all | Expand 10 after
2022 ExpensiveCanvasHeuristicParameters::ShadowFixedCost[index] * 2022 ExpensiveCanvasHeuristicParameters::ShadowFixedCost[index] *
2023 m_usageCounters.numBlurredShadows + 2023 m_usageCounters.numBlurredShadows +
2024 ExpensiveCanvasHeuristicParameters:: 2024 ExpensiveCanvasHeuristicParameters::
2025 ShadowVariableCostPerAreaTimesShadowBlurSquared[index] * 2025 ShadowVariableCostPerAreaTimesShadowBlurSquared[index] *
2026 m_usageCounters.boundingBoxAreaTimesShadowBlurSquared; 2026 m_usageCounters.boundingBoxAreaTimesShadowBlurSquared;
2027 2027
2028 return basicCostOfDrawCalls + fillTypeAdjustment + shadowAdjustment; 2028 return basicCostOfDrawCalls + fillTypeAdjustment + shadowAdjustment;
2029 } 2029 }
2030 2030
2031 } // namespace blink 2031 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698