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

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

Issue 2026803002: Avoid GPU readback in tex(Sub)Image2D(ImageBitmap) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address kbr@'s comments Created 4 years, 6 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 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
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698