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 "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 1851 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1862 is_source_over = mode == SkBlendMode::kSrcOver; | 1862 is_source_over = mode == SkBlendMode::kSrcOver; |
1863 if (!is_source_over && mode != SkBlendMode::kSrc && | 1863 if (!is_source_over && mode != SkBlendMode::kSrc && |
1864 mode != SkBlendMode::kClear) | 1864 mode != SkBlendMode::kClear) |
1865 return; // The code below only knows how to handle Src, SrcOver, and | 1865 return; // The code below only knows how to handle Src, SrcOver, and |
1866 // Clear | 1866 // Clear |
1867 | 1867 |
1868 alpha = flags->getAlpha(); | 1868 alpha = flags->getAlpha(); |
1869 | 1869 |
1870 if (is_source_over && | 1870 if (is_source_over && |
1871 image_type == CanvasRenderingContext2DState::kNoImage) { | 1871 image_type == CanvasRenderingContext2DState::kNoImage) { |
1872 PaintShader* shader = flags->getShader(); | 1872 if (flags->HasShader()) { |
1873 if (shader) { | 1873 if (flags->ShaderIsOpaque() && alpha == 0xFF) |
1874 if (shader->isOpaque() && alpha == 0xFF) | |
1875 GetImageBuffer()->WillOverwriteCanvas(); | 1874 GetImageBuffer()->WillOverwriteCanvas(); |
1876 return; | 1875 return; |
1877 } | 1876 } |
1878 } | 1877 } |
1879 } | 1878 } |
1880 | 1879 |
1881 if (is_source_over) { | 1880 if (is_source_over) { |
1882 // With source over, we need to certify that alpha == 0xFF for all pixels | 1881 // With source over, we need to certify that alpha == 0xFF for all pixels |
1883 if (image_type == CanvasRenderingContext2DState::kNonOpaqueImage) | 1882 if (image_type == CanvasRenderingContext2DState::kNonOpaqueImage) |
1884 return; | 1883 return; |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2138 ExpensiveCanvasHeuristicParameters::kShadowFixedCost[index] * | 2137 ExpensiveCanvasHeuristicParameters::kShadowFixedCost[index] * |
2139 usage_counters_.num_blurred_shadows + | 2138 usage_counters_.num_blurred_shadows + |
2140 ExpensiveCanvasHeuristicParameters:: | 2139 ExpensiveCanvasHeuristicParameters:: |
2141 kShadowVariableCostPerAreaTimesShadowBlurSquared[index] * | 2140 kShadowVariableCostPerAreaTimesShadowBlurSquared[index] * |
2142 usage_counters_.bounding_box_area_times_shadow_blur_squared; | 2141 usage_counters_.bounding_box_area_times_shadow_blur_squared; |
2143 | 2142 |
2144 return basic_cost_of_draw_calls + fill_type_adjustment + shadow_adjustment; | 2143 return basic_cost_of_draw_calls + fill_type_adjustment + shadow_adjustment; |
2145 } | 2144 } |
2146 | 2145 |
2147 } // namespace blink | 2146 } // namespace blink |
OLD | NEW |