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

Unified Diff: third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp

Issue 1331533002: [poc] curve-filter Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix CanvasRenderingContext2D::createPattern crash for #40 Created 4 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp
diff --git a/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp b/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp
index 7c798e24b2f8ed91695544f366d613df323f2ae2..92242fbdceb41bc1a9c50017dbde76a32ca7c5d0 100644
--- a/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp
+++ b/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp
@@ -60,12 +60,15 @@
#include "platform/fonts/FontCache.h"
#include "platform/geometry/TransformState.h"
#include "platform/graphics/BitmapImage.h"
+#include "platform/graphics/ColorSpaceFilter.h"
#include "platform/graphics/GraphicsContext.h"
+#include "platform/graphics/GraphicsScreen.h"
#include "platform/graphics/paint/ClipDisplayItem.h"
#include "platform/graphics/paint/CullRect.h"
#include "platform/graphics/paint/PaintController.h"
#include "platform/graphics/paint/TransformDisplayItem.h"
#include "public/platform/WebCompositorMutableProperties.h"
+#include "third_party/skia/include/core/SkColorFilter.h"
#include "wtf/CurrentTime.h"
#include "wtf/text/StringBuilder.h"
@@ -406,6 +409,8 @@ bool CompositedLayerMapping::updateGraphicsLayerConfiguration()
PaintLayerCompositor* compositor = this->compositor();
LayoutObject* layoutObject = this->layoutObject();
+ WillPaintForDevice device(Page::screenId(layoutObject->frame()->page()));
+
bool layerConfigChanged = false;
setBackgroundLayerPaintsFixedRootBackground(compositor->needsFixedRootBackgroundLayer(&m_owningLayer));
@@ -531,8 +536,16 @@ bool CompositedLayerMapping::updateGraphicsLayerConfiguration()
}
}
+ RefPtr<SkColorFilter> transform;
+
if (WebLayer* layer = platformLayerForPlugin(layoutObject)) {
m_graphicsLayer->setContentsToPlatformLayer(layer);
+ if (imageColorProfilesEnabled()) {
+ transform = createColorSpaceFilter(screenColorProfile(ScreenDevice::sRGB).get(), screenColorProfile(currentScreenId()).get());
+ m_graphicsLayer->setContentsLayerColorTransform(colorSpaceFlattenableFilter(transform.get()));
+ fprintf(stderr, "drawing plugin layer\n");
+ fflush(stderr);
+ }
} else if (layoutObject->node() && layoutObject->node()->isFrameOwnerElement() && toHTMLFrameOwnerElement(layoutObject->node())->contentFrame()) {
Frame* frame = toHTMLFrameOwnerElement(layoutObject->node())->contentFrame();
if (frame->isRemoteFrame()) {
@@ -542,10 +555,24 @@ bool CompositedLayerMapping::updateGraphicsLayerConfiguration()
} else if (layoutObject->isVideo()) {
HTMLMediaElement* mediaElement = toHTMLMediaElement(layoutObject->node());
m_graphicsLayer->setContentsToPlatformLayer(mediaElement->platformLayer());
+ // FIXME: correctly handle the video element source color space rather than assuming sRGB as is done here.
+ if (imageColorProfilesEnabled()) {
+ transform = createColorSpaceFilter(screenColorProfile(ScreenDevice::sRGB).get(), screenColorProfile(currentScreenId()).get());
+ m_graphicsLayer->setContentsLayerColorTransform(colorSpaceFlattenableFilter(transform.get()));
+ fprintf(stderr, "drawing video layer\n");
+ fflush(stderr);
+ }
} else if (isAcceleratedCanvas(layoutObject)) {
HTMLCanvasElement* canvas = toHTMLCanvasElement(layoutObject->node());
- if (CanvasRenderingContext* context = canvas->renderingContext())
+ if (CanvasRenderingContext* context = canvas->renderingContext()) {
m_graphicsLayer->setContentsToPlatformLayer(context->platformLayer());
+ if (imageColorProfilesEnabled()) {
+ transform = createColorSpaceFilter(screenColorProfile(ScreenDevice::sRGB).get(), screenColorProfile(currentScreenId()).get());
+ m_graphicsLayer->setContentsLayerColorTransform(colorSpaceFlattenableFilter(transform.get()));
+ fprintf(stderr, "drawing canvas layer\n");
+ fflush(stderr);
+ }
+ }
layerConfigChanged = true;
}
if (layoutObject->isLayoutPart()) {
@@ -1955,6 +1982,8 @@ void CompositedLayerMapping::updateImageContents()
if (!image)
return;
+ WillPaintForDevice device(Page::screenId(layoutObject()->frame()->page()));
+
// This is a no-op if the layer doesn't have an inner layer for the image.
m_graphicsLayer->setContentsToImage(image, LayoutObject::shouldRespectImageOrientation(imageLayoutObject));
@@ -2342,6 +2371,9 @@ void CompositedLayerMapping::paintContents(const GraphicsLayer* graphicsLayer, G
{
// https://code.google.com/p/chromium/issues/detail?id=343772
DisableCompositingQueryAsserts disabler;
+
+ WillPaintForDevice device(Page::screenId(layoutObject()->frame()->page()));
+
#if ENABLE(ASSERT)
// FIXME: once the state machine is ready, this can be removed and we can refer to that instead.
if (Page* page = layoutObject()->frame()->page())
@@ -2397,7 +2429,9 @@ void CompositedLayerMapping::paintContents(const GraphicsLayer* graphicsLayer, G
ScrollableAreaPainter(*m_owningLayer.scrollableArea()).paintScrollCorner(context, -scrollCornerAndResizerLocation, cullRect);
ScrollableAreaPainter(*m_owningLayer.scrollableArea()).paintResizer(context, -scrollCornerAndResizerLocation, cullRect);
}
+
InspectorInstrumentation::didPaint(m_owningLayer.layoutObject(), graphicsLayer, context, LayoutRect(interestRect));
+
#if ENABLE(ASSERT)
if (Page* page = layoutObject()->frame()->page())
page->setIsPainting(false);

Powered by Google App Engine
This is Rietveld 408576698