| 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 typedef HashMap<const void*, LayoutSize> LayerSizeMap; | 46 typedef HashMap<const void*, LayoutSize> LayerSizeMap; |
| 47 typedef HashMap<const LayoutObject*, LayerSizeMap> ObjectLayerSizeMap; | 47 typedef HashMap<const LayoutObject*, LayerSizeMap> ObjectLayerSizeMap; |
| 48 | 48 |
| 49 class CORE_EXPORT ImageQualityController final { | 49 class CORE_EXPORT ImageQualityController final { |
| 50 WTF_MAKE_NONCOPYABLE(ImageQualityController); USING_FAST_MALLOC(ImageQuality
Controller); | 50 WTF_MAKE_NONCOPYABLE(ImageQualityController); USING_FAST_MALLOC(ImageQuality
Controller); |
| 51 public: | 51 public: |
| 52 ~ImageQualityController(); | 52 ~ImageQualityController(); |
| 53 | 53 |
| 54 static ImageQualityController* imageQualityController(); | 54 static ImageQualityController* imageQualityController(); |
| 55 | 55 |
| 56 static void remove(LayoutObject*); | 56 static void remove(LayoutObject&); |
| 57 | 57 |
| 58 InterpolationQuality chooseInterpolationQuality(GraphicsContext*, const Layo
utObject*, Image*, const void* layer, const LayoutSize&); | 58 InterpolationQuality chooseInterpolationQuality(const LayoutObject&, Image*,
const void* layer, const LayoutSize&); |
| 59 | 59 |
| 60 private: | 60 private: |
| 61 ImageQualityController(); | 61 ImageQualityController(); |
| 62 | 62 |
| 63 static bool has(const LayoutObject*); | 63 static bool has(const LayoutObject&); |
| 64 void set(const LayoutObject*, LayerSizeMap* innerMap, const void* layer, con
st LayoutSize&); | 64 void set(const LayoutObject&, LayerSizeMap* innerMap, const void* layer, con
st LayoutSize&); |
| 65 | 65 |
| 66 bool shouldPaintAtLowQuality(GraphicsContext*, const LayoutObject*, Image*,
const void* layer, const LayoutSize&); | 66 bool shouldPaintAtLowQuality(const LayoutObject&, Image*, const void* layer,
const LayoutSize&); |
| 67 void removeLayer(const LayoutObject*, LayerSizeMap* innerMap, const void* la
yer); | 67 void removeLayer(const LayoutObject&, LayerSizeMap* innerMap, const void* la
yer); |
| 68 void objectDestroyed(const LayoutObject*); | 68 void objectDestroyed(const LayoutObject&); |
| 69 bool isEmpty() { return m_objectLayerSizeMap.isEmpty(); } | 69 bool isEmpty() { return m_objectLayerSizeMap.isEmpty(); } |
| 70 | 70 |
| 71 void highQualityRepaintTimerFired(Timer<ImageQualityController>*); | 71 void highQualityRepaintTimerFired(Timer<ImageQualityController>*); |
| 72 void restartTimer(); | 72 void restartTimer(); |
| 73 | 73 |
| 74 // Only for use in testing. | 74 // Only for use in testing. |
| 75 void setTimer(Timer<ImageQualityController>*); | 75 void setTimer(Timer<ImageQualityController>*); |
| 76 | 76 |
| 77 ObjectLayerSizeMap m_objectLayerSizeMap; | 77 ObjectLayerSizeMap m_objectLayerSizeMap; |
| 78 OwnPtr<Timer<ImageQualityController>> m_timer; | 78 OwnPtr<Timer<ImageQualityController>> m_timer; |
| 79 bool m_animatedResizeIsActive; | 79 bool m_animatedResizeIsActive; |
| 80 bool m_liveResizeOptimizationIsActive; | 80 bool m_liveResizeOptimizationIsActive; |
| 81 | 81 |
| 82 // For calling set(). | 82 // For calling set(). |
| 83 FRIEND_TEST_ALL_PREFIXES(LayoutPartTest, DestroyUpdatesImageQualityControlle
r); | 83 FRIEND_TEST_ALL_PREFIXES(LayoutPartTest, DestroyUpdatesImageQualityControlle
r); |
| 84 | 84 |
| 85 // For calling setTimer(), | 85 // For calling setTimer(), |
| 86 FRIEND_TEST_ALL_PREFIXES(ImageQualityControllerTest, LowQualityFilterForLive
Resize); | 86 FRIEND_TEST_ALL_PREFIXES(ImageQualityControllerTest, LowQualityFilterForLive
Resize); |
| 87 FRIEND_TEST_ALL_PREFIXES(ImageQualityControllerTest, LowQualityFilterForResi
zingImage); | 87 FRIEND_TEST_ALL_PREFIXES(ImageQualityControllerTest, LowQualityFilterForResi
zingImage); |
| 88 FRIEND_TEST_ALL_PREFIXES(ImageQualityControllerTest, DontKickTheAnimationTim
erWhenPaintingAtTheSameSize); | 88 FRIEND_TEST_ALL_PREFIXES(ImageQualityControllerTest, DontKickTheAnimationTim
erWhenPaintingAtTheSameSize); |
| 89 }; | 89 }; |
| 90 | 90 |
| 91 } // namespace blink | 91 } // namespace blink |
| 92 | 92 |
| 93 #endif | 93 #endif |
| OLD | NEW |