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

Side by Side Diff: third_party/WebKit/Source/platform/graphics/RecordingImageBufferSurfaceTest.cpp

Issue 2840093002: Allow RecordingImageBufferSurface to prevent fallback. (Closed)
Patch Set: imagebuffer-fallback: missedone Created 3 years, 7 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
« no previous file with comments | « third_party/WebKit/Source/platform/graphics/RecordingImageBufferSurface.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "platform/graphics/RecordingImageBufferSurface.h" 5 #include "platform/graphics/RecordingImageBufferSurface.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include "platform/WebTaskRunner.h" 8 #include "platform/WebTaskRunner.h"
9 #include "platform/graphics/GraphicsContext.h" 9 #include "platform/graphics/GraphicsContext.h"
10 #include "platform/graphics/ImageBuffer.h" 10 #include "platform/graphics/ImageBuffer.h"
(...skipping 11 matching lines...) Expand all
22 #include "testing/gtest/include/gtest/gtest.h" 22 #include "testing/gtest/include/gtest/gtest.h"
23 23
24 using testing::Test; 24 using testing::Test;
25 25
26 namespace blink { 26 namespace blink {
27 27
28 class RecordingImageBufferSurfaceTest : public Test { 28 class RecordingImageBufferSurfaceTest : public Test {
29 protected: 29 protected:
30 RecordingImageBufferSurfaceTest() { 30 RecordingImageBufferSurfaceTest() {
31 auto test_surface = WTF::MakeUnique<RecordingImageBufferSurface>( 31 auto test_surface = WTF::MakeUnique<RecordingImageBufferSurface>(
32 IntSize(10, 10), kNonOpaque); 32 IntSize(10, 10), RecordingImageBufferSurface::kAllowFallback,
33 kNonOpaque);
33 test_surface_ = test_surface.get(); 34 test_surface_ = test_surface.get();
34 // We create an ImageBuffer in order for the |test_surface| to be 35 // We create an ImageBuffer in order for the |test_surface| to be
35 // properly initialized with a GraphicsContext 36 // properly initialized with a GraphicsContext
36 image_buffer_ = ImageBuffer::Create(std::move(test_surface)); 37 image_buffer_ = ImageBuffer::Create(std::move(test_surface));
37 EXPECT_TRUE(image_buffer_); 38 EXPECT_TRUE(image_buffer_);
38 } 39 }
39 40
40 public: 41 public:
41 RecordingImageBufferSurface* TestSurface() { return test_surface_; } 42 RecordingImageBufferSurface* TestSurface() { return test_surface_; }
42 PaintCanvas* Canvas() { return image_buffer_->Canvas(); } 43 PaintCanvas* Canvas() { return image_buffer_->Canvas(); }
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 clear_flags.setBlendMode(SkBlendMode::kClear); 96 clear_flags.setBlendMode(SkBlendMode::kClear);
96 Canvas()->drawRect(SkRect::MakeWH(TestSurface()->size().Width(), 97 Canvas()->drawRect(SkRect::MakeWH(TestSurface()->size().Width(),
97 TestSurface()->size().Height()), 98 TestSurface()->size().Height()),
98 clear_flags); 99 clear_flags);
99 TestSurface()->DidDraw(FloatRect(0, 0, 1, 1)); 100 TestSurface()->DidDraw(FloatRect(0, 0, 1, 1));
100 TestSurface()->GetRecord(); 101 TestSurface()->GetRecord();
101 EXPECT_TRUE(TestSurface()->IsRecording()); 102 EXPECT_TRUE(TestSurface()->IsRecording());
102 } 103 }
103 104
104 } // namespace blink 105 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/graphics/RecordingImageBufferSurface.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698