OLD | NEW |
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 21 matching lines...) Expand all Loading... |
32 #include "core/layout/ImageQualityController.h" | 32 #include "core/layout/ImageQualityController.h" |
33 | 33 |
34 #include "core/frame/FrameView.h" | 34 #include "core/frame/FrameView.h" |
35 #include "core/frame/LocalFrame.h" | 35 #include "core/frame/LocalFrame.h" |
36 #include "platform/graphics/GraphicsContext.h" | 36 #include "platform/graphics/GraphicsContext.h" |
37 | 37 |
38 namespace blink { | 38 namespace blink { |
39 | 39 |
40 static const double cLowQualityTimeThreshold = 0.500; // 500 ms | 40 static const double cLowQualityTimeThreshold = 0.500; // 500 ms |
41 | 41 |
42 static ImageQualityController* gImageQualityController = 0; | 42 static ImageQualityController* gImageQualityController = nullptr; |
43 | 43 |
44 ImageQualityController* ImageQualityController::imageQualityController() | 44 ImageQualityController* ImageQualityController::imageQualityController() |
45 { | 45 { |
46 if (!gImageQualityController) | 46 if (!gImageQualityController) |
47 gImageQualityController = new ImageQualityController; | 47 gImageQualityController = new ImageQualityController; |
48 | 48 |
49 return gImageQualityController; | 49 return gImageQualityController; |
50 } | 50 } |
51 | 51 |
52 void ImageQualityController::remove(LayoutObject* layoutObject) | 52 void ImageQualityController::remove(LayoutObject* layoutObject) |
53 { | 53 { |
54 if (gImageQualityController) { | 54 if (gImageQualityController) { |
55 gImageQualityController->objectDestroyed(layoutObject); | 55 gImageQualityController->objectDestroyed(layoutObject); |
56 if (gImageQualityController->isEmpty()) { | 56 if (gImageQualityController->isEmpty()) { |
57 delete gImageQualityController; | 57 delete gImageQualityController; |
58 gImageQualityController = 0; | 58 gImageQualityController = nullptr; |
59 } | 59 } |
60 } | 60 } |
61 } | 61 } |
62 | 62 |
63 bool ImageQualityController::has(LayoutObject* layoutObject) | 63 bool ImageQualityController::has(LayoutObject* layoutObject) |
64 { | 64 { |
65 return gImageQualityController && gImageQualityController->m_objectLayerSize
Map.contains(layoutObject); | 65 return gImageQualityController && gImageQualityController->m_objectLayerSize
Map.contains(layoutObject); |
66 } | 66 } |
67 | 67 |
68 InterpolationQuality ImageQualityController::chooseInterpolationQuality(Graphics
Context* context, LayoutObject* object, Image* image, const void* layer, const L
ayoutSize& layoutSize) | 68 InterpolationQuality ImageQualityController::chooseInterpolationQuality(Graphics
Context* context, LayoutObject* object, Image* image, const void* layer, const L
ayoutSize& layoutSize) |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 // This object has been resized to two different sizes while the timer | 228 // This object has been resized to two different sizes while the timer |
229 // is active, so draw at low quality, set the flag for animated resizes and | 229 // is active, so draw at low quality, set the flag for animated resizes and |
230 // the object to the list for high quality redraw. | 230 // the object to the list for high quality redraw. |
231 set(object, innerMap, layer, layoutSize); | 231 set(object, innerMap, layer, layoutSize); |
232 m_animatedResizeIsActive = true; | 232 m_animatedResizeIsActive = true; |
233 restartTimer(); | 233 restartTimer(); |
234 return true; | 234 return true; |
235 } | 235 } |
236 | 236 |
237 } // namespace blink | 237 } // namespace blink |
OLD | NEW |