| OLD | NEW |
| 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/ExceptionStatePlaceholder.h" | 9 #include "bindings/core/v8/ExceptionStatePlaceholder.h" |
| 10 #include "core/css/cssom/CSSURLImageValue.h" | 10 #include "core/css/cssom/CSSURLImageValue.h" |
| (...skipping 1060 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1071 imagePaint.setImageFilter(nullptr); | 1071 imagePaint.setImageFilter(nullptr); |
| 1072 } | 1072 } |
| 1073 | 1073 |
| 1074 if (!imageSmoothingEnabled() && | 1074 if (!imageSmoothingEnabled() && |
| 1075 isDrawScalingDown(srcRect, dstRect, state().transform().xScaleSquared(), | 1075 isDrawScalingDown(srcRect, dstRect, state().transform().xScaleSquared(), |
| 1076 state().transform().yScaleSquared())) | 1076 state().transform().yScaleSquared())) |
| 1077 imagePaint.setFilterQuality(kLow_SkFilterQuality); | 1077 imagePaint.setFilterQuality(kLow_SkFilterQuality); |
| 1078 | 1078 |
| 1079 if (!imageSource->isVideoElement()) { | 1079 if (!imageSource->isVideoElement()) { |
| 1080 imagePaint.setAntiAlias(shouldDrawImageAntialiased(dstRect)); | 1080 imagePaint.setAntiAlias(shouldDrawImageAntialiased(dstRect)); |
| 1081 // TODO(ccameron): Canvas should draw in sRGB by default. | |
| 1082 // https://crbug.com/672299 | |
| 1083 image->draw(c, imagePaint, dstRect, srcRect, DoNotRespectImageOrientation, | 1081 image->draw(c, imagePaint, dstRect, srcRect, DoNotRespectImageOrientation, |
| 1084 Image::DoNotClampImageToSourceRect, | 1082 Image::DoNotClampImageToSourceRect, drawImageColorBehavior()); |
| 1085 ColorBehavior::transformToGlobalTarget()); | |
| 1086 } else { | 1083 } else { |
| 1087 c->save(); | 1084 c->save(); |
| 1088 c->clipRect(dstRect); | 1085 c->clipRect(dstRect); |
| 1089 c->translate(dstRect.x(), dstRect.y()); | 1086 c->translate(dstRect.x(), dstRect.y()); |
| 1090 c->scale(dstRect.width() / srcRect.width(), | 1087 c->scale(dstRect.width() / srcRect.width(), |
| 1091 dstRect.height() / srcRect.height()); | 1088 dstRect.height() / srcRect.height()); |
| 1092 c->translate(-srcRect.x(), -srcRect.y()); | 1089 c->translate(-srcRect.x(), -srcRect.y()); |
| 1093 HTMLVideoElement* video = static_cast<HTMLVideoElement*>(imageSource); | 1090 HTMLVideoElement* video = static_cast<HTMLVideoElement*>(imageSource); |
| 1094 video->paintCurrentFrame( | 1091 video->paintCurrentFrame( |
| 1095 c, | 1092 c, |
| (...skipping 920 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2016 ExpensiveCanvasHeuristicParameters::ShadowFixedCost[index] * | 2013 ExpensiveCanvasHeuristicParameters::ShadowFixedCost[index] * |
| 2017 m_usageCounters.numBlurredShadows + | 2014 m_usageCounters.numBlurredShadows + |
| 2018 ExpensiveCanvasHeuristicParameters:: | 2015 ExpensiveCanvasHeuristicParameters:: |
| 2019 ShadowVariableCostPerAreaTimesShadowBlurSquared[index] * | 2016 ShadowVariableCostPerAreaTimesShadowBlurSquared[index] * |
| 2020 m_usageCounters.boundingBoxAreaTimesShadowBlurSquared; | 2017 m_usageCounters.boundingBoxAreaTimesShadowBlurSquared; |
| 2021 | 2018 |
| 2022 return basicCostOfDrawCalls + fillTypeAdjustment + shadowAdjustment; | 2019 return basicCostOfDrawCalls + fillTypeAdjustment + shadowAdjustment; |
| 2023 } | 2020 } |
| 2024 | 2021 |
| 2025 } // namespace blink | 2022 } // namespace blink |
| OLD | NEW |