Chromium Code Reviews| 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/CSSImageValueOrHTMLImageElementOrHTMLVideoElementO rHTMLCanvasElementOrImageBitmapOrOffscreenCanvas.h" | 8 #include "bindings/modules/v8/CSSImageValueOrHTMLImageElementOrHTMLVideoElementO rHTMLCanvasElementOrImageBitmapOrOffscreenCanvas.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 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 436 SkPaint compositePaint; | 436 SkPaint compositePaint; |
| 437 compositePaint.setBlendMode((SkBlendMode)state().globalComposite()); | 437 compositePaint.setBlendMode((SkBlendMode)state().globalComposite()); |
| 438 if (state().shouldDrawShadows()) { | 438 if (state().shouldDrawShadows()) { |
| 439 // unroll into two independently composited passes if drawing shadows | 439 // unroll into two independently composited passes if drawing shadows |
| 440 SkPaint shadowPaint = | 440 SkPaint shadowPaint = |
| 441 *state().getPaint(paintType, DrawShadowOnly, imageType); | 441 *state().getPaint(paintType, DrawShadowOnly, imageType); |
| 442 int saveCount = c->getSaveCount(); | 442 int saveCount = c->getSaveCount(); |
| 443 if (filter) { | 443 if (filter) { |
| 444 SkPaint foregroundPaint = | 444 SkPaint foregroundPaint = |
| 445 *state().getPaint(paintType, DrawForegroundOnly, imageType); | 445 *state().getPaint(paintType, DrawForegroundOnly, imageType); |
| 446 sk_sp<SkImageFilter> composedFilter = | 446 sk_sp<SkImageFilter> composedFilter = foregroundPaint.refImageFilter(); |
|
reed1
2017/01/12 19:09:31
Is it too horrible to never use an lvalue for this
f(malita)
2017/01/12 19:14:19
Done.
| |
| 447 sk_ref_sp(foregroundPaint.getImageFilter()); | 447 composedFilter = SkComposeImageFilter::Make(std::move(composedFilter), |
| 448 composedFilter = SkComposeImageFilter::Make( | 448 shadowPaint.refImageFilter()); |
| 449 std::move(composedFilter), sk_ref_sp(shadowPaint.getImageFilter())); | |
| 450 composedFilter = | 449 composedFilter = |
| 451 SkComposeImageFilter::Make(std::move(composedFilter), filter); | 450 SkComposeImageFilter::Make(std::move(composedFilter), filter); |
| 452 foregroundPaint.setImageFilter(std::move(composedFilter)); | 451 foregroundPaint.setImageFilter(std::move(composedFilter)); |
| 453 c->setMatrix(ctm); | 452 c->setMatrix(ctm); |
| 454 drawFunc(c, &foregroundPaint); | 453 drawFunc(c, &foregroundPaint); |
| 455 } else { | 454 } else { |
| 456 ASSERT(isFullCanvasCompositeMode(state().globalComposite())); | 455 ASSERT(isFullCanvasCompositeMode(state().globalComposite())); |
| 457 c->saveLayer(nullptr, &compositePaint); | 456 c->saveLayer(nullptr, &compositePaint); |
| 458 shadowPaint.setBlendMode(SkBlendMode::kSrcOver); | 457 shadowPaint.setBlendMode(SkBlendMode::kSrcOver); |
| 459 c->setMatrix(ctm); | 458 c->setMatrix(ctm); |
| 460 drawFunc(c, &shadowPaint); | 459 drawFunc(c, &shadowPaint); |
| 461 } | 460 } |
| 462 c->restoreToCount(saveCount); | 461 c->restoreToCount(saveCount); |
| 463 } | 462 } |
| 464 | 463 |
| 465 compositePaint.setImageFilter(std::move(filter)); | 464 compositePaint.setImageFilter(std::move(filter)); |
| 466 c->saveLayer(nullptr, &compositePaint); | 465 c->saveLayer(nullptr, &compositePaint); |
| 467 SkPaint foregroundPaint = | 466 SkPaint foregroundPaint = |
| 468 *state().getPaint(paintType, DrawForegroundOnly, imageType); | 467 *state().getPaint(paintType, DrawForegroundOnly, imageType); |
| 469 foregroundPaint.setBlendMode(SkBlendMode::kSrcOver); | 468 foregroundPaint.setBlendMode(SkBlendMode::kSrcOver); |
| 470 c->setMatrix(ctm); | 469 c->setMatrix(ctm); |
| 471 drawFunc(c, &foregroundPaint); | 470 drawFunc(c, &foregroundPaint); |
| 472 c->restore(); | 471 c->restore(); |
| 473 c->setMatrix(ctm); | 472 c->setMatrix(ctm); |
| 474 } | 473 } |
| 475 | 474 |
| 476 } // namespace blink | 475 } // namespace blink |
| 477 | 476 |
| 478 #endif // BaseRenderingContext2D_h | 477 #endif // BaseRenderingContext2D_h |
| OLD | NEW |