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/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" |
| 11 #include "core/html/canvas/CanvasRenderingContext.h" | |
| 11 #include "modules/ModulesExport.h" | 12 #include "modules/ModulesExport.h" |
| 12 #include "modules/canvas2d/CanvasGradient.h" | 13 #include "modules/canvas2d/CanvasGradient.h" |
| 13 #include "modules/canvas2d/CanvasPathMethods.h" | 14 #include "modules/canvas2d/CanvasPathMethods.h" |
| 14 #include "modules/canvas2d/CanvasRenderingContext2DState.h" | 15 #include "modules/canvas2d/CanvasRenderingContext2DState.h" |
| 15 #include "modules/canvas2d/CanvasStyle.h" | 16 #include "modules/canvas2d/CanvasStyle.h" |
| 16 #include "platform/graphics/ColorBehavior.h" | 17 #include "platform/graphics/ColorBehavior.h" |
| 17 #include "platform/graphics/ExpensiveCanvasHeuristicParameters.h" | 18 #include "platform/graphics/ExpensiveCanvasHeuristicParameters.h" |
| 18 #include "platform/graphics/paint/PaintCanvas.h" | 19 #include "platform/graphics/paint/PaintCanvas.h" |
| 19 #include "third_party/skia/include/effects/SkComposeImageFilter.h" | 20 #include "third_party/skia/include/effects/SkComposeImageFilter.h" |
| 20 | 21 |
| (...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 367 static bool isFullCanvasCompositeMode(SkBlendMode); | 368 static bool isFullCanvasCompositeMode(SkBlendMode); |
| 368 | 369 |
| 369 template <typename DrawFunc> | 370 template <typename DrawFunc> |
| 370 void compositedDraw(const DrawFunc&, | 371 void compositedDraw(const DrawFunc&, |
| 371 PaintCanvas*, | 372 PaintCanvas*, |
| 372 CanvasRenderingContext2DState::PaintType, | 373 CanvasRenderingContext2DState::PaintType, |
| 373 CanvasRenderingContext2DState::ImageType); | 374 CanvasRenderingContext2DState::ImageType); |
| 374 | 375 |
| 375 void clearCanvas(); | 376 void clearCanvas(); |
| 376 bool rectContainsTransformedRect(const FloatRect&, const SkIRect&) const; | 377 bool rectContainsTransformedRect(const FloatRect&, const SkIRect&) const; |
| 378 | |
| 379 virtual CanvasRenderingContext* renderingContext() const { return nullptr; } | |
|
Justin Novosad
2017/04/06 19:01:04
This should either be a non-const method, or it sh
zakerinasab
2017/04/11 19:52:59
Done.
| |
| 380 | |
| 381 bool colorSettingsAsImageDataColorSettings(ImageDataColorSettings&) const; | |
| 377 }; | 382 }; |
| 378 | 383 |
| 379 template <typename DrawFunc, typename ContainsFunc> | 384 template <typename DrawFunc, typename ContainsFunc> |
| 380 bool BaseRenderingContext2D::draw( | 385 bool BaseRenderingContext2D::draw( |
| 381 const DrawFunc& drawFunc, | 386 const DrawFunc& drawFunc, |
| 382 const ContainsFunc& drawCoversClipBounds, | 387 const ContainsFunc& drawCoversClipBounds, |
| 383 const SkRect& bounds, | 388 const SkRect& bounds, |
| 384 CanvasRenderingContext2DState::PaintType paintType, | 389 CanvasRenderingContext2DState::PaintType paintType, |
| 385 CanvasRenderingContext2DState::ImageType imageType) { | 390 CanvasRenderingContext2DState::ImageType imageType) { |
| 386 if (!state().isTransformInvertible()) | 391 if (!state().isTransformInvertible()) |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 466 foregroundFlags.setBlendMode(SkBlendMode::kSrcOver); | 471 foregroundFlags.setBlendMode(SkBlendMode::kSrcOver); |
| 467 c->setMatrix(ctm); | 472 c->setMatrix(ctm); |
| 468 drawFunc(c, &foregroundFlags); | 473 drawFunc(c, &foregroundFlags); |
| 469 c->restore(); | 474 c->restore(); |
| 470 c->setMatrix(ctm); | 475 c->setMatrix(ctm); |
| 471 } | 476 } |
| 472 | 477 |
| 473 } // namespace blink | 478 } // namespace blink |
| 474 | 479 |
| 475 #endif // BaseRenderingContext2D_h | 480 #endif // BaseRenderingContext2D_h |
| OLD | NEW |