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

Side by Side Diff: Source/core/rendering/RenderBoxModelObject.cpp

Issue 201513003: Implement InterpolationMedium to filter animated images (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: only ode change Created 6 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) 4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com)
5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) 5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com)
6 * Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
7 * Copyright (C) 2010 Google Inc. All rights reserved. 7 * Copyright (C) 2010 Google Inc. All rights reserved.
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 return; 93 return;
94 94
95 layer()->contentChanged(changeType); 95 layer()->contentChanged(changeType);
96 } 96 }
97 97
98 bool RenderBoxModelObject::hasAcceleratedCompositing() const 98 bool RenderBoxModelObject::hasAcceleratedCompositing() const
99 { 99 {
100 return view()->compositor()->hasAcceleratedCompositing(); 100 return view()->compositor()->hasAcceleratedCompositing();
101 } 101 }
102 102
103 bool RenderBoxModelObject::shouldPaintAtLowQuality(GraphicsContext* context, Ima ge* image, const void* layer, const LayoutSize& size) 103 InterpolationQuality RenderBoxModelObject::chooseInterpolationQuality(GraphicsCo ntext* context, Image* image, const void* layer, const LayoutSize& size)
104 { 104 {
105 return ImageQualityController::imageQualityController()->shouldPaintAtLowQua lity(context, this, image, layer, size); 105 return ImageQualityController::imageQualityController()->chooseInterpolation Quality(context, this, image, layer, size);
106 } 106 }
107 107
108 RenderBoxModelObject::RenderBoxModelObject(ContainerNode* node) 108 RenderBoxModelObject::RenderBoxModelObject(ContainerNode* node)
109 : RenderLayerModelObject(node) 109 : RenderLayerModelObject(node)
110 { 110 {
111 } 111 }
112 112
113 RenderBoxModelObject::~RenderBoxModelObject() 113 RenderBoxModelObject::~RenderBoxModelObject()
114 { 114 {
115 ImageQualityController::remove(this); 115 ImageQualityController::remove(this);
(...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after
695 695
696 // no progressive loading of the background image 696 // no progressive loading of the background image
697 if (shouldPaintBackgroundImage) { 697 if (shouldPaintBackgroundImage) {
698 BackgroundImageGeometry geometry; 698 BackgroundImageGeometry geometry;
699 calculateBackgroundImageGeometry(bgLayer, scrolledPaintRect, geometry, b ackgroundObject); 699 calculateBackgroundImageGeometry(bgLayer, scrolledPaintRect, geometry, b ackgroundObject);
700 geometry.clip(paintInfo.rect); 700 geometry.clip(paintInfo.rect);
701 if (!geometry.destRect().isEmpty()) { 701 if (!geometry.destRect().isEmpty()) {
702 CompositeOperator compositeOp = op == CompositeSourceOver ? bgLayer- >composite() : op; 702 CompositeOperator compositeOp = op == CompositeSourceOver ? bgLayer- >composite() : op;
703 RenderObject* clientForBackgroundImage = backgroundObject ? backgrou ndObject : this; 703 RenderObject* clientForBackgroundImage = backgroundObject ? backgrou ndObject : this;
704 RefPtr<Image> image = bgImage->image(clientForBackgroundImage, geome try.tileSize()); 704 RefPtr<Image> image = bgImage->image(clientForBackgroundImage, geome try.tileSize());
705 bool useLowQualityScaling = shouldPaintAtLowQuality(context, image.g et(), bgLayer, geometry.tileSize()); 705 InterpolationQuality interpolationQuality = chooseInterpolationQuali ty(context, image.get(), bgLayer, geometry.tileSize());
706 if (bgLayer->maskSourceType() == MaskLuminance) 706 if (bgLayer->maskSourceType() == MaskLuminance)
707 context->setColorFilter(ColorFilterLuminanceToAlpha); 707 context->setColorFilter(ColorFilterLuminanceToAlpha);
708 InterpolationQuality previousInterpolationQuality = context->imageIn terpolationQuality();
709 context->setImageInterpolationQuality(interpolationQuality);
708 context->drawTiledImage(image.get(), geometry.destRect(), geometry.r elativePhase(), geometry.tileSize(), 710 context->drawTiledImage(image.get(), geometry.destRect(), geometry.r elativePhase(), geometry.tileSize(),
709 compositeOp, useLowQualityScaling, bgLayer->blendMode(), geometr y.spaceSize()); 711 compositeOp, bgLayer->blendMode(), geometry.spaceSize());
712 context->setImageInterpolationQuality(previousInterpolationQuality);
710 } 713 }
711 } 714 }
712 715
713 if (bgLayer->clip() == TextFillBox) { 716 if (bgLayer->clip() == TextFillBox) {
714 // Create the text mask layer. 717 // Create the text mask layer.
715 context->setCompositeOperation(CompositeDestinationIn); 718 context->setCompositeOperation(CompositeDestinationIn);
716 context->beginTransparencyLayer(1); 719 context->beginTransparencyLayer(1);
717 720
718 // FIXME: Workaround for https://code.google.com/p/skia/issues/detail?id =1291. 721 // FIXME: Workaround for https://code.google.com/p/skia/issues/detail?id =1291.
719 context->clearRect(maskRect); 722 context->clearRect(maskRect);
(...skipping 2086 matching lines...) Expand 10 before | Expand all | Expand 10 after
2806 ASSERT(!beforeChild || toBoxModelObject == beforeChild->parent()); 2809 ASSERT(!beforeChild || toBoxModelObject == beforeChild->parent());
2807 for (RenderObject* child = startChild; child && child != endChild; ) { 2810 for (RenderObject* child = startChild; child && child != endChild; ) {
2808 // Save our next sibling as moveChildTo will clear it. 2811 // Save our next sibling as moveChildTo will clear it.
2809 RenderObject* nextSibling = child->nextSibling(); 2812 RenderObject* nextSibling = child->nextSibling();
2810 moveChildTo(toBoxModelObject, child, beforeChild, fullRemoveInsert); 2813 moveChildTo(toBoxModelObject, child, beforeChild, fullRemoveInsert);
2811 child = nextSibling; 2814 child = nextSibling;
2812 } 2815 }
2813 } 2816 }
2814 2817
2815 } // namespace WebCore 2818 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderBoxModelObject.h ('k') | Source/core/rendering/RenderHTMLCanvas.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698