| 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 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 457 } | 457 } |
| 458 } | 458 } |
| 459 | 459 |
| 460 // no progressive loading of the background image | 460 // no progressive loading of the background image |
| 461 if (shouldPaintBackgroundImage) { | 461 if (shouldPaintBackgroundImage) { |
| 462 if (!geometry.destRect().isEmpty()) { | 462 if (!geometry.destRect().isEmpty()) { |
| 463 SkXfermode::Mode bgOp = WebCoreCompositeToSkiaComposite(bgLayer.comp
osite(), bgLayer.blendMode()); | 463 SkXfermode::Mode bgOp = WebCoreCompositeToSkiaComposite(bgLayer.comp
osite(), bgLayer.blendMode()); |
| 464 // if op != SkXfermode::kSrcOver_Mode, a mask is being painted. | 464 // if op != SkXfermode::kSrcOver_Mode, a mask is being painted. |
| 465 SkXfermode::Mode compositeOp = op == SkXfermode::kSrcOver_Mode ? bgO
p : op; | 465 SkXfermode::Mode compositeOp = op == SkXfermode::kSrcOver_Mode ? bgO
p : op; |
| 466 const LayoutObject* clientForBackgroundImage = backgroundObject ? ba
ckgroundObject : &obj; | 466 const LayoutObject* clientForBackgroundImage = backgroundObject ? ba
ckgroundObject : &obj; |
| 467 RefPtr<Image> image = bgImage->image(clientForBackgroundImage, geome
try.imageContainerSize(), obj.style()->effectiveZoom()); | 467 RefPtr<Image> image = bgImage->image(clientForBackgroundImage, floor
edIntSize(geometry.imageContainerSize()), obj.style()->effectiveZoom()); |
| 468 InterpolationQuality interpolationQuality = chooseInterpolationQuali
ty(*clientForBackgroundImage, context, image.get(), &bgLayer, LayoutSize(geometr
y.tileSize())); | 468 InterpolationQuality interpolationQuality = chooseInterpolationQuali
ty(*clientForBackgroundImage, context, image.get(), &bgLayer, LayoutSize(geometr
y.tileSize())); |
| 469 if (bgLayer.maskSourceType() == MaskLuminance) | 469 if (bgLayer.maskSourceType() == MaskLuminance) |
| 470 context->setColorFilter(ColorFilterLuminanceToAlpha); | 470 context->setColorFilter(ColorFilterLuminanceToAlpha); |
| 471 InterpolationQuality previousInterpolationQuality = context->imageIn
terpolationQuality(); | 471 InterpolationQuality previousInterpolationQuality = context->imageIn
terpolationQuality(); |
| 472 context->setImageInterpolationQuality(interpolationQuality); | 472 context->setImageInterpolationQuality(interpolationQuality); |
| 473 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "PaintI
mage", "data", InspectorPaintImageEvent::data(obj, *bgImage)); | 473 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "PaintI
mage", "data", InspectorPaintImageEvent::data(obj, *bgImage)); |
| 474 context->drawTiledImage(image.get(), geometry.destRect(), geometry.p
hase(), geometry.tileSize(), | 474 context->drawTiledImage(image.get(), FloatRect(geometry.destRect()),
FloatPoint(geometry.phase()), FloatSize(geometry.tileSize()), |
| 475 compositeOp, geometry.spaceSize()); | 475 compositeOp, FloatSize(geometry.spaceSize())); |
| 476 context->setImageInterpolationQuality(previousInterpolationQuality); | 476 context->setImageInterpolationQuality(previousInterpolationQuality); |
| 477 } | 477 } |
| 478 } | 478 } |
| 479 | 479 |
| 480 if (bgLayer.clip() == TextFillBox) { | 480 if (bgLayer.clip() == TextFillBox) { |
| 481 // Create the text mask layer. | 481 // Create the text mask layer. |
| 482 context->beginLayer(1, SkXfermode::kDstIn_Mode); | 482 context->beginLayer(1, SkXfermode::kDstIn_Mode); |
| 483 | 483 |
| 484 // Now draw the text into the mask. We do this by painting using a speci
al paint phase that signals to | 484 // Now draw the text into the mask. We do this by painting using a speci
al paint phase that signals to |
| 485 // InlineTextBoxes that they should just add their contents to the clip. | 485 // InlineTextBoxes that they should just add their contents to the clip. |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 705 } | 705 } |
| 706 } | 706 } |
| 707 | 707 |
| 708 bool BoxPainter::shouldForceWhiteBackgroundForPrintEconomy(const ComputedStyle&
style, const Document& document) | 708 bool BoxPainter::shouldForceWhiteBackgroundForPrintEconomy(const ComputedStyle&
style, const Document& document) |
| 709 { | 709 { |
| 710 return document.printing() && style.printColorAdjust() == PrintColorAdjustEc
onomy | 710 return document.printing() && style.printColorAdjust() == PrintColorAdjustEc
onomy |
| 711 && (!document.settings() || !document.settings()->shouldPrintBackgrounds
()); | 711 && (!document.settings() || !document.settings()->shouldPrintBackgrounds
()); |
| 712 } | 712 } |
| 713 | 713 |
| 714 } // namespace blink | 714 } // namespace blink |
| OLD | NEW |