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

Side by Side Diff: third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2DUsageTrackingTest.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 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/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/Settings.h" 9 #include "core/frame/Settings.h"
10 #include "core/html/HTMLCanvasElement.h" 10 #include "core/html/HTMLCanvasElement.h"
(...skipping 24 matching lines...) Expand all
35 35
36 class FakeImageSource : public CanvasImageSource { 36 class FakeImageSource : public CanvasImageSource {
37 public: 37 public:
38 FakeImageSource(IntSize, BitmapOpacity); 38 FakeImageSource(IntSize, BitmapOpacity);
39 39
40 PassRefPtr<Image> getSourceImageForCanvas(SourceImageStatus*, AccelerationHi nt, SnapshotReason, const FloatSize&) const override; 40 PassRefPtr<Image> getSourceImageForCanvas(SourceImageStatus*, AccelerationHi nt, SnapshotReason, const FloatSize&) const override;
41 41
42 bool wouldTaintOrigin(SecurityOrigin* destinationSecurityOrigin) const overr ide { return false; } 42 bool wouldTaintOrigin(SecurityOrigin* destinationSecurityOrigin) const overr ide { return false; }
43 FloatSize elementSize(const FloatSize&) const override { return FloatSize(m_ size); } 43 FloatSize elementSize(const FloatSize&) const override { return FloatSize(m_ size); }
44 bool isOpaque() const override { return m_isOpaque; } 44 bool isOpaque() const override { return m_isOpaque; }
45 int sourceWidth() override { return m_size.width(); }
46 int sourceHeight() override { return m_size.height(); }
45 47
46 ~FakeImageSource() override { } 48 ~FakeImageSource() override { }
47 49
48 private: 50 private:
49 IntSize m_size; 51 IntSize m_size;
50 RefPtr<Image> m_image; 52 RefPtr<Image> m_image;
51 bool m_isOpaque; 53 bool m_isOpaque;
52 }; 54 };
53 55
54 FakeImageSource::FakeImageSource(IntSize size, BitmapOpacity opacity) 56 FakeImageSource::FakeImageSource(IntSize size, BitmapOpacity opacity)
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 context2d()->setShadowColor("rgba(255, 0, 0, 0.5)"); 367 context2d()->setShadowColor("rgba(255, 0, 0, 0.5)");
366 context2d()->setShadowOffsetX(1.0); 368 context2d()->setShadowOffsetX(1.0);
367 context2d()->setShadowOffsetY(1.0); 369 context2d()->setShadowOffsetY(1.0);
368 context2d()->fillRect(0, 0, 1, 1); 370 context2d()->fillRect(0, 0, 1, 1);
369 } 371 }
370 EXPECT_EQ(numReps, context2d()->getUsage().numBlurredShadows); 372 EXPECT_EQ(numReps, context2d()->getUsage().numBlurredShadows);
371 } 373 }
372 374
373 } // namespace UsageTrackingTests 375 } // namespace UsageTrackingTests
374 } // namespace blink 376 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698