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

Side by Side Diff: third_party/WebKit/Source/core/layout/ImageQualityController.cpp

Issue 2899633002: Make EImageRendering an enum class. (Closed)
Patch Set: Rebase Created 3 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
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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 return g_image_quality_controller && 66 return g_image_quality_controller &&
67 g_image_quality_controller->object_layer_size_map_.Contains( 67 g_image_quality_controller->object_layer_size_map_.Contains(
68 &layout_object); 68 &layout_object);
69 } 69 }
70 70
71 InterpolationQuality ImageQualityController::ChooseInterpolationQuality( 71 InterpolationQuality ImageQualityController::ChooseInterpolationQuality(
72 const LayoutObject& object, 72 const LayoutObject& object,
73 Image* image, 73 Image* image,
74 const void* layer, 74 const void* layer,
75 const LayoutSize& layout_size) { 75 const LayoutSize& layout_size) {
76 if (object.Style()->ImageRendering() == kImageRenderingPixelated) 76 if (object.Style()->ImageRendering() == EImageRendering::kPixelated)
77 return kInterpolationNone; 77 return kInterpolationNone;
78 78
79 if (kInterpolationDefault == kInterpolationLow) 79 if (kInterpolationDefault == kInterpolationLow)
80 return kInterpolationLow; 80 return kInterpolationLow;
81 81
82 if (ShouldPaintAtLowQuality(object, image, layer, layout_size, 82 if (ShouldPaintAtLowQuality(object, image, layer, layout_size,
83 object.GetFrameView() 83 object.GetFrameView()
84 ->GetPage() 84 ->GetPage()
85 ->GetChromeClient() 85 ->GetChromeClient()
86 .LastFrameTimeMonotonic())) 86 .LastFrameTimeMonotonic()))
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 const LayoutSize& layout_size, 172 const LayoutSize& layout_size,
173 double last_frame_time_monotonic) { 173 double last_frame_time_monotonic) {
174 // If the image is not a bitmap image, then none of this is relevant and we 174 // If the image is not a bitmap image, then none of this is relevant and we
175 // just paint at high quality. 175 // just paint at high quality.
176 if (!image || !image->IsBitmapImage()) 176 if (!image || !image->IsBitmapImage())
177 return false; 177 return false;
178 178
179 if (!layer) 179 if (!layer)
180 return false; 180 return false;
181 181
182 if (object.Style()->ImageRendering() == kImageRenderingOptimizeContrast) 182 if (object.Style()->ImageRendering() == EImageRendering::kOptimizeContrast)
183 return true; 183 return true;
184 184
185 if (LocalFrame* frame = object.GetFrame()) { 185 if (LocalFrame* frame = object.GetFrame()) {
186 if (frame->GetSettings() && 186 if (frame->GetSettings() &&
187 frame->GetSettings()->GetUseDefaultImageInterpolationQuality()) 187 frame->GetSettings()->GetUseDefaultImageInterpolationQuality())
188 return false; 188 return false;
189 } 189 }
190 190
191 // Look ourselves up in the hashtables. 191 // Look ourselves up in the hashtables.
192 ObjectLayerSizeMap::iterator i = object_layer_size_map_.find(&object); 192 ObjectLayerSizeMap::iterator i = object_layer_size_map_.find(&object);
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 } 238 }
239 // This object has been resized to two different sizes while the timer 239 // This object has been resized to two different sizes while the timer
240 // is active, so draw at low quality, set the flag for animated resizes and 240 // is active, so draw at low quality, set the flag for animated resizes and
241 // the object to the list for high quality redraw. 241 // the object to the list for high quality redraw.
242 Set(object, inner_map, layer, layout_size, true); 242 Set(object, inner_map, layer, layout_size, true);
243 RestartTimer(last_frame_time_monotonic); 243 RestartTimer(last_frame_time_monotonic);
244 return true; 244 return true;
245 } 245 }
246 246
247 } // namespace blink 247 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698