Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2DUsageTrackingTest.cpp

Issue 2362363002: Cancel GPU acceleration for 2D canvas when drawing very large images (Closed)
Patch Set: fix sqrt Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698