Bug 133407

Summary: Cleanup temporary setting of image interpolation quality in GraphicsContext::drawImage*
Product: WebKit Reporter: zalan <zalan>
Component: Layout and RenderingAssignee: zalan <zalan>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch none

Description zalan 2014-05-30 09:07:01 PDT
This is highly error prone with all the copy-paste code in GraphicsContext::drawImage, GraphicsContext::drawTiledImage, GraphicsContext::drawImageBuffer.

if (useLowQualityScale) {
       InterpolationQuality previousInterpolationQuality = imageInterpolationQuality();
       setImageInterpolationQuality(InterpolationNone);
       image->draw(this, styleColorSpace, dest, src, op, blendMode, useLowQualityScale);
       setImageInterpolationQuality(previousInterpolationQuality);
   } else
       image->draw(this, styleColorSpace, dest, src, op, blendMode, useLowQualityScale);
Comment 1 zalan 2014-05-30 12:43:13 PDT
Created attachment 232301 [details]
Patch
Comment 2 Darin Adler 2014-05-30 13:33:29 PDT
Comment on attachment 232301 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=232301&action=review

OK

> Source/WebCore/platform/graphics/GraphicsContext.cpp:98
> +    GraphicsContext* m_graphicsContext;

Should use a reference instead of a pointer.

> Source/WebCore/platform/graphics/GraphicsContext.cpp:100
> +    InterpolationQuality m_newInterpolationQuality;

Could just store a m_currentInterpolationQuality != m_newInterpolationQuality boolean instead.
Comment 3 zalan 2014-05-30 13:35:24 PDT
(In reply to comment #2)
> (From update of attachment 232301 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=232301&action=review
> 
> OK
> 
> > Source/WebCore/platform/graphics/GraphicsContext.cpp:98
> > +    GraphicsContext* m_graphicsContext;
> 
> Should use a reference instead of a pointer.
> 
> > Source/WebCore/platform/graphics/GraphicsContext.cpp:100
> > +    InterpolationQuality m_newInterpolationQuality;
> 
> Could just store a m_currentInterpolationQuality != m_newInterpolationQuality boolean instead.
Good point! I'll do that.
Comment 4 zalan 2014-05-30 14:27:55 PDT
Created attachment 232303 [details]
Patch
Comment 5 zalan 2014-05-30 14:28:09 PDT
Comment on attachment 232303 [details]
Patch

EWSing
Comment 6 WebKit Commit Bot 2014-05-30 16:03:42 PDT
Comment on attachment 232303 [details]
Patch

Clearing flags on attachment: 232303

Committed r169498: <http://trac.webkit.org/changeset/169498>
Comment 7 WebKit Commit Bot 2014-05-30 16:03:45 PDT
All reviewed patches have been landed.  Closing bug.