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

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: Don't add 'pixelated' to devtools. 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 = style()->imageRendering() == Ima geRenderingOptimizeContrast ? InterpolationLow : CanvasDefaultInterpolationQuali ty;
71
72 // FIXME: This ImageRenderingPixelated should only be InterpolationNone when
73 // upscaling. It should be the same as ImageRenderingAuto when downscaling.
74 // See crbug.com/386944.
75 if (style()->imageRendering() == ImageRenderingPixelated)
76 interpolationQuality = InterpolationNone;
77
71 InterpolationQuality previousInterpolationQuality = context->imageInterpolat ionQuality(); 78 InterpolationQuality previousInterpolationQuality = context->imageInterpolat ionQuality();
72 context->setImageInterpolationQuality(interpolationQuality); 79 context->setImageInterpolationQuality(interpolationQuality);
73 toHTMLCanvasElement(node())->paint(context, paintRect); 80 toHTMLCanvasElement(node())->paint(context, paintRect);
74 context->setImageInterpolationQuality(previousInterpolationQuality); 81 context->setImageInterpolationQuality(previousInterpolationQuality);
75 82
76 if (clip) 83 if (clip)
77 context->restore(); 84 context->restore();
78 } 85 }
79 86
80 void RenderHTMLCanvas::canvasSizeChanged() 87 void RenderHTMLCanvas::canvasSizeChanged()
(...skipping 28 matching lines...) Expand all
109 return CompositingReasonNone; 116 return CompositingReasonNone;
110 117
111 HTMLCanvasElement* canvas = toHTMLCanvasElement(node()); 118 HTMLCanvasElement* canvas = toHTMLCanvasElement(node());
112 if (canvas->renderingContext() && canvas->renderingContext()->isAccelerated( )) 119 if (canvas->renderingContext() && canvas->renderingContext()->isAccelerated( ))
113 return CompositingReasonCanvas; 120 return CompositingReasonCanvas;
114 121
115 return CompositingReasonNone; 122 return CompositingReasonNone;
116 } 123 }
117 124
118 } // namespace WebCore 125 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/rendering/ImageQualityController.cpp ('k') | Source/core/rendering/style/RenderStyleConstants.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698