|
Lines 397-403
IntSize ShadowBlur::blurredEdgeSize() const
a/Source/WebCore/platform/graphics/ShadowBlur.cpp_sec1
|
| 397 |
return edgeSize; |
397 |
return edgeSize; |
| 398 |
} |
398 |
} |
| 399 |
|
399 |
|
| 400 |
IntRect ShadowBlur::calculateLayerBoundingRect(GraphicsContext* context, const FloatRect& shadowedRect, const IntRect& clipRect) |
400 |
bool ShadowBlur::useScaledBlurLayer(GraphicsContext* context) |
|
|
401 |
{ |
| 402 |
const AffineTransform transform = context->getCTM(); |
| 403 |
if (m_shadowsIgnoreTransforms && !transform.isIdentity() && transform.xScale() < 1 && transform.yScale() < 1) |
| 404 |
return true; |
| 405 |
|
| 406 |
return false; |
| 407 |
} |
| 408 |
|
| 409 |
IntRect ShadowBlur::calculateLayerBoundingRect(GraphicsContext* context, const FloatRect& shadowedRect, const IntRect& clipRect, const bool scaledBlurLayer) |
| 401 |
{ |
410 |
{ |
| 402 |
IntSize edgeSize = blurredEdgeSize(); |
411 |
IntSize edgeSize = blurredEdgeSize(); |
| 403 |
|
412 |
|
|
Lines 405-412
IntRect ShadowBlur::calculateLayerBoundingRect(GraphicsContext* context, const F
a/Source/WebCore/platform/graphics/ShadowBlur.cpp_sec2
|
| 405 |
FloatRect layerRect; |
414 |
FloatRect layerRect; |
| 406 |
IntSize inflation; |
415 |
IntSize inflation; |
| 407 |
|
416 |
|
| 408 |
const AffineTransform transform = context->getCTM(); |
417 |
AffineTransform transform = context->getCTM(); |
| 409 |
if (m_shadowsIgnoreTransforms && !transform.isIdentity()) { |
418 |
if (m_shadowsIgnoreTransforms && !transform.isIdentity()) { |
|
|
419 |
if (scaledBlurLayer) |
| 420 |
transform.scale(1 / transform.xScale(), 1 / transform.yScale()); |
| 410 |
FloatQuad transformedPolygon = transform.mapQuad(FloatQuad(shadowedRect)); |
421 |
FloatQuad transformedPolygon = transform.mapQuad(FloatQuad(shadowedRect)); |
| 411 |
transformedPolygon.move(m_offset); |
422 |
transformedPolygon.move(m_offset); |
| 412 |
layerRect = transform.inverse().mapQuad(transformedPolygon).boundingBox(); |
423 |
layerRect = transform.inverse().mapQuad(transformedPolygon).boundingBox(); |
|
Lines 885-893
void ShadowBlur::blurAndColorShadowBuffer(const IntSize& templateSize)
a/Source/WebCore/platform/graphics/ShadowBlur.cpp_sec3
|
| 885 |
|
896 |
|
| 886 |
GraphicsContext* ShadowBlur::beginShadowLayer(GraphicsContext *context, const FloatRect& layerArea) |
897 |
GraphicsContext* ShadowBlur::beginShadowLayer(GraphicsContext *context, const FloatRect& layerArea) |
| 887 |
{ |
898 |
{ |
| 888 |
adjustBlurRadius(context); |
899 |
FloatRect scaledLayerArea = layerArea; |
|
|
900 |
bool scaledBlurLayer = useScaledBlurLayer(context); |
| 901 |
const AffineTransform transform = context->getCTM(); |
| 902 |
if (scaledBlurLayer) |
| 903 |
scaledLayerArea.scale(static_cast<float>(transform.xScale()), static_cast<float>(transform.yScale())); |
| 904 |
else |
| 905 |
adjustBlurRadius(context); |
| 889 |
|
906 |
|
| 890 |
IntRect layerRect = calculateLayerBoundingRect(context, layerArea, context->clipBounds()); |
907 |
IntRect layerRect = calculateLayerBoundingRect(context, scaledLayerArea, context->clipBounds(), scaledBlurLayer); |
| 891 |
|
908 |
|
| 892 |
if (layerRect.isEmpty()) |
909 |
if (layerRect.isEmpty()) |
| 893 |
return 0; |
910 |
return 0; |
|
Lines 904-909
GraphicsContext* ShadowBlur::beginShadowLayer(GraphicsContext *context, const Fl
a/Source/WebCore/platform/graphics/ShadowBlur.cpp_sec4
|
| 904 |
shadowContext->clearRect(FloatRect(0, 0, m_layerSize.width() + 1, m_layerSize.height() + 1)); |
921 |
shadowContext->clearRect(FloatRect(0, 0, m_layerSize.width() + 1, m_layerSize.height() + 1)); |
| 905 |
|
922 |
|
| 906 |
shadowContext->translate(m_layerContextTranslation); |
923 |
shadowContext->translate(m_layerContextTranslation); |
|
|
924 |
|
| 925 |
if (scaledBlurLayer) |
| 926 |
shadowContext->scale(FloatSize(static_cast<float>(transform.xScale()), static_cast<float>(transform.yScale()))); |
| 927 |
|
| 907 |
return shadowContext; |
928 |
return shadowContext; |
| 908 |
} |
929 |
} |
| 909 |
|
930 |
|
|
Lines 914-919
void ShadowBlur::endShadowLayer(GraphicsContext* context)
a/Source/WebCore/platform/graphics/ShadowBlur.cpp_sec5
|
| 914 |
blurAndColorShadowBuffer(expandedIntSize(m_layerSize)); |
935 |
blurAndColorShadowBuffer(expandedIntSize(m_layerSize)); |
| 915 |
GraphicsContextStateSaver stateSave(*context); |
936 |
GraphicsContextStateSaver stateSave(*context); |
| 916 |
|
937 |
|
|
|
938 |
if (useScaledBlurLayer(context)) { |
| 939 |
AffineTransform transform = context->getCTM(); |
| 940 |
context->scale(FloatSize(1 / static_cast<float>(transform.xScale()), 1 / static_cast<float>(transform.yScale()))); |
| 941 |
} |
| 917 |
context->clearShadow(); |
942 |
context->clearShadow(); |
| 918 |
context->drawImageBuffer(m_layerImage, ColorSpaceDeviceRGB, roundedIntPoint(m_layerOrigin), IntRect(0, 0, m_layerSize.width(), m_layerSize.height()), context->compositeOperation()); |
943 |
context->drawImageBuffer(m_layerImage, ColorSpaceDeviceRGB, roundedIntPoint(m_layerOrigin), IntRect(0, 0, m_layerSize.width(), m_layerSize.height()), context->compositeOperation()); |
| 919 |
|
944 |
|