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 "modules/canvas2d/CanvasRenderingContext2D.h" | 5 #include "modules/canvas2d/CanvasRenderingContext2D.h" |
6 | 6 |
7 #include "core/dom/Document.h" | 7 #include "core/dom/Document.h" |
8 #include "core/fetch/MemoryCache.h" | 8 #include "core/fetch/MemoryCache.h" |
9 #include "core/frame/FrameView.h" | 9 #include "core/frame/FrameView.h" |
10 #include "core/frame/Settings.h" | 10 #include "core/frame/Settings.h" |
(...skipping 25 matching lines...) Expand all Loading... |
36 | 36 |
37 class FakeImageSource : public CanvasImageSource { | 37 class FakeImageSource : public CanvasImageSource { |
38 public: | 38 public: |
39 FakeImageSource(IntSize, BitmapOpacity); | 39 FakeImageSource(IntSize, BitmapOpacity); |
40 | 40 |
41 PassRefPtr<Image> getSourceImageForCanvas(SourceImageStatus*, AccelerationHi
nt, SnapshotReason, const FloatSize&) const override; | 41 PassRefPtr<Image> getSourceImageForCanvas(SourceImageStatus*, AccelerationHi
nt, SnapshotReason, const FloatSize&) const override; |
42 | 42 |
43 bool wouldTaintOrigin(SecurityOrigin* destinationSecurityOrigin) const overr
ide { return false; } | 43 bool wouldTaintOrigin(SecurityOrigin* destinationSecurityOrigin) const overr
ide { return false; } |
44 FloatSize elementSize(const FloatSize&) const override { return FloatSize(m_
size); } | 44 FloatSize elementSize(const FloatSize&) const override { return FloatSize(m_
size); } |
45 bool isOpaque() const override { return m_isOpaque; } | 45 bool isOpaque() const override { return m_isOpaque; } |
| 46 bool isAccelerated() const override { return false; } |
46 int sourceWidth() override { return m_size.width(); } | 47 int sourceWidth() override { return m_size.width(); } |
47 int sourceHeight() override { return m_size.height(); } | 48 int sourceHeight() override { return m_size.height(); } |
48 | 49 |
49 ~FakeImageSource() override { } | 50 ~FakeImageSource() override { } |
50 | 51 |
51 private: | 52 private: |
52 IntSize m_size; | 53 IntSize m_size; |
53 RefPtr<Image> m_image; | 54 RefPtr<Image> m_image; |
54 bool m_isOpaque; | 55 bool m_isOpaque; |
55 }; | 56 }; |
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
493 EXPECT_EQ(0, context2d()->getUsage().numDrawCalls[BaseRenderingContext2D::Fi
llRect]); | 494 EXPECT_EQ(0, context2d()->getUsage().numDrawCalls[BaseRenderingContext2D::Fi
llRect]); |
494 | 495 |
495 for (int i = 0; i < numReps; i++) { | 496 for (int i = 0; i < numReps; i++) { |
496 context2d()->fillRect(10, 10, 100, 100); | 497 context2d()->fillRect(10, 10, 100, 100); |
497 } | 498 } |
498 EXPECT_EQ(numReps, context2d()->getUsage().numDrawCalls[BaseRenderingContext
2D::FillRect]); | 499 EXPECT_EQ(numReps, context2d()->getUsage().numDrawCalls[BaseRenderingContext
2D::FillRect]); |
499 } | 500 } |
500 | 501 |
501 } // namespace UsageTrackingTests | 502 } // namespace UsageTrackingTests |
502 } // namespace blink | 503 } // namespace blink |
OLD | NEW |