Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(987)

Side by Side Diff: Source/core/paint/BoxPainter.cpp

Issue 1025563002: Make body element background image use correct interpolation quality. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/core/paint/BoxPainter.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 435 matching lines...) Expand 10 before | Expand all | Expand 10 after
446 // no progressive loading of the background image 446 // no progressive loading of the background image
447 if (shouldPaintBackgroundImage) { 447 if (shouldPaintBackgroundImage) {
448 BackgroundImageGeometry geometry; 448 BackgroundImageGeometry geometry;
449 calculateBackgroundImageGeometry(obj, paintInfo.paintContainer(), bgLaye r, scrolledPaintRect, geometry, backgroundObject); 449 calculateBackgroundImageGeometry(obj, paintInfo.paintContainer(), bgLaye r, scrolledPaintRect, geometry, backgroundObject);
450 if (!geometry.destRect().isEmpty()) { 450 if (!geometry.destRect().isEmpty()) {
451 SkXfermode::Mode bgOp = WebCoreCompositeToSkiaComposite(bgLayer.comp osite(), bgLayer.blendMode()); 451 SkXfermode::Mode bgOp = WebCoreCompositeToSkiaComposite(bgLayer.comp osite(), bgLayer.blendMode());
452 // if op != SkXfermode::kSrcOver_Mode, a mask is being painted. 452 // if op != SkXfermode::kSrcOver_Mode, a mask is being painted.
453 SkXfermode::Mode compositeOp = op == SkXfermode::kSrcOver_Mode ? bgO p : op; 453 SkXfermode::Mode compositeOp = op == SkXfermode::kSrcOver_Mode ? bgO p : op;
454 LayoutObject* clientForBackgroundImage = backgroundObject ? backgrou ndObject : &obj; 454 LayoutObject* 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, LayoutSize(geometry.tileSize())); 456 InterpolationQuality interpolationQuality = chooseInterpolationQuali ty(*clientForBackgroundImage, context, image.get(), &bgLayer, LayoutSize(geometr y.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 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "PaintI mage", "data", InspectorPaintImageEvent::data(obj, *bgImage)); 461 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "PaintI mage", "data", InspectorPaintImageEvent::data(obj, *bgImage));
462 context->drawTiledImage(image.get(), geometry.destRect(), geometry.p hase(), geometry.tileSize(), 462 context->drawTiledImage(image.get(), geometry.destRect(), geometry.p hase(), geometry.tileSize(),
463 compositeOp, geometry.spaceSize()); 463 compositeOp, geometry.spaceSize());
464 context->setImageInterpolationQuality(previousInterpolationQuality); 464 context->setImageInterpolationQuality(previousInterpolationQuality);
465 } 465 }
466 } 466 }
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
781 geometry.setNoRepeatY(top + yOffset); 781 geometry.setNoRepeatY(top + yOffset);
782 geometry.setSpaceSize(IntSize(geometry.spaceSize().width(), 0)); 782 geometry.setSpaceSize(IntSize(geometry.spaceSize().width(), 0));
783 } 783 }
784 784
785 if (fixedAttachment) 785 if (fixedAttachment)
786 geometry.useFixedAttachment(snappedPaintRect.location()); 786 geometry.useFixedAttachment(snappedPaintRect.location());
787 787
788 geometry.clip(snappedPaintRect); 788 geometry.clip(snappedPaintRect);
789 } 789 }
790 790
791 InterpolationQuality BoxPainter::chooseInterpolationQuality(LayoutBoxModelObject & obj, GraphicsContext* context, Image* image, const void* layer, const LayoutSi ze& size) 791 InterpolationQuality BoxPainter::chooseInterpolationQuality(LayoutObject& obj, G raphicsContext* context, Image* image, const void* layer, const LayoutSize& size )
792 { 792 {
793 return ImageQualityController::imageQualityController()->chooseInterpolation Quality(context, &obj, image, layer, size); 793 return ImageQualityController::imageQualityController()->chooseInterpolation Quality(context, &obj, image, layer, size);
794 } 794 }
795 795
796 bool BoxPainter::fixedBackgroundPaintsInLocalCoordinates(const LayoutObject& obj ) 796 bool BoxPainter::fixedBackgroundPaintsInLocalCoordinates(const LayoutObject& obj )
797 { 797 {
798 if (!obj.isDocumentElement()) 798 if (!obj.isDocumentElement())
799 return false; 799 return false;
800 800
801 if (obj.view()->frameView() && obj.view()->frameView()->paintBehavior() & Pa intBehaviorFlattenCompositingLayers) 801 if (obj.view()->frameView() && obj.view()->frameView()->paintBehavior() & Pa intBehaviorFlattenCompositingLayers)
(...skipping 1401 matching lines...) Expand 10 before | Expand all | Expand 10 after
2203 2203
2204 FloatPoint secondQuad[4]; 2204 FloatPoint secondQuad[4];
2205 secondQuad[0] = quad[0]; 2205 secondQuad[0] = quad[0];
2206 secondQuad[1] = FloatPoint(quad[0].x() - r1 * cx, quad[0].y() - r1 * cy); 2206 secondQuad[1] = FloatPoint(quad[0].x() - r1 * cx, quad[0].y() - r1 * cy);
2207 secondQuad[2] = quad[2]; 2207 secondQuad[2] = quad[2];
2208 secondQuad[3] = quad[3]; 2208 secondQuad[3] = quad[3];
2209 graphicsContext->clipPolygon(4, secondQuad, !secondEdgeMatches); 2209 graphicsContext->clipPolygon(4, secondQuad, !secondEdgeMatches);
2210 } 2210 }
2211 2211
2212 } // namespace blink 2212 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/paint/BoxPainter.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698