OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "core/svg/graphics/SVGImage.h" | 5 #include "core/svg/graphics/SVGImage.h" |
6 | 6 |
7 #include "core/svg/graphics/SVGImageChromeClient.h" | 7 #include "core/svg/graphics/SVGImageChromeClient.h" |
8 #include "platform/SharedBuffer.h" | 8 #include "platform/SharedBuffer.h" |
9 #include "platform/Timer.h" | 9 #include "platform/Timer.h" |
10 #include "platform/geometry/FloatRect.h" | 10 #include "platform/geometry/FloatRect.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 void load(const char* data, bool shouldPause) | 22 void load(const char* data, bool shouldPause) |
23 { | 23 { |
24 m_observer = new PauseControlImageObserver(shouldPause); | 24 m_observer = new PauseControlImageObserver(shouldPause); |
25 m_image = SVGImage::create(m_observer); | 25 m_image = SVGImage::create(m_observer); |
26 m_image->setData(SharedBuffer::create(data, strlen(data)), true); | 26 m_image->setData(SharedBuffer::create(data, strlen(data)), true); |
27 } | 27 } |
28 | 28 |
29 void pumpFrame() | 29 void pumpFrame() |
30 { | 30 { |
31 Image* image = m_image.get(); | 31 Image* image = m_image.get(); |
32 RefPtr<SkCanvas> nullCanvas = adoptRef(SkCreateNullCanvas()); | 32 sk_sp<SkCanvas> nullCanvas(SkCreateNullCanvas()); |
33 SkPaint paint; | 33 SkPaint paint; |
34 FloatRect dummyRect(0, 0, 100, 100); | 34 FloatRect dummyRect(0, 0, 100, 100); |
35 image->draw( | 35 image->draw( |
36 nullCanvas.get(), paint, | 36 nullCanvas.get(), paint, |
37 dummyRect, dummyRect, | 37 dummyRect, dummyRect, |
38 DoNotRespectImageOrientation, Image::DoNotClampImageToSourceRect); | 38 DoNotRespectImageOrientation, Image::DoNotClampImageToSourceRect); |
39 } | 39 } |
40 | 40 |
41 private: | 41 private: |
42 class PauseControlImageObserver | 42 class PauseControlImageObserver |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 EXPECT_TRUE(chromeClient.isSuspended()); | 131 EXPECT_TRUE(chromeClient.isSuspended()); |
132 EXPECT_FALSE(timer->isActive()); | 132 EXPECT_FALSE(timer->isActive()); |
133 | 133 |
134 // Simulate a draw. This should resume the animation again. | 134 // Simulate a draw. This should resume the animation again. |
135 pumpFrame(); | 135 pumpFrame(); |
136 EXPECT_FALSE(chromeClient.isSuspended()); | 136 EXPECT_FALSE(chromeClient.isSuspended()); |
137 EXPECT_TRUE(timer->isActive()); | 137 EXPECT_TRUE(timer->isActive()); |
138 } | 138 } |
139 | 139 |
140 } // namespace blink | 140 } // namespace blink |
OLD | NEW |