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

Side by Side Diff: third_party/WebKit/Source/platform/graphics/RecordingImageBufferSurface.h

Issue 2425113002: Fix the linear-rgb canvas color space so that it renders (Closed)
Patch Set: 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 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 #ifndef RecordingImageBufferSurface_h 5 #ifndef RecordingImageBufferSurface_h
6 #define RecordingImageBufferSurface_h 6 #define RecordingImageBufferSurface_h
7 7
8 #include "platform/graphics/GraphicsContext.h" 8 #include "platform/graphics/GraphicsContext.h"
9 #include "platform/graphics/ImageBufferSurface.h" 9 #include "platform/graphics/ImageBufferSurface.h"
10 #include "public/platform/WebThread.h" 10 #include "public/platform/WebThread.h"
11 #include "third_party/skia/include/core/SkRefCnt.h" 11 #include "third_party/skia/include/core/SkRefCnt.h"
12 #include "wtf/Allocator.h" 12 #include "wtf/Allocator.h"
13 #include "wtf/Noncopyable.h" 13 #include "wtf/Noncopyable.h"
14 #include <memory> 14 #include <memory>
15 15
16 class SkCanvas; 16 class SkCanvas;
17 class SkPicture; 17 class SkPicture;
18 class SkPictureRecorder; 18 class SkPictureRecorder;
19 19
20 namespace blink { 20 namespace blink {
21 21
22 class ImageBuffer; 22 class ImageBuffer;
23 class RecordingImageBufferSurfaceTest; 23 class RecordingImageBufferSurfaceTest;
24 24
25 class RecordingImageBufferFallbackSurfaceFactory { 25 class RecordingImageBufferFallbackSurfaceFactory {
26 USING_FAST_MALLOC(RecordingImageBufferFallbackSurfaceFactory); 26 USING_FAST_MALLOC(RecordingImageBufferFallbackSurfaceFactory);
27 WTF_MAKE_NONCOPYABLE(RecordingImageBufferFallbackSurfaceFactory); 27 WTF_MAKE_NONCOPYABLE(RecordingImageBufferFallbackSurfaceFactory);
28 28
29 public: 29 public:
30 virtual std::unique_ptr<ImageBufferSurface> 30 virtual std::unique_ptr<ImageBufferSurface> createSurface(const IntSize&,
31 createSurface(const IntSize&, OpacityMode, sk_sp<SkColorSpace>) = 0; 31 OpacityMode,
32 sk_sp<SkColorSpace>,
33 SkColorType) = 0;
32 virtual ~RecordingImageBufferFallbackSurfaceFactory() {} 34 virtual ~RecordingImageBufferFallbackSurfaceFactory() {}
33 35
34 protected: 36 protected:
35 RecordingImageBufferFallbackSurfaceFactory() {} 37 RecordingImageBufferFallbackSurfaceFactory() {}
36 }; 38 };
37 39
38 class PLATFORM_EXPORT RecordingImageBufferSurface : public ImageBufferSurface { 40 class PLATFORM_EXPORT RecordingImageBufferSurface : public ImageBufferSurface {
39 WTF_MAKE_NONCOPYABLE(RecordingImageBufferSurface); 41 WTF_MAKE_NONCOPYABLE(RecordingImageBufferSurface);
40 USING_FAST_MALLOC(RecordingImageBufferSurface); 42 USING_FAST_MALLOC(RecordingImageBufferSurface);
41 43
42 public: 44 public:
43 // If the fallbackFactory is null the buffer surface should only be used 45 // If the fallbackFactory is null the buffer surface should only be used
44 // for one frame and should not be used for any operations which need a 46 // for one frame and should not be used for any operations which need a
45 // raster surface, (i.e. writePixels). 47 // raster surface, (i.e. writePixels).
46 // Only #getPicture should be used to access the resulting frame. 48 // Only #getPicture should be used to access the resulting frame.
47 RecordingImageBufferSurface( 49 RecordingImageBufferSurface(
48 const IntSize&, 50 const IntSize&,
49 std::unique_ptr<RecordingImageBufferFallbackSurfaceFactory> 51 std::unique_ptr<RecordingImageBufferFallbackSurfaceFactory>
50 fallbackFactory = nullptr, 52 fallbackFactory = nullptr,
51 OpacityMode = NonOpaque, 53 OpacityMode = NonOpaque,
52 sk_sp<SkColorSpace> = nullptr); 54 sk_sp<SkColorSpace> = nullptr,
55 SkColorType = kN32_SkColorType);
53 ~RecordingImageBufferSurface() override; 56 ~RecordingImageBufferSurface() override;
54 57
55 // Implementation of ImageBufferSurface interfaces 58 // Implementation of ImageBufferSurface interfaces
56 SkCanvas* canvas() override; 59 SkCanvas* canvas() override;
57 void disableDeferral(DisableDeferralReason) override; 60 void disableDeferral(DisableDeferralReason) override;
58 sk_sp<SkPicture> getPicture() override; 61 sk_sp<SkPicture> getPicture() override;
59 void flush(FlushReason) override; 62 void flush(FlushReason) override;
60 void didDraw(const FloatRect&) override; 63 void didDraw(const FloatRect&) override;
61 bool isValid() const override { return true; } 64 bool isValid() const override { return true; }
62 bool isRecording() const override { return !m_fallbackSurface; } 65 bool isRecording() const override { return !m_fallbackSurface; }
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 bool m_frameWasCleared; 133 bool m_frameWasCleared;
131 bool m_didRecordDrawCommandsInCurrentFrame; 134 bool m_didRecordDrawCommandsInCurrentFrame;
132 bool m_currentFrameHasExpensiveOp; 135 bool m_currentFrameHasExpensiveOp;
133 bool m_previousFrameHasExpensiveOp; 136 bool m_previousFrameHasExpensiveOp;
134 std::unique_ptr<RecordingImageBufferFallbackSurfaceFactory> m_fallbackFactory; 137 std::unique_ptr<RecordingImageBufferFallbackSurfaceFactory> m_fallbackFactory;
135 }; 138 };
136 139
137 } // namespace blink 140 } // namespace blink
138 141
139 #endif 142 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698