| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "modules/canvas2d/CanvasRenderingContext2D.h" | 5 #include "modules/canvas2d/CanvasRenderingContext2D.h" |
| 6 | 6 |
| 7 #include "core/fetch/MemoryCache.h" | 7 #include "core/fetch/MemoryCache.h" |
| 8 #include "core/frame/FrameView.h" | 8 #include "core/frame/FrameView.h" |
| 9 #include "core/frame/ImageBitmap.h" | 9 #include "core/frame/ImageBitmap.h" |
| 10 #include "core/html/HTMLCanvasElement.h" | 10 #include "core/html/HTMLCanvasElement.h" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 | 40 |
| 41 class FakeImageSource : public CanvasImageSource { | 41 class FakeImageSource : public CanvasImageSource { |
| 42 public: | 42 public: |
| 43 FakeImageSource(IntSize, BitmapOpacity); | 43 FakeImageSource(IntSize, BitmapOpacity); |
| 44 | 44 |
| 45 PassRefPtr<Image> getSourceImageForCanvas(SourceImageStatus*, AccelerationHi
nt, SnapshotReason, const FloatSize&) const override; | 45 PassRefPtr<Image> getSourceImageForCanvas(SourceImageStatus*, AccelerationHi
nt, SnapshotReason, const FloatSize&) const override; |
| 46 | 46 |
| 47 bool wouldTaintOrigin(SecurityOrigin* destinationSecurityOrigin) const overr
ide { return false; } | 47 bool wouldTaintOrigin(SecurityOrigin* destinationSecurityOrigin) const overr
ide { return false; } |
| 48 FloatSize elementSize(const FloatSize&) const override { return FloatSize(m_
size); } | 48 FloatSize elementSize(const FloatSize&) const override { return FloatSize(m_
size); } |
| 49 bool isOpaque() const override { return m_isOpaque; } | 49 bool isOpaque() const override { return m_isOpaque; } |
| 50 int sourceWidth() override { return m_size.width(); } |
| 51 int sourceHeight() override { return m_size.height(); } |
| 50 | 52 |
| 51 ~FakeImageSource() override { } | 53 ~FakeImageSource() override { } |
| 52 | 54 |
| 53 private: | 55 private: |
| 54 IntSize m_size; | 56 IntSize m_size; |
| 55 RefPtr<Image> m_image; | 57 RefPtr<Image> m_image; |
| 56 bool m_isOpaque; | 58 bool m_isOpaque; |
| 57 }; | 59 }; |
| 58 | 60 |
| 59 FakeImageSource::FakeImageSource(IntSize size, BitmapOpacity opacity) | 61 FakeImageSource::FakeImageSource(IntSize size, BitmapOpacity opacity) |
| (...skipping 723 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 783 EXPECT_FALSE(exceptionState.hadException()); | 785 EXPECT_FALSE(exceptionState.hadException()); |
| 784 EXPECT_FALSE(bridge->isAccelerated()); | 786 EXPECT_FALSE(bridge->isAccelerated()); |
| 785 EXPECT_EQ(0u, getGlobalAcceleratedImageBufferCount()); | 787 EXPECT_EQ(0u, getGlobalAcceleratedImageBufferCount()); |
| 786 EXPECT_EQ(0, getGlobalGPUMemoryUsage()); | 788 EXPECT_EQ(0, getGlobalGPUMemoryUsage()); |
| 787 | 789 |
| 788 // Restore global state to prevent side-effects on other tests | 790 // Restore global state to prevent side-effects on other tests |
| 789 RuntimeEnabledFeatures::setCanvas2dFixedRenderingModeEnabled(savedFixedRende
ringMode); | 791 RuntimeEnabledFeatures::setCanvas2dFixedRenderingModeEnabled(savedFixedRende
ringMode); |
| 790 } | 792 } |
| 791 | 793 |
| 792 } // namespace blink | 794 } // namespace blink |
| OLD | NEW |