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

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

Issue 2743363006: Clean up cc/paint interfaces (Closed)
Patch Set: Fix PaintControllerTest v2 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 #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 416 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 427
428 template <typename DrawFunc> 428 template <typename DrawFunc>
429 void BaseRenderingContext2D::compositedDraw( 429 void BaseRenderingContext2D::compositedDraw(
430 const DrawFunc& drawFunc, 430 const DrawFunc& drawFunc,
431 PaintCanvas* c, 431 PaintCanvas* c,
432 CanvasRenderingContext2DState::PaintType paintType, 432 CanvasRenderingContext2DState::PaintType paintType,
433 CanvasRenderingContext2DState::ImageType imageType) { 433 CanvasRenderingContext2DState::ImageType imageType) {
434 sk_sp<SkImageFilter> filter = stateGetFilter(); 434 sk_sp<SkImageFilter> filter = stateGetFilter();
435 ASSERT(isFullCanvasCompositeMode(state().globalComposite()) || filter); 435 ASSERT(isFullCanvasCompositeMode(state().globalComposite()) || filter);
436 SkMatrix ctm = c->getTotalMatrix(); 436 SkMatrix ctm = c->getTotalMatrix();
437 c->resetMatrix(); 437 c->setMatrix(SkMatrix::I());
438 PaintFlags compositeFlags; 438 PaintFlags compositeFlags;
439 compositeFlags.setBlendMode((SkBlendMode)state().globalComposite()); 439 compositeFlags.setBlendMode((SkBlendMode)state().globalComposite());
440 if (state().shouldDrawShadows()) { 440 if (state().shouldDrawShadows()) {
441 // unroll into two independently composited passes if drawing shadows 441 // unroll into two independently composited passes if drawing shadows
442 PaintFlags shadowFlags = 442 PaintFlags shadowFlags =
443 *state().getFlags(paintType, DrawShadowOnly, imageType); 443 *state().getFlags(paintType, DrawShadowOnly, imageType);
444 int saveCount = c->getSaveCount(); 444 int saveCount = c->getSaveCount();
445 if (filter) { 445 if (filter) {
446 PaintFlags foregroundFlags = 446 PaintFlags foregroundFlags =
447 *state().getFlags(paintType, DrawForegroundOnly, imageType); 447 *state().getFlags(paintType, DrawForegroundOnly, imageType);
(...skipping 20 matching lines...) Expand all
468 foregroundFlags.setBlendMode(SkBlendMode::kSrcOver); 468 foregroundFlags.setBlendMode(SkBlendMode::kSrcOver);
469 c->setMatrix(ctm); 469 c->setMatrix(ctm);
470 drawFunc(c, &foregroundFlags); 470 drawFunc(c, &foregroundFlags);
471 c->restore(); 471 c->restore();
472 c->setMatrix(ctm); 472 c->setMatrix(ctm);
473 } 473 }
474 474
475 } // namespace blink 475 } // namespace blink
476 476
477 #endif // BaseRenderingContext2D_h 477 #endif // BaseRenderingContext2D_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/svg/graphics/SVGImage.cpp ('k') | third_party/WebKit/Source/platform/graphics/BitmapImage.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698