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 #ifndef BaseRenderingContext2D_h | 5 #ifndef BaseRenderingContext2D_h |
6 #define BaseRenderingContext2D_h | 6 #define BaseRenderingContext2D_h |
7 | 7 |
8 #include "bindings/modules/v8/CSSImageValueOrHTMLImageElementOrSVGImageElementOr
HTMLVideoElementOrHTMLCanvasElementOrImageBitmapOrOffscreenCanvas.h" | 8 #include "bindings/modules/v8/CSSImageValueOrHTMLImageElementOrSVGImageElementOr
HTMLVideoElementOrHTMLCanvasElementOrImageBitmapOrOffscreenCanvas.h" |
9 #include "bindings/modules/v8/StringOrCanvasGradientOrCanvasPattern.h" | 9 #include "bindings/modules/v8/StringOrCanvasGradientOrCanvasPattern.h" |
10 #include "core/html/ImageData.h" | 10 #include "core/html/ImageData.h" |
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
449 return true; | 449 return true; |
450 } | 450 } |
451 | 451 |
452 template <typename DrawFunc> | 452 template <typename DrawFunc> |
453 void BaseRenderingContext2D::CompositedDraw( | 453 void BaseRenderingContext2D::CompositedDraw( |
454 const DrawFunc& draw_func, | 454 const DrawFunc& draw_func, |
455 PaintCanvas* c, | 455 PaintCanvas* c, |
456 CanvasRenderingContext2DState::PaintType paint_type, | 456 CanvasRenderingContext2DState::PaintType paint_type, |
457 CanvasRenderingContext2DState::ImageType image_type) { | 457 CanvasRenderingContext2DState::ImageType image_type) { |
458 sk_sp<SkImageFilter> filter = StateGetFilter(); | 458 sk_sp<SkImageFilter> filter = StateGetFilter(); |
459 ASSERT(IsFullCanvasCompositeMode(GetState().GlobalComposite()) || filter); | 459 DCHECK(IsFullCanvasCompositeMode(GetState().GlobalComposite()) || filter); |
460 SkMatrix ctm = c->getTotalMatrix(); | 460 SkMatrix ctm = c->getTotalMatrix(); |
461 c->setMatrix(SkMatrix::I()); | 461 c->setMatrix(SkMatrix::I()); |
462 PaintFlags composite_flags; | 462 PaintFlags composite_flags; |
463 composite_flags.setBlendMode((SkBlendMode)GetState().GlobalComposite()); | 463 composite_flags.setBlendMode((SkBlendMode)GetState().GlobalComposite()); |
464 if (GetState().ShouldDrawShadows()) { | 464 if (GetState().ShouldDrawShadows()) { |
465 // unroll into two independently composited passes if drawing shadows | 465 // unroll into two independently composited passes if drawing shadows |
466 PaintFlags shadow_flags = | 466 PaintFlags shadow_flags = |
467 *GetState().GetFlags(paint_type, kDrawShadowOnly, image_type); | 467 *GetState().GetFlags(paint_type, kDrawShadowOnly, image_type); |
468 int save_count = c->getSaveCount(); | 468 int save_count = c->getSaveCount(); |
469 if (filter) { | 469 if (filter) { |
(...skipping 22 matching lines...) Expand all Loading... |
492 foreground_flags.setBlendMode(SkBlendMode::kSrcOver); | 492 foreground_flags.setBlendMode(SkBlendMode::kSrcOver); |
493 c->setMatrix(ctm); | 493 c->setMatrix(ctm); |
494 draw_func(c, &foreground_flags); | 494 draw_func(c, &foreground_flags); |
495 c->restore(); | 495 c->restore(); |
496 c->setMatrix(ctm); | 496 c->setMatrix(ctm); |
497 } | 497 } |
498 | 498 |
499 } // namespace blink | 499 } // namespace blink |
500 | 500 |
501 #endif // BaseRenderingContext2D_h | 501 #endif // BaseRenderingContext2D_h |
OLD | NEW |