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

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

Issue 754083003: Make image-rendering:pixelated use nearest neighbor when downscaling. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Sync and rebase Created 6 years 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
« no previous file with comments | « Source/core/paint/HTMLCanvasPainter.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google 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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 } 60 }
61 } 61 }
62 62
63 bool ImageQualityController::has(RenderObject* renderer) 63 bool ImageQualityController::has(RenderObject* renderer)
64 { 64 {
65 return gImageQualityController && gImageQualityController->m_objectLayerSize Map.contains(renderer); 65 return gImageQualityController && gImageQualityController->m_objectLayerSize Map.contains(renderer);
66 } 66 }
67 67
68 InterpolationQuality ImageQualityController::chooseInterpolationQuality(Graphics Context* context, RenderObject* object, Image* image, const void* layer, const L ayoutSize& layoutSize) 68 InterpolationQuality ImageQualityController::chooseInterpolationQuality(Graphics Context* context, RenderObject* object, Image* image, const void* layer, const L ayoutSize& layoutSize)
69 { 69 {
70 if (object->style()->imageRendering() == ImageRenderingPixelated 70 if (object->style()->imageRendering() == ImageRenderingPixelated)
71 && image
72 && (layoutSize.width() > image->width() || layoutSize.height() > image-> height() || layoutSize == image->size())) {
73 return InterpolationNone; 71 return InterpolationNone;
74 }
75 72
76 if (InterpolationDefault == InterpolationLow) 73 if (InterpolationDefault == InterpolationLow)
77 return InterpolationLow; 74 return InterpolationLow;
78 75
79 if (shouldPaintAtLowQuality(context, object, image, layer, layoutSize)) 76 if (shouldPaintAtLowQuality(context, object, image, layer, layoutSize))
80 return InterpolationLow; 77 return InterpolationLow;
81 78
82 // For images that are potentially animated we paint them at medium quality. 79 // For images that are potentially animated we paint them at medium quality.
83 if (image && image->maybeAnimated()) 80 if (image && image->maybeAnimated())
84 return InterpolationMedium; 81 return InterpolationMedium;
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 // This object has been resized to two different sizes while the timer 229 // This object has been resized to two different sizes while the timer
233 // is active, so draw at low quality, set the flag for animated resizes and 230 // is active, so draw at low quality, set the flag for animated resizes and
234 // the object to the list for high quality redraw. 231 // the object to the list for high quality redraw.
235 set(object, innerMap, layer, scaledLayoutSize); 232 set(object, innerMap, layer, scaledLayoutSize);
236 m_animatedResizeIsActive = true; 233 m_animatedResizeIsActive = true;
237 restartTimer(); 234 restartTimer();
238 return true; 235 return true;
239 } 236 }
240 237
241 } // namespace blink 238 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/paint/HTMLCanvasPainter.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698