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