| Index: third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp
|
| diff --git a/third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp b/third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp
|
| index 85f5d4e1e5d29d5ba45d9c62987d537e0bef5296..9641fac5dfff411b371f39311a67bab2f0f14f70 100644
|
| --- a/third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp
|
| +++ b/third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp
|
| @@ -50,7 +50,10 @@
|
| #include "platform/RuntimeEnabledFeatures.h"
|
| #include "platform/graphics/Canvas2DImageBufferSurface.h"
|
| #include "platform/graphics/CanvasMetrics.h"
|
| +#include "platform/graphics/ColorSpaceFilter.h"
|
| +#include "platform/graphics/ColorSpaceProfile.h"
|
| #include "platform/graphics/ExpensiveCanvasHeuristicParameters.h"
|
| +#include "platform/graphics/GraphicsScreen.h"
|
| #include "platform/graphics/ImageBuffer.h"
|
| #include "platform/graphics/RecordingImageBufferSurface.h"
|
| #include "platform/graphics/StaticBitmapImage.h"
|
| @@ -451,17 +454,27 @@ void HTMLCanvasElement::notifyListenersCanvasChanged()
|
|
|
| void HTMLCanvasElement::paint(GraphicsContext& context, const LayoutRect& r)
|
| {
|
| + RELEASE_ASSERT(currentScreenId()); // There should be an active graphics screen.
|
| +
|
| // FIXME: crbug.com/438240; there is a bug with the new CSS blending and compositing feature.
|
| if (!m_context)
|
| return;
|
| +
|
| if (!paintsIntoCanvasBuffer() && !document().printing())
|
| return;
|
|
|
| m_context->paintRenderingResultsToCanvas(FrontBuffer);
|
| +
|
| + RefPtr<SkColorFilter> colorTransform;
|
| + if (RefPtr<ColorSpaceProfile> source = screenColorProfile(ScreenDevice::sRGB)) {
|
| + RefPtr<ColorSpaceProfile> target = screenColorProfile(currentScreenId());
|
| + colorTransform = createColorSpaceFilter(source.get(), target.get());
|
| + }
|
| +
|
| if (hasImageBuffer()) {
|
| if (!context.contextDisabled()) {
|
| SkXfermode::Mode compositeOperator = !m_context || m_context->hasAlpha() ? SkXfermode::kSrcOver_Mode : SkXfermode::kSrc_Mode;
|
| - buffer()->draw(context, pixelSnappedIntRect(r), 0, compositeOperator);
|
| + buffer()->draw(context, pixelSnappedIntRect(r), 0, compositeOperator, colorTransform.get());
|
| }
|
| } else {
|
| // When alpha is false, we should draw to opaque black.
|
| @@ -737,12 +750,14 @@ PassOwnPtr<ImageBufferSurface> HTMLCanvasElement::createImageBufferSurface(const
|
| }
|
| surfaceFactory = adoptPtr(new UnacceleratedSurfaceFactory()); // recreate because previous one was released
|
| }
|
| +
|
| auto surface = surfaceFactory->createSurface(deviceSize, opacityMode);
|
| if (!surface->isValid()) {
|
| CanvasMetrics::countCanvasContextUsage(CanvasMetrics::Unaccelerated2DCanvasImageBufferCreationFailed);
|
| } else {
|
| CanvasMetrics::countCanvasContextUsage(CanvasMetrics::Unaccelerated2DCanvasImageBufferCreated);
|
| }
|
| +
|
| return surface;
|
| }
|
|
|
|
|