Chromium Code Reviews| Index: Source/platform/graphics/GraphicsLayer.cpp |
| diff --git a/Source/platform/graphics/GraphicsLayer.cpp b/Source/platform/graphics/GraphicsLayer.cpp |
| index 6129a2e721fe347b557996cbb58f8afa24fb1ea7..0e38ed9dbbec92a74490eb690eec60f3387afd9c 100644 |
| --- a/Source/platform/graphics/GraphicsLayer.cpp |
| +++ b/Source/platform/graphics/GraphicsLayer.cpp |
| @@ -31,8 +31,11 @@ |
| #include "SkMatrix44.h" |
| #include "platform/geometry/FloatRect.h" |
| #include "platform/geometry/LayoutRect.h" |
| +#include "platform/graphics/BitmapImage.h" |
| +#include "platform/graphics/GraphicsContext.h" |
| #include "platform/graphics/GraphicsLayerFactory.h" |
| #include "platform/graphics/Image.h" |
| +#include "platform/graphics/ImageBuffer.h" |
| #include "platform/graphics/filters/SkiaImageFilterBuilder.h" |
| #include "platform/graphics/skia/NativeImageSkia.h" |
| #include "platform/scroll/ScrollableArea.h" |
| @@ -1009,17 +1012,26 @@ void GraphicsLayer::setContentsToImage(Image* image) |
| m_imageLayer = adoptPtr(Platform::current()->compositorSupport()->createImageLayer()); |
| registerContentsLayer(m_imageLayer->layer()); |
| } |
| - m_imageLayer->setBitmap(nativeImage->bitmap()); |
| - m_imageLayer->layer()->setOpaque(image->currentFrameKnownToBeOpaque()); |
| + bool opaque = image->currentFrameKnownToBeOpaque(); |
| + if (image->isBitmapImage() && toBitmapImage(image)->colorProfile()) { |
| + // FIXME: paint-time color-correction is assumed here, and note that image |
| + // layers are the pathway to the GPU-based color correction. |
| + OwnPtr<ImageBuffer> buffer = ImageBuffer::create(image->size(), opaque ? Opaque : NonOpaque); |
|
Stephen White
2014/07/03 18:38:17
Rather than create an ImageBuffer here (incurring
|
| + buffer->context()->drawImage(image, IntPoint()); |
| + m_imageLayer->setBitmap(buffer->bitmap()); |
| + } else { |
| + m_imageLayer->setBitmap(nativeImage->bitmap()); |
| + } |
| + m_imageLayer->layer()->setOpaque(opaque); |
| updateContentsRect(); |
| + setContentsTo(m_imageLayer->layer()); |
| } else { |
| if (m_imageLayer) { |
| unregisterContentsLayer(m_imageLayer->layer()); |
| m_imageLayer.clear(); |
| + setContentsTo(0); |
| } |
| } |
| - |
| - setContentsTo(m_imageLayer ? m_imageLayer->layer() : 0); |
| } |
| void GraphicsLayer::setContentsToNinePatch(Image* image, const IntRect& aperture) |
| @@ -1206,7 +1218,6 @@ void GraphicsLayer::paint(GraphicsContext& context, const IntRect& clip) |
| paintGraphicsLayerContents(context, clip); |
| } |
| - |
| void GraphicsLayer::notifyAnimationStarted(double monotonicTime, WebAnimation::TargetProperty) |
| { |
| if (m_client) |