| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "config.h" | 5 #include "config.h" |
| 6 #include "core/paint/BoxPainter.h" | 6 #include "core/paint/BoxPainter.h" |
| 7 | 7 |
| 8 #include "core/HTMLNames.h" | 8 #include "core/HTMLNames.h" |
| 9 #include "core/frame/Settings.h" | 9 #include "core/frame/Settings.h" |
| 10 #include "core/html/HTMLFrameOwnerElement.h" | 10 #include "core/html/HTMLFrameOwnerElement.h" |
| (...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 451 calculateBackgroundImageGeometry(obj, paintInfo.paintContainer(), bgLaye
r, scrolledPaintRect, geometry, backgroundObject); | 451 calculateBackgroundImageGeometry(obj, paintInfo.paintContainer(), bgLaye
r, scrolledPaintRect, geometry, backgroundObject); |
| 452 if (!geometry.destRect().isEmpty()) { | 452 if (!geometry.destRect().isEmpty()) { |
| 453 CompositeOperator compositeOp = op == CompositeSourceOver ? bgLayer.
composite() : op; | 453 CompositeOperator compositeOp = op == CompositeSourceOver ? bgLayer.
composite() : op; |
| 454 RenderObject* clientForBackgroundImage = backgroundObject ? backgrou
ndObject : &obj; | 454 RenderObject* clientForBackgroundImage = backgroundObject ? backgrou
ndObject : &obj; |
| 455 RefPtr<Image> image = bgImage->image(clientForBackgroundImage, geome
try.tileSize()); | 455 RefPtr<Image> image = bgImage->image(clientForBackgroundImage, geome
try.tileSize()); |
| 456 InterpolationQuality interpolationQuality = chooseInterpolationQuali
ty(obj, context, image.get(), &bgLayer, geometry.tileSize()); | 456 InterpolationQuality interpolationQuality = chooseInterpolationQuali
ty(obj, context, image.get(), &bgLayer, geometry.tileSize()); |
| 457 if (bgLayer.maskSourceType() == MaskLuminance) | 457 if (bgLayer.maskSourceType() == MaskLuminance) |
| 458 context->setColorFilter(ColorFilterLuminanceToAlpha); | 458 context->setColorFilter(ColorFilterLuminanceToAlpha); |
| 459 InterpolationQuality previousInterpolationQuality = context->imageIn
terpolationQuality(); | 459 InterpolationQuality previousInterpolationQuality = context->imageIn
terpolationQuality(); |
| 460 context->setImageInterpolationQuality(interpolationQuality); | 460 context->setImageInterpolationQuality(interpolationQuality); |
| 461 context->drawTiledImage(image.get(), geometry.destRect(), geometry.r
elativePhase(), geometry.tileSize(), | 461 context->drawTiledImage(image.get(), geometry.destRect(), geometry.p
hase(), geometry.tileSize(), |
| 462 compositeOp, bgLayer.blendMode(), geometry.spaceSize()); | 462 compositeOp, bgLayer.blendMode(), geometry.spaceSize()); |
| 463 context->setImageInterpolationQuality(previousInterpolationQuality); | 463 context->setImageInterpolationQuality(previousInterpolationQuality); |
| 464 } | 464 } |
| 465 } | 465 } |
| 466 | 466 |
| 467 if (bgLayer.clip() == TextFillBox) { | 467 if (bgLayer.clip() == TextFillBox) { |
| 468 // Create the text mask layer. | 468 // Create the text mask layer. |
| 469 context->setCompositeOperation(CompositeDestinationIn); | 469 context->setCompositeOperation(CompositeDestinationIn); |
| 470 context->beginTransparencyLayer(1); | 470 context->beginTransparencyLayer(1); |
| 471 | 471 |
| (...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 764 if (backgroundRepeatY == NoRepeatFill) { | 764 if (backgroundRepeatY == NoRepeatFill) { |
| 765 int yOffset = fillLayer.backgroundYOrigin() == BottomEdge ? availableHei
ght - computedYPosition : computedYPosition; | 765 int yOffset = fillLayer.backgroundYOrigin() == BottomEdge ? availableHei
ght - computedYPosition : computedYPosition; |
| 766 geometry.setNoRepeatY(top + yOffset); | 766 geometry.setNoRepeatY(top + yOffset); |
| 767 geometry.setSpaceSize(IntSize(geometry.spaceSize().width(), 0)); | 767 geometry.setSpaceSize(IntSize(geometry.spaceSize().width(), 0)); |
| 768 } | 768 } |
| 769 | 769 |
| 770 if (fixedAttachment) | 770 if (fixedAttachment) |
| 771 geometry.useFixedAttachment(snappedPaintRect.location()); | 771 geometry.useFixedAttachment(snappedPaintRect.location()); |
| 772 | 772 |
| 773 geometry.clip(snappedPaintRect); | 773 geometry.clip(snappedPaintRect); |
| 774 geometry.setDestOrigin(geometry.destRect().location()); | |
| 775 } | 774 } |
| 776 | 775 |
| 777 InterpolationQuality BoxPainter::chooseInterpolationQuality(RenderBoxModelObject
& obj, GraphicsContext* context, Image* image, const void* layer, const LayoutSi
ze& size) | 776 InterpolationQuality BoxPainter::chooseInterpolationQuality(RenderBoxModelObject
& obj, GraphicsContext* context, Image* image, const void* layer, const LayoutSi
ze& size) |
| 778 { | 777 { |
| 779 return ImageQualityController::imageQualityController()->chooseInterpolation
Quality(context, &obj, image, layer, size); | 778 return ImageQualityController::imageQualityController()->chooseInterpolation
Quality(context, &obj, image, layer, size); |
| 780 } | 779 } |
| 781 | 780 |
| 782 bool BoxPainter::fixedBackgroundPaintsInLocalCoordinates(const RenderObject& obj
) | 781 bool BoxPainter::fixedBackgroundPaintsInLocalCoordinates(const RenderObject& obj
) |
| 783 { | 782 { |
| 784 if (!obj.isDocumentElement()) | 783 if (!obj.isDocumentElement()) |
| (...skipping 1361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2146 | 2145 |
| 2147 FloatPoint secondQuad[4]; | 2146 FloatPoint secondQuad[4]; |
| 2148 secondQuad[0] = quad[0]; | 2147 secondQuad[0] = quad[0]; |
| 2149 secondQuad[1] = FloatPoint(quad[0].x() - r1 * cx, quad[0].y() - r1 * cy); | 2148 secondQuad[1] = FloatPoint(quad[0].x() - r1 * cx, quad[0].y() - r1 * cy); |
| 2150 secondQuad[2] = quad[2]; | 2149 secondQuad[2] = quad[2]; |
| 2151 secondQuad[3] = quad[3]; | 2150 secondQuad[3] = quad[3]; |
| 2152 graphicsContext->clipConvexPolygon(4, secondQuad, !secondEdgeMatches); | 2151 graphicsContext->clipConvexPolygon(4, secondQuad, !secondEdgeMatches); |
| 2153 } | 2152 } |
| 2154 | 2153 |
| 2155 } // namespace blink | 2154 } // namespace blink |
| OLD | NEW |