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

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

Issue 336693005: Add image-rendering: pixelated. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Update svg test Created 6 years, 6 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) 2004, 2006, 2007 Apple Inc. All rights reserved. 2 * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 60
61 bool clip = !contentRect.contains(paintRect); 61 bool clip = !contentRect.contains(paintRect);
62 if (clip) { 62 if (clip) {
63 // Not allowed to overflow the content box. 63 // Not allowed to overflow the content box.
64 paintInfo.context->save(); 64 paintInfo.context->save();
65 paintInfo.context->clip(pixelSnappedIntRect(contentRect)); 65 paintInfo.context->clip(pixelSnappedIntRect(contentRect));
66 } 66 }
67 67
68 // FIXME: InterpolationNone should be used if ImageRenderingOptimizeContrast is set. 68 // FIXME: InterpolationNone should be used if ImageRenderingOptimizeContrast is set.
69 // See bug for more details: crbug.com/353716. 69 // See bug for more details: crbug.com/353716.
70 InterpolationQuality interpolationQuality = style()->imageRendering() == Ima geRenderingOptimizeContrast ? InterpolationLow : CanvasDefaultInterpolationQuali ty; 70 InterpolationQuality interpolationQuality;
71 switch (style()->imageRendering()) {
72 case ImageRenderingOptimizeContrast:
73 interpolationQuality = InterpolationLow;
Mike Lawther (Google) 2014/06/20 04:26:50 These should really be the same, ie InterpolationN
jackhou 2014/06/20 07:14:44 Done.
jackhou 2014/06/20 08:35:42 I realized this would require updating all the tes
74 break;
75 case ImageRenderingPixelated:
76 interpolationQuality = InterpolationNone;
Mike Lawther (Google) 2014/06/20 04:26:50 Strictly according to spec, we only use nearest ne
jackhou 2014/06/20 07:14:44 Done.
77 break;
78 default:
79 interpolationQuality = CanvasDefaultInterpolationQuality;
80 }
81
71 InterpolationQuality previousInterpolationQuality = context->imageInterpolat ionQuality(); 82 InterpolationQuality previousInterpolationQuality = context->imageInterpolat ionQuality();
72 context->setImageInterpolationQuality(interpolationQuality); 83 context->setImageInterpolationQuality(interpolationQuality);
73 toHTMLCanvasElement(node())->paint(context, paintRect); 84 toHTMLCanvasElement(node())->paint(context, paintRect);
74 context->setImageInterpolationQuality(previousInterpolationQuality); 85 context->setImageInterpolationQuality(previousInterpolationQuality);
75 86
76 if (clip) 87 if (clip)
77 context->restore(); 88 context->restore();
78 } 89 }
79 90
80 void RenderHTMLCanvas::canvasSizeChanged() 91 void RenderHTMLCanvas::canvasSizeChanged()
(...skipping 28 matching lines...) Expand all
109 return CompositingReasonNone; 120 return CompositingReasonNone;
110 121
111 HTMLCanvasElement* canvas = toHTMLCanvasElement(node()); 122 HTMLCanvasElement* canvas = toHTMLCanvasElement(node());
112 if (canvas->renderingContext() && canvas->renderingContext()->isAccelerated( )) 123 if (canvas->renderingContext() && canvas->renderingContext()->isAccelerated( ))
113 return CompositingReasonCanvas; 124 return CompositingReasonCanvas;
114 125
115 return CompositingReasonNone; 126 return CompositingReasonNone;
116 } 127 }
117 128
118 } // namespace WebCore 129 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698