Changeset 195848 in webkit
- Timestamp:
- Jan 29, 2016 3:15:58 PM (8 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 20 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r195838 r195848 1 2016-01-29 Simon Fraser <simon.fraser@apple.com> 2 3 image-rendering: -webkit-optimize-contrast not working for background images 4 https://bugs.webkit.org/show_bug.cgi?id=97991 5 6 Reviewed by Darin Adler. 7 8 * fast/images/image-rendering-interpolation-expected.html: Added. 9 * fast/images/image-rendering-interpolation.html: Added. 10 1 11 2016-01-29 Brady Eidson <beidson@apple.com> 2 12 -
trunk/Source/WebCore/ChangeLog
r195838 r195848 1 2016-01-29 Simon Fraser <simon.fraser@apple.com> 2 3 image-rendering: -webkit-optimize-contrast not working for background images 4 https://bugs.webkit.org/show_bug.cgi?id=97991 5 6 Reviewed by Darin Adler. 7 8 Don't equate "pixelated" and "crisp-edges" values for image-rendering with low 9 quality scaling; they should map to InterpolationNone, not InterpolationLow. 10 11 To support this change ImageQualityController to return a InterpolationQuality 12 from the renamed chooseInterpolationQuality(). If the returned value is not 13 InterpolationDefault, set the GraphicsContext image interpolation when drawing 14 images and image buffers. 15 16 Remove the redundant "useLowQualityScale" from 17 18 Test: fast/images/image-rendering-interpolation.html 19 20 * html/HTMLCanvasElement.cpp: 21 (WebCore::HTMLCanvasElement::paint): 22 * html/HTMLCanvasElement.h: 23 * page/DragController.cpp: 24 (WebCore::DragController::doImageDrag): 25 * platform/graphics/GraphicsContext.cpp: 26 (WebCore::GraphicsContext::drawImage): 27 (WebCore::GraphicsContext::drawTiledImage): 28 (WebCore::GraphicsContext::drawImageBuffer): 29 (WebCore::GraphicsContext::drawConsumingImageBuffer): 30 (WebCore::InterpolationQualityMaintainer::InterpolationQualityMaintainer): Deleted. 31 (WebCore::InterpolationQualityMaintainer::~InterpolationQualityMaintainer): Deleted. 32 * platform/graphics/GraphicsContext.h: 33 (WebCore::ImagePaintingOptions::ImagePaintingOptions): 34 (WebCore::ImagePaintingOptions::usesDefaultInterpolation): 35 (WebCore::InterpolationQualityMaintainer::InterpolationQualityMaintainer): 36 (WebCore::InterpolationQualityMaintainer::~InterpolationQualityMaintainer): 37 * platform/graphics/GraphicsTypes.h: 38 * platform/graphics/ImageBuffer.h: 39 * platform/graphics/cg/ImageBufferCG.cpp: 40 (WebCore::ImageBuffer::drawConsuming): 41 (WebCore::ImageBuffer::draw): 42 * rendering/ImageQualityController.cpp: 43 (WebCore::ImageQualityController::interpolationQualityFromStyle): 44 (WebCore::ImageQualityController::chooseInterpolationQuality): 45 (WebCore::ImageQualityController::ImageQualityController): Deleted. 46 (WebCore::ImageQualityController::shouldPaintAtLowQuality): Deleted. 47 * rendering/ImageQualityController.h: 48 * rendering/RenderBoxModelObject.cpp: 49 (WebCore::RenderBoxModelObject::chooseInterpolationQuality): 50 (WebCore::RenderBoxModelObject::paintFillLayerExtended): 51 (WebCore::RenderBoxModelObject::shouldPaintAtLowQuality): Deleted. 52 * rendering/RenderBoxModelObject.h: 53 * rendering/RenderEmbeddedObject.cpp: 54 (WebCore::RenderEmbeddedObject::paintSnapshotImage): 55 * rendering/RenderHTMLCanvas.cpp: 56 (WebCore::RenderHTMLCanvas::paintReplaced): 57 * rendering/RenderImage.cpp: 58 (WebCore::RenderImage::paintIntoRect): 59 * rendering/RenderSnapshottedPlugIn.cpp: 60 (WebCore::RenderSnapshottedPlugIn::paintSnapshot): 61 * rendering/style/RenderStyle.h: 62 1 63 2016-01-29 Brady Eidson <beidson@apple.com> 2 64 -
trunk/Source/WebCore/html/HTMLCanvasElement.cpp
r195646 r195848 404 404 405 405 406 void HTMLCanvasElement::paint(GraphicsContext& context, const LayoutRect& r , bool useLowQualityScale)406 void HTMLCanvasElement::paint(GraphicsContext& context, const LayoutRect& r) 407 407 { 408 408 // Clear the dirty rect … … 427 427 orientationDescription.setImageOrientationEnum(renderer()->style().imageOrientation()); 428 428 #endif 429 context.drawImage(*m_presentedImage, snappedIntRect(r), ImagePaintingOptions(orientationDescription , useLowQualityScale));429 context.drawImage(*m_presentedImage, snappedIntRect(r), ImagePaintingOptions(orientationDescription)); 430 430 } else 431 context.drawImageBuffer(*imageBuffer, snappedIntRect(r) , useLowQualityScale);431 context.drawImageBuffer(*imageBuffer, snappedIntRect(r)); 432 432 } 433 433 } -
trunk/Source/WebCore/html/HTMLCanvasElement.h
r195646 r195848 110 110 void notifyObserversCanvasChanged(const FloatRect&); 111 111 112 void paint(GraphicsContext&, const LayoutRect& , bool useLowQualityScale = false);112 void paint(GraphicsContext&, const LayoutRect&); 113 113 114 114 GraphicsContext* drawingContext() const; -
trunk/Source/WebCore/page/DragController.cpp
r194496 r195848 936 936 return; 937 937 938 ImageOrientationDescription orientationDescription(element.renderer()->shouldRespectImageOrientation()); 939 #if ENABLE(CSS_IMAGE_ORIENTATION) 940 orientationDescription.setImageOrientationEnum(element.renderer()->style().imageOrientation()); 941 #endif 938 ImageOrientationDescription orientationDescription(element.renderer()->shouldRespectImageOrientation(), element.renderer()->style().imageOrientation()); 942 939 943 940 Image* image = getImage(element); -
trunk/Source/WebCore/platform/graphics/GraphicsContext.cpp
r195415 r195848 78 78 }; 79 79 80 class InterpolationQualityMaintainer {81 public:82 explicit InterpolationQualityMaintainer(GraphicsContext& graphicsContext, InterpolationQuality interpolationQualityToUse)83 : m_graphicsContext(graphicsContext)84 , m_currentInterpolationQuality(graphicsContext.imageInterpolationQuality())85 , m_interpolationQualityChanged(m_currentInterpolationQuality != interpolationQualityToUse)86 {87 if (m_interpolationQualityChanged)88 m_graphicsContext.setImageInterpolationQuality(interpolationQualityToUse);89 }90 91 ~InterpolationQualityMaintainer()92 {93 if (m_interpolationQualityChanged)94 m_graphicsContext.setImageInterpolationQuality(m_currentInterpolationQuality);95 }96 97 private:98 GraphicsContext& m_graphicsContext;99 InterpolationQuality m_currentInterpolationQuality;100 bool m_interpolationQualityChanged;101 };102 103 104 80 #define CHECK_FOR_CHANGED_PROPERTY(flag, property) \ 105 81 if ((m_changeFlags & GraphicsContextState::flag) && (m_state.property != state.property)) \ … … 768 744 } 769 745 770 InterpolationQualityMaintainer interpolationQualityForThisScope(*this, imagePaintingOptions.m_ useLowQualityScale ? InterpolationLow : imageInterpolationQuality());746 InterpolationQualityMaintainer interpolationQualityForThisScope(*this, imagePaintingOptions.m_interpolationQuality); 771 747 image.draw(*this, destination, source, imagePaintingOptions.m_compositeOperator, imagePaintingOptions.m_blendMode, imagePaintingOptions.m_orientationDescription); 772 748 } … … 782 758 } 783 759 784 InterpolationQualityMaintainer interpolationQualityForThisScope(*this, imagePaintingOptions.m_ useLowQualityScale ? InterpolationLow : imageInterpolationQuality());760 InterpolationQualityMaintainer interpolationQualityForThisScope(*this, imagePaintingOptions.m_interpolationQuality); 785 761 image.drawTiled(*this, destination, source, tileSize, spacing, imagePaintingOptions.m_compositeOperator, imagePaintingOptions.m_blendMode); 786 762 } … … 803 779 } 804 780 805 InterpolationQualityMaintainer interpolationQualityForThisScope(*this, imagePaintingOptions.m_ useLowQualityScale ? InterpolationLow : imageInterpolationQuality());781 InterpolationQualityMaintainer interpolationQualityForThisScope(*this, imagePaintingOptions.m_interpolationQuality); 806 782 image.drawTiled(*this, destination, source, tileScaleFactor, hRule, vRule, imagePaintingOptions.m_compositeOperator); 807 783 } … … 822 798 return; 823 799 824 InterpolationQualityMaintainer interpolationQualityForThisScope(*this, imagePaintingOptions.m_ useLowQualityScale ? InterpolationLow : imageInterpolationQuality());825 image.draw(*this, destination, source, imagePaintingOptions.m_compositeOperator, imagePaintingOptions.m_blendMode , imagePaintingOptions.m_useLowQualityScale);800 InterpolationQualityMaintainer interpolationQualityForThisScope(*this, imagePaintingOptions.m_interpolationQuality); 801 image.draw(*this, destination, source, imagePaintingOptions.m_compositeOperator, imagePaintingOptions.m_blendMode); 826 802 } 827 803 … … 847 823 return; 848 824 849 InterpolationQualityMaintainer interpolationQualityForThisScope(*this, imagePaintingOptions.m_useLowQualityScale ? InterpolationLow : imageInterpolationQuality()); 850 851 ImageBuffer::drawConsuming(WTFMove(image), *this, destination, source, imagePaintingOptions.m_compositeOperator, imagePaintingOptions.m_blendMode, imagePaintingOptions.m_useLowQualityScale); 825 InterpolationQualityMaintainer interpolationQualityForThisScope(*this, imagePaintingOptions.m_interpolationQuality); 826 ImageBuffer::drawConsuming(WTFMove(image), *this, destination, source, imagePaintingOptions.m_compositeOperator, imagePaintingOptions.m_blendMode); 852 827 } 853 828 -
trunk/Source/WebCore/platform/graphics/GraphicsContext.h
r195170 r195848 101 101 DoubleStroke, 102 102 WavyStroke, 103 };104 105 enum InterpolationQuality {106 InterpolationDefault,107 InterpolationNone,108 InterpolationLow,109 InterpolationMedium,110 InterpolationHigh111 103 }; 112 104 … … 195 187 196 188 struct ImagePaintingOptions { 197 ImagePaintingOptions(CompositeOperator compositeOperator = CompositeSourceOver, BlendMode blendMode = BlendModeNormal, ImageOrientationDescription orientationDescription = ImageOrientationDescription(), bool useLowQualityScale = false)189 ImagePaintingOptions(CompositeOperator compositeOperator = CompositeSourceOver, BlendMode blendMode = BlendModeNormal, ImageOrientationDescription orientationDescription = ImageOrientationDescription(), InterpolationQuality interpolationQuality = InterpolationDefault) 198 190 : m_compositeOperator(compositeOperator) 199 191 , m_blendMode(blendMode) 200 192 , m_orientationDescription(orientationDescription) 201 , m_ useLowQualityScale(useLowQualityScale)202 { 203 } 204 205 ImagePaintingOptions(ImageOrientationDescription orientationDescription, bool useLowQualityScale = false, CompositeOperator compositeOperator = CompositeSourceOver, BlendMode blendMode = BlendModeNormal)193 , m_interpolationQuality(interpolationQuality) 194 { 195 } 196 197 ImagePaintingOptions(ImageOrientationDescription orientationDescription, InterpolationQuality interpolationQuality = InterpolationDefault, CompositeOperator compositeOperator = CompositeSourceOver, BlendMode blendMode = BlendModeNormal) 206 198 : m_compositeOperator(compositeOperator) 207 199 , m_blendMode(blendMode) 208 200 , m_orientationDescription(orientationDescription) 209 , m_ useLowQualityScale(useLowQualityScale)210 { 211 } 212 213 ImagePaintingOptions( bool useLowQualityScale, ImageOrientationDescription orientationDescription = ImageOrientationDescription(), CompositeOperator compositeOperator = CompositeSourceOver, BlendMode blendMode = BlendModeNormal)201 , m_interpolationQuality(interpolationQuality) 202 { 203 } 204 205 ImagePaintingOptions(InterpolationQuality interpolationQuality, ImageOrientationDescription orientationDescription = ImageOrientationDescription(), CompositeOperator compositeOperator = CompositeSourceOver, BlendMode blendMode = BlendModeNormal) 214 206 : m_compositeOperator(compositeOperator) 215 207 , m_blendMode(blendMode) 216 208 , m_orientationDescription(orientationDescription) 217 , m_useLowQualityScale(useLowQualityScale) 218 { 219 } 209 , m_interpolationQuality(interpolationQuality) 210 { 211 } 212 213 bool usesDefaultInterpolation() const { return m_interpolationQuality == InterpolationDefault; } 220 214 221 215 CompositeOperator m_compositeOperator; 222 216 BlendMode m_blendMode; 223 217 ImageOrientationDescription m_orientationDescription; 224 bool m_useLowQualityScale;218 InterpolationQuality m_interpolationQuality; 225 219 }; 226 220 … … 658 652 }; 659 653 654 class InterpolationQualityMaintainer { 655 public: 656 explicit InterpolationQualityMaintainer(GraphicsContext& graphicsContext, InterpolationQuality interpolationQualityToUse) 657 : m_graphicsContext(graphicsContext) 658 , m_currentInterpolationQuality(graphicsContext.imageInterpolationQuality()) 659 , m_interpolationQualityChanged(interpolationQualityToUse != InterpolationDefault && m_currentInterpolationQuality != interpolationQualityToUse) 660 { 661 if (m_interpolationQualityChanged) 662 m_graphicsContext.setImageInterpolationQuality(interpolationQualityToUse); 663 } 664 665 explicit InterpolationQualityMaintainer(GraphicsContext& graphicsContext, Optional<InterpolationQuality> interpolationQuality) 666 : InterpolationQualityMaintainer(graphicsContext, interpolationQuality ? interpolationQuality.value() : graphicsContext.imageInterpolationQuality()) 667 { 668 } 669 670 ~InterpolationQualityMaintainer() 671 { 672 if (m_interpolationQualityChanged) 673 m_graphicsContext.setImageInterpolationQuality(m_currentInterpolationQuality); 674 } 675 676 private: 677 GraphicsContext& m_graphicsContext; 678 InterpolationQuality m_currentInterpolationQuality; 679 bool m_interpolationQualityChanged; 680 }; 681 660 682 } // namespace WebCore 661 683 -
trunk/Source/WebCore/platform/graphics/GraphicsTypes.h
r191310 r195848 76 76 }; 77 77 78 enum InterpolationQuality { 79 InterpolationDefault, 80 InterpolationNone, 81 InterpolationLow, 82 InterpolationMedium, 83 InterpolationHigh 84 }; 85 78 86 enum LineCap { ButtCap, RoundCap, SquareCap }; 79 87 -
trunk/Source/WebCore/platform/graphics/ImageBuffer.h
r194630 r195848 143 143 #endif 144 144 145 void draw(GraphicsContext&, const FloatRect& destRect, const FloatRect& srcRect = FloatRect(0, 0, -1, -1), CompositeOperator = CompositeSourceOver, BlendMode = BlendModeNormal , bool useLowQualityScale = false);145 void draw(GraphicsContext&, const FloatRect& destRect, const FloatRect& srcRect = FloatRect(0, 0, -1, -1), CompositeOperator = CompositeSourceOver, BlendMode = BlendModeNormal); 146 146 void drawPattern(GraphicsContext&, const FloatRect& srcRect, const AffineTransform& patternTransform, const FloatPoint& phase, const FloatSize& spacing, CompositeOperator, const FloatRect& destRect, BlendMode = BlendModeNormal); 147 147 148 static void drawConsuming(std::unique_ptr<ImageBuffer>, GraphicsContext&, const FloatRect& destRect, const FloatRect& srcRect = FloatRect(0, 0, -1, -1), CompositeOperator = CompositeSourceOver, BlendMode = BlendModeNormal , bool useLowQualityScale = false);148 static void drawConsuming(std::unique_ptr<ImageBuffer>, GraphicsContext&, const FloatRect& destRect, const FloatRect& srcRect = FloatRect(0, 0, -1, -1), CompositeOperator = CompositeSourceOver, BlendMode = BlendModeNormal); 149 149 150 150 inline void genericConvertToLuminanceMask(); -
trunk/Source/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp
r194630 r195848 215 215 } 216 216 217 void ImageBuffer::drawConsuming(std::unique_ptr<ImageBuffer> imageBuffer, GraphicsContext& destContext, const FloatRect& destRect, const FloatRect& srcRect, CompositeOperator op, BlendMode blendMode , bool useLowQualityScale)218 { 219 imageBuffer->draw(destContext, destRect, srcRect, op, blendMode , useLowQualityScale);217 void ImageBuffer::drawConsuming(std::unique_ptr<ImageBuffer> imageBuffer, GraphicsContext& destContext, const FloatRect& destRect, const FloatRect& srcRect, CompositeOperator op, BlendMode blendMode) 218 { 219 imageBuffer->draw(destContext, destRect, srcRect, op, blendMode); 220 220 } 221 221 222 222 void ImageBuffer::draw(GraphicsContext& destinationContext, const FloatRect& destRect, const FloatRect& srcRect, 223 CompositeOperator op, BlendMode blendMode , bool useLowQualityScale)223 CompositeOperator op, BlendMode blendMode) 224 224 { 225 225 BackingStoreCopy copyMode = &destinationContext == &context() ? CopyBackingStore : DontCopyBackingStore; 226 226 RefPtr<Image> image = copyImage(copyMode); 227 destinationContext.drawImage(*image, destRect, srcRect, ImagePaintingOptions(op, blendMode, ImageOrientationDescription() , useLowQualityScale));227 destinationContext.drawImage(*image, destRect, srcRect, ImagePaintingOptions(op, blendMode, ImageOrientationDescription())); 228 228 } 229 229 -
trunk/Source/WebCore/platform/graphics/cg/ImageBufferCG.cpp
r195452 r195848 265 265 } 266 266 267 void ImageBuffer::drawConsuming(std::unique_ptr<ImageBuffer> imageBuffer, GraphicsContext& destContext, const FloatRect& destRect, const FloatRect& srcRect, CompositeOperator op, BlendMode blendMode , bool useLowQualityScale)267 void ImageBuffer::drawConsuming(std::unique_ptr<ImageBuffer> imageBuffer, GraphicsContext& destContext, const FloatRect& destRect, const FloatRect& srcRect, CompositeOperator op, BlendMode blendMode) 268 268 { 269 269 #if USE(IOSURFACE_CANVAS_BACKING_STORE) 270 270 if (!imageBuffer->m_data.surface) { 271 imageBuffer->draw(destContext, destRect, srcRect, op, blendMode , useLowQualityScale);271 imageBuffer->draw(destContext, destRect, srcRect, op, blendMode); 272 272 return; 273 273 } … … 284 284 destContext.drawNativeImage(image.get(), backingStoreSize, destRect, adjustedSrcRect, op, blendMode); 285 285 #else 286 imageBuffer->draw(destContext, destRect, srcRect, op, blendMode , useLowQualityScale);287 #endif 288 } 289 290 void ImageBuffer::draw(GraphicsContext& destContext, const FloatRect& destRect, const FloatRect& srcRect, CompositeOperator op, BlendMode blendMode , bool)286 imageBuffer->draw(destContext, destRect, srcRect, op, blendMode); 287 #endif 288 } 289 290 void ImageBuffer::draw(GraphicsContext& destContext, const FloatRect& destRect, const FloatRect& srcRect, CompositeOperator op, BlendMode blendMode) 291 291 { 292 292 RetainPtr<CGImageRef> image; -
trunk/Source/WebCore/rendering/ImageQualityController.cpp
r195699 r195848 41 41 : m_renderView(renderView) 42 42 , m_timer(*this, &ImageQualityController::highQualityRepaintTimerFired) 43 , m_animatedResizeIsActive(false)44 , m_liveResizeOptimizationIsActive(false)45 43 { 46 44 } … … 100 98 } 101 99 102 bool ImageQualityController::shouldPaintAtLowQuality(GraphicsContext& context, RenderBoxModelObject* object, Image& image, const void *layer, const LayoutSize& size)100 Optional<InterpolationQuality> ImageQualityController::interpolationQualityFromStyle(const RenderStyle& style) 103 101 { 104 // If the image is not a bitmap image, then none of this is relevant and we just paint at high 105 // quality. 106 if (!(image.isBitmapImage() || image.isPDFDocumentImage()) || context.paintingDisabled()) 107 return false; 108 109 switch (object->style().imageRendering()) { 102 switch (style.imageRendering()) { 110 103 case ImageRenderingOptimizeSpeed: 104 return InterpolationLow; 111 105 case ImageRenderingCrispEdges: 112 106 case ImageRenderingPixelated: 113 return true;107 return InterpolationNone; 114 108 case ImageRenderingOptimizeQuality: 115 return false; // FIXME: CSS 3 Images says that optimizeQuality should behave like 'auto', but that prevents authors from overriding this low quality rendering behavior.109 return InterpolationDefault; // FIXME: CSS 3 Images says that optimizeQuality should behave like 'auto', but that prevents authors from overriding this low quality rendering behavior. 116 110 case ImageRenderingAuto: 117 111 break; 118 112 } 113 return Nullopt; 114 } 115 116 InterpolationQuality ImageQualityController::chooseInterpolationQuality(GraphicsContext& context, RenderBoxModelObject* object, Image& image, const void *layer, const LayoutSize& size) 117 { 118 // If the image is not a bitmap image, then none of this is relevant and we just paint at high quality. 119 if (!(image.isBitmapImage() || image.isPDFDocumentImage()) || context.paintingDisabled()) 120 return InterpolationDefault; 121 122 if (Optional<InterpolationQuality> styleInterpolation = interpolationQualityFromStyle(object->style())) 123 return styleInterpolation.value(); 119 124 120 125 // Make sure to use the unzoomed image size, since if a full page zoom is in effect, the image … … 142 147 restartTimer(); 143 148 m_liveResizeOptimizationIsActive = true; 144 return true;149 return InterpolationLow; 145 150 } 146 151 if (m_liveResizeOptimizationIsActive) 147 return false;152 return InterpolationDefault; 148 153 } 149 154 … … 153 158 // There is no scale in effect. If we had a scale in effect before, we can just remove this object from the list. 154 159 removeLayer(object, innerMap, layer); 155 return false;160 return InterpolationDefault; 156 161 } 157 162 … … 160 165 double totalPixels = static_cast<double>(image.width()) * static_cast<double>(image.height()); 161 166 if (totalPixels > cInterpolationCutoff) 162 return true;167 return InterpolationLow; 163 168 } 164 169 … … 167 172 set(object, innerMap, layer, size); 168 173 restartTimer(); 169 return true;174 return InterpolationLow; 170 175 } 171 176 // If this is the first time resizing this image, or its size is the … … 175 180 restartTimer(); 176 181 set(object, innerMap, layer, size); 177 return false;182 return InterpolationDefault; 178 183 } 179 184 // If the timer is no longer active, draw at high quality and don't … … 181 186 if (!m_timer.isActive()) { 182 187 removeLayer(object, innerMap, layer); 183 return false;188 return InterpolationDefault; 184 189 } 185 190 // This object has been resized to two different sizes while the timer … … 189 194 m_animatedResizeIsActive = true; 190 195 restartTimer(); 191 return true;196 return InterpolationLow; 192 197 } 193 198 -
trunk/Source/WebCore/rendering/ImageQualityController.h
r191049 r195848 27 27 #define ImageQualityController_h 28 28 29 #include "GraphicsTypes.h" 29 30 #include "Timer.h" 30 31 #include <wtf/HashMap.h> 32 #include <wtf/Optional.h> 31 33 32 34 namespace WebCore { 33 35 34 class Frame;35 36 class GraphicsContext; 36 37 class Image; … … 38 39 class RenderBoxModelObject; 39 40 class RenderView; 41 class RenderStyle; 40 42 41 43 class ImageQualityController { … … 44 46 explicit ImageQualityController(const RenderView&); 45 47 46 bool shouldPaintAtLowQuality(GraphicsContext&, RenderBoxModelObject*, Image&, const void* layer, const LayoutSize&); 48 static Optional<InterpolationQuality> interpolationQualityFromStyle(const RenderStyle&); 49 InterpolationQuality chooseInterpolationQuality(GraphicsContext&, RenderBoxModelObject*, Image&, const void* layer, const LayoutSize&); 50 47 51 void rendererWillBeDestroyed(RenderBoxModelObject& renderer) { removeObject(&renderer); } 48 52 … … 60 64 ObjectLayerSizeMap m_objectLayerSizeMap; 61 65 Timer m_timer; 62 bool m_animatedResizeIsActive ;63 bool m_liveResizeOptimizationIsActive ;66 bool m_animatedResizeIsActive { false }; 67 bool m_liveResizeOptimizationIsActive { false }; 64 68 }; 65 69 -
trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp
r195170 r195848 160 160 ASSERT(isComposited()); 161 161 layer()->backing()->suspendAnimations(time); 162 }163 164 bool RenderBoxModelObject::shouldPaintAtLowQuality(GraphicsContext& context, Image& image, const void* layer, const LayoutSize& size)165 {166 return view().imageQualityController().shouldPaintAtLowQuality(context, this, image, layer, size);167 162 } 168 163 … … 595 590 } 596 591 592 InterpolationQuality RenderBoxModelObject::chooseInterpolationQuality(GraphicsContext& context, Image& image, const void* layer, const LayoutSize& size) 593 { 594 return view().imageQualityController().chooseInterpolationQuality(context, this, image, layer, size); 595 } 596 597 597 void RenderBoxModelObject::paintMaskForTextFillBox(ImageBuffer* maskImage, const IntRect& maskRect, InlineFlowBox* box, const LayoutRect& scrolledPaintRect) 598 598 { … … 835 835 CompositeOperator compositeOp = op == CompositeSourceOver ? bgLayer->composite() : op; 836 836 context.setDrawLuminanceMask(bgLayer->maskSourceType() == MaskLuminance); 837 bool useLowQualityScaling = shouldPaintAtLowQuality(context, *image, bgLayer, geometry.tileSize()); 838 context.drawTiledImage(*image, geometry.destRect(), toLayoutPoint(geometry.relativePhase()), geometry.tileSize(), geometry.spaceSize(), ImagePaintingOptions(compositeOp, bgLayer->blendMode(), ImageOrientationDescription(), useLowQualityScaling)); 837 838 InterpolationQuality interpolation = chooseInterpolationQuality(context, *image, bgLayer, geometry.tileSize()); 839 context.drawTiledImage(*image, geometry.destRect(), toLayoutPoint(geometry.relativePhase()), geometry.tileSize(), geometry.spaceSize(), ImagePaintingOptions(compositeOp, bgLayer->blendMode(), ImageOrientationDescription(), interpolation)); 839 840 } 840 841 } -
trunk/Source/WebCore/rendering/RenderBoxModelObject.h
r194417 r195848 252 252 LayoutRect borderInnerRectAdjustedForBleedAvoidance(const GraphicsContext&, const LayoutRect&, BackgroundBleedAvoidance) const; 253 253 254 bool shouldPaintAtLowQuality(GraphicsContext&, Image&, const void*, const LayoutSize&);254 InterpolationQuality chooseInterpolationQuality(GraphicsContext&, Image&, const void*, const LayoutSize&); 255 255 256 256 RenderBoxModelObject* continuation() const; -
trunk/Source/WebCore/rendering/RenderEmbeddedObject.cpp
r194496 r195848 215 215 return; 216 216 217 bool useLowQualityScaling = shouldPaintAtLowQuality(context, image, &image, alignedRect.size()); 218 ImageOrientationDescription orientationDescription(shouldRespectImageOrientation()); 219 #if ENABLE(CSS_IMAGE_ORIENTATION) 220 orientationDescription.setImageOrientationEnum(style().imageOrientation()); 221 #endif 222 context.drawImage(image, alignedRect, ImagePaintingOptions(orientationDescription, useLowQualityScaling)); 217 InterpolationQuality interpolation = chooseInterpolationQuality(context, image, &image, alignedRect.size()); 218 ImageOrientationDescription orientationDescription(shouldRespectImageOrientation(), style().imageOrientation()); 219 context.drawImage(image, alignedRect, ImagePaintingOptions(orientationDescription, interpolation)); 223 220 } 224 221 -
trunk/Source/WebCore/rendering/RenderHTMLCanvas.cpp
r195699 r195848 34 34 #include "HTMLCanvasElement.h" 35 35 #include "HTMLNames.h" 36 #include "ImageQualityController.h" 36 37 #include "Page.h" 37 38 #include "PaintInfo.h" … … 85 86 } 86 87 87 bool useLowQualityScale = style().imageRendering() == ImageRenderingCrispEdges || style().imageRendering() == ImageRenderingPixelated || style().imageRendering() == ImageRenderingOptimizeSpeed;88 canvasElement().paint(context, replacedContentRect , useLowQualityScale);88 InterpolationQualityMaintainer interpolationMaintainer(context, ImageQualityController::interpolationQualityFromStyle(style())); 89 canvasElement().paint(context, replacedContentRect); 89 90 } 90 91 -
trunk/Source/WebCore/rendering/RenderImage.cpp
r194496 r195848 548 548 HTMLImageElement* imageElement = is<HTMLImageElement>(element()) ? downcast<HTMLImageElement>(element()) : nullptr; 549 549 CompositeOperator compositeOperator = imageElement ? imageElement->compositeOperator() : CompositeSourceOver; 550 551 // FIXME: Document when image != img.get(). 550 552 Image* image = imageResource().image().get(); 551 bool useLowQualityScaling = image && shouldPaintAtLowQuality(context, *image, image, LayoutSize(rect.size())); 552 ImageOrientationDescription orientationDescription(shouldRespectImageOrientation()); 553 #if ENABLE(CSS_IMAGE_ORIENTATION) 554 orientationDescription.setImageOrientationEnum(style().imageOrientation()); 555 #endif 556 context.drawImage(*img, rect, 557 ImagePaintingOptions(compositeOperator, BlendModeNormal, orientationDescription, useLowQualityScaling)); 553 InterpolationQuality interpolation = image ? chooseInterpolationQuality(context, *image, image, LayoutSize(rect.size())) : InterpolationDefault; 554 555 ImageOrientationDescription orientationDescription(shouldRespectImageOrientation(), style().imageOrientation()); 556 context.drawImage(*img, rect, ImagePaintingOptions(compositeOperator, BlendModeNormal, orientationDescription, interpolation)); 558 557 } 559 558 -
trunk/Source/WebCore/rendering/RenderSnapshottedPlugIn.cpp
r194496 r195848 136 136 return; 137 137 138 bool useLowQualityScaling = shouldPaintAtLowQuality(context, *image, image, alignedRect.size()); 139 140 ImageOrientationDescription orientationDescription(shouldRespectImageOrientation()); 141 #if ENABLE(CSS_IMAGE_ORIENTATION) 142 orientationDescription.setImageOrientationEnum(style().imageOrientation()); 143 #endif 144 context.drawImage(*image, alignedRect, ImagePaintingOptions(orientationDescription, useLowQualityScaling)); 138 InterpolationQuality interpolation = chooseInterpolationQuality(context, *image, image, alignedRect.size()); 139 ImageOrientationDescription orientationDescription(shouldRespectImageOrientation(), style().imageOrientation()); 140 context.drawImage(*image, alignedRect, ImagePaintingOptions(orientationDescription, interpolation)); 145 141 } 146 142 -
trunk/Source/WebCore/rendering/style/RenderStyle.h
r195577 r195848 1164 1164 bool isFlippedBlocksWritingMode() const { return WebCore::isFlippedWritingMode(writingMode()); } 1165 1165 1166 ImageOrientationEnum imageOrientation() const 1167 { 1166 1168 #if ENABLE(CSS_IMAGE_ORIENTATION) 1167 ImageOrientationEnum imageOrientation() const { return static_cast<ImageOrientationEnum>(rareInheritedData->m_imageOrientation); } 1168 #endif 1169 return static_cast<ImageOrientationEnum>(rareInheritedData->m_imageOrientation); 1170 #else 1171 return DefaultImageOrientation; 1172 #endif 1173 } 1169 1174 1170 1175 EImageRendering imageRendering() const { return static_cast<EImageRendering>(rareInheritedData->m_imageRendering); }
Note: See TracChangeset
for help on using the changeset viewer.