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

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

Issue 2212163002: Add some plumbing for the color management of canvases (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase again Created 4 years, 3 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 "platform/graphics/RecordingImageBufferSurface.h" 5 #include "platform/graphics/RecordingImageBufferSurface.h"
6 6
7 #include "platform/graphics/GraphicsContext.h" 7 #include "platform/graphics/GraphicsContext.h"
8 #include "platform/graphics/ImageBuffer.h" 8 #include "platform/graphics/ImageBuffer.h"
9 #include "platform/graphics/ImageBufferClient.h" 9 #include "platform/graphics/ImageBufferClient.h"
10 #include "platform/graphics/UnacceleratedImageBufferSurface.h" 10 #include "platform/graphics/UnacceleratedImageBufferSurface.h"
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 private: 72 private:
73 bool m_isDirty; 73 bool m_isDirty;
74 ImageBuffer* m_imageBuffer; 74 ImageBuffer* m_imageBuffer;
75 int m_frameCount; 75 int m_frameCount;
76 }; 76 };
77 77
78 class MockSurfaceFactory : public RecordingImageBufferFallbackSurfaceFactory { 78 class MockSurfaceFactory : public RecordingImageBufferFallbackSurfaceFactory {
79 public: 79 public:
80 MockSurfaceFactory() : m_createSurfaceCount(0) { } 80 MockSurfaceFactory() : m_createSurfaceCount(0) { }
81 81
82 virtual std::unique_ptr<ImageBufferSurface> createSurface(const IntSize& siz e, OpacityMode opacityMode) 82 virtual std::unique_ptr<ImageBufferSurface> createSurface(const IntSize& siz e, OpacityMode opacityMode, sk_sp<SkColorSpace> colorSpace)
83 { 83 {
84 m_createSurfaceCount++; 84 m_createSurfaceCount++;
85 return wrapUnique(new UnacceleratedImageBufferSurface(size, opacityMode) ); 85 return wrapUnique(new UnacceleratedImageBufferSurface(size, opacityMode, InitializeImagePixels, std::move(colorSpace)));
86 } 86 }
87 87
88 virtual ~MockSurfaceFactory() { } 88 virtual ~MockSurfaceFactory() { }
89 89
90 int createSurfaceCount() { return m_createSurfaceCount; } 90 int createSurfaceCount() { return m_createSurfaceCount; }
91 91
92 private: 92 private:
93 int m_createSurfaceCount; 93 int m_createSurfaceCount;
94 }; 94 };
95 95
96 class RecordingImageBufferSurfaceTest : public Test { 96 class RecordingImageBufferSurfaceTest : public Test {
97 protected: 97 protected:
98 RecordingImageBufferSurfaceTest() 98 RecordingImageBufferSurfaceTest()
99 { 99 {
100 std::unique_ptr<MockSurfaceFactory> surfaceFactory = wrapUnique(new Mock SurfaceFactory()); 100 std::unique_ptr<MockSurfaceFactory> surfaceFactory = wrapUnique(new Mock SurfaceFactory());
101 m_surfaceFactory = surfaceFactory.get(); 101 m_surfaceFactory = surfaceFactory.get();
102 std::unique_ptr<RecordingImageBufferSurface> testSurface = wrapUnique(ne w RecordingImageBufferSurface(IntSize(10, 10), std::move(surfaceFactory))); 102 std::unique_ptr<RecordingImageBufferSurface> testSurface = wrapUnique(ne w RecordingImageBufferSurface(IntSize(10, 10), std::move(surfaceFactory), NonOpa que, nullptr));
103 m_testSurface = testSurface.get(); 103 m_testSurface = testSurface.get();
104 // We create an ImageBuffer in order for the testSurface to be 104 // We create an ImageBuffer in order for the testSurface to be
105 // properly initialized with a GraphicsContext 105 // properly initialized with a GraphicsContext
106 m_imageBuffer = ImageBuffer::create(std::move(testSurface)); 106 m_imageBuffer = ImageBuffer::create(std::move(testSurface));
107 EXPECT_FALSE(!m_imageBuffer); 107 EXPECT_FALSE(!m_imageBuffer);
108 m_fakeImageBufferClient = wrapUnique(new FakeImageBufferClient(m_imageBu ffer.get())); 108 m_fakeImageBufferClient = wrapUnique(new FakeImageBufferClient(m_imageBu ffer.get()));
109 m_imageBuffer->setClient(m_fakeImageBufferClient.get()); 109 m_imageBuffer->setClient(m_fakeImageBufferClient.get());
110 } 110 }
111 111
112 public: 112 public:
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 expectDisplayListEnabled(true); 397 expectDisplayListEnabled(true);
398 } 398 }
399 399
400 TEST_F(RecordingImageBufferSurfaceTest, testClearRect) 400 TEST_F(RecordingImageBufferSurfaceTest, testClearRect)
401 { 401 {
402 CALL_TEST_TASK_WRAPPER(testClearRect); 402 CALL_TEST_TASK_WRAPPER(testClearRect);
403 expectDisplayListEnabled(true); 403 expectDisplayListEnabled(true);
404 } 404 }
405 405
406 } // namespace blink 406 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698