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 const CanvasRenderingContext* renderingContext() const { | |
|
fserb
2017/04/07 20:03:33
talking to junov@ offline, I don't think we should
| |
| 380 return nullptr; | |
| 381 } | |
| 382 | |
| 383 bool colorSettingsAsImageDataColorSettings(ImageDataColorSettings&) const; | |
| 384 | |
| 385 bool m_isColorManaged; | |
| 377 }; | 386 }; |
| 378 | 387 |
| 379 template <typename DrawFunc, typename ContainsFunc> | 388 template <typename DrawFunc, typename ContainsFunc> |
| 380 bool BaseRenderingContext2D::draw( | 389 bool BaseRenderingContext2D::draw( |
| 381 const DrawFunc& drawFunc, | 390 const DrawFunc& drawFunc, |
| 382 const ContainsFunc& drawCoversClipBounds, | 391 const ContainsFunc& drawCoversClipBounds, |
| 383 const SkRect& bounds, | 392 const SkRect& bounds, |
| 384 CanvasRenderingContext2DState::PaintType paintType, | 393 CanvasRenderingContext2DState::PaintType paintType, |
| 385 CanvasRenderingContext2DState::ImageType imageType) { | 394 CanvasRenderingContext2DState::ImageType imageType) { |
| 386 if (!state().isTransformInvertible()) | 395 if (!state().isTransformInvertible()) |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 466 foregroundFlags.setBlendMode(SkBlendMode::kSrcOver); | 475 foregroundFlags.setBlendMode(SkBlendMode::kSrcOver); |
| 467 c->setMatrix(ctm); | 476 c->setMatrix(ctm); |
| 468 drawFunc(c, &foregroundFlags); | 477 drawFunc(c, &foregroundFlags); |
| 469 c->restore(); | 478 c->restore(); |
| 470 c->setMatrix(ctm); | 479 c->setMatrix(ctm); |
| 471 } | 480 } |
| 472 | 481 |
| 473 } // namespace blink | 482 } // namespace blink |
| 474 | 483 |
| 475 #endif // BaseRenderingContext2D_h | 484 #endif // BaseRenderingContext2D_h |
| OLD | NEW |