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

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

Issue 2640983002: Rename paint data structures (Closed)
Patch Set: DrawingDisplayItem Created 3 years, 10 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;
17 class SkPicture;
18 class SkPictureRecorder;
19
20 namespace blink { 16 namespace blink {
21 17
22 class ImageBuffer; 18 class ImageBuffer;
23 class RecordingImageBufferSurfaceTest; 19 class RecordingImageBufferSurfaceTest;
24 20
25 class RecordingImageBufferFallbackSurfaceFactory { 21 class RecordingImageBufferFallbackSurfaceFactory {
26 USING_FAST_MALLOC(RecordingImageBufferFallbackSurfaceFactory); 22 USING_FAST_MALLOC(RecordingImageBufferFallbackSurfaceFactory);
27 WTF_MAKE_NONCOPYABLE(RecordingImageBufferFallbackSurfaceFactory); 23 WTF_MAKE_NONCOPYABLE(RecordingImageBufferFallbackSurfaceFactory);
28 24
29 public: 25 public:
(...skipping 19 matching lines...) Expand all
49 RecordingImageBufferSurface( 45 RecordingImageBufferSurface(
50 const IntSize&, 46 const IntSize&,
51 std::unique_ptr<RecordingImageBufferFallbackSurfaceFactory> 47 std::unique_ptr<RecordingImageBufferFallbackSurfaceFactory>
52 fallbackFactory = nullptr, 48 fallbackFactory = nullptr,
53 OpacityMode = NonOpaque, 49 OpacityMode = NonOpaque,
54 sk_sp<SkColorSpace> = nullptr, 50 sk_sp<SkColorSpace> = nullptr,
55 SkColorType = kN32_SkColorType); 51 SkColorType = kN32_SkColorType);
56 ~RecordingImageBufferSurface() override; 52 ~RecordingImageBufferSurface() override;
57 53
58 // Implementation of ImageBufferSurface interfaces 54 // Implementation of ImageBufferSurface interfaces
59 SkCanvas* canvas() override; 55 PaintCanvas* canvas() override;
60 void disableDeferral(DisableDeferralReason) override; 56 void disableDeferral(DisableDeferralReason) override;
61 sk_sp<SkPicture> getPicture() override; 57 sk_sp<PaintRecord> getPicture() override;
62 void flush(FlushReason) override; 58 void flush(FlushReason) override;
63 void didDraw(const FloatRect&) override; 59 void didDraw(const FloatRect&) override;
64 bool isValid() const override { return true; } 60 bool isValid() const override { return true; }
65 bool isRecording() const override { return !m_fallbackSurface; } 61 bool isRecording() const override { return !m_fallbackSurface; }
66 bool writePixels(const SkImageInfo& origInfo, 62 bool writePixels(const SkImageInfo& origInfo,
67 const void* pixels, 63 const void* pixels,
68 size_t rowBytes, 64 size_t rowBytes,
69 int x, 65 int x,
70 int y) override; 66 int y) override;
71 void willOverwriteCanvas() override; 67 void willOverwriteCanvas() override;
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 FallbackReasonCount, 117 FallbackReasonCount,
122 }; 118 };
123 119
124 private: 120 private:
125 friend class RecordingImageBufferSurfaceTest; // for unit testing 121 friend class RecordingImageBufferSurfaceTest; // for unit testing
126 void fallBackToRasterCanvas(FallbackReason); 122 void fallBackToRasterCanvas(FallbackReason);
127 void initializeCurrentFrame(); 123 void initializeCurrentFrame();
128 bool finalizeFrameInternal(FallbackReason*); 124 bool finalizeFrameInternal(FallbackReason*);
129 int approximateOpCount(); 125 int approximateOpCount();
130 126
131 std::unique_ptr<SkPictureRecorder> m_currentFrame; 127 std::unique_ptr<PaintRecorder> m_currentFrame;
132 sk_sp<SkPicture> m_previousFrame; 128 sk_sp<PaintRecord> m_previousFrame;
133 std::unique_ptr<ImageBufferSurface> m_fallbackSurface; 129 std::unique_ptr<ImageBufferSurface> m_fallbackSurface;
134 ImageBuffer* m_imageBuffer; 130 ImageBuffer* m_imageBuffer;
135 int m_initialSaveCount; 131 int m_initialSaveCount;
136 int m_currentFramePixelCount; 132 int m_currentFramePixelCount;
137 int m_previousFramePixelCount; 133 int m_previousFramePixelCount;
138 bool m_frameWasCleared; 134 bool m_frameWasCleared;
139 bool m_didRecordDrawCommandsInCurrentFrame; 135 bool m_didRecordDrawCommandsInCurrentFrame;
140 bool m_currentFrameHasExpensiveOp; 136 bool m_currentFrameHasExpensiveOp;
141 bool m_previousFrameHasExpensiveOp; 137 bool m_previousFrameHasExpensiveOp;
142 std::unique_ptr<RecordingImageBufferFallbackSurfaceFactory> m_fallbackFactory; 138 std::unique_ptr<RecordingImageBufferFallbackSurfaceFactory> m_fallbackFactory;
143 }; 139 };
144 140
145 } // namespace blink 141 } // namespace blink
146 142
147 #endif 143 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698