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

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

Issue 2523673004: [NOT FOR COMMIT] Fully replace SkCanvas uses.
Patch Set: Support Android build. Created 4 years 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 "skia/ext/cdl_common.h"
11 #include "third_party/skia/include/core/SkRefCnt.h" 12 #include "third_party/skia/include/core/SkRefCnt.h"
12 #include "wtf/Allocator.h" 13 #include "wtf/Allocator.h"
13 #include "wtf/Noncopyable.h" 14 #include "wtf/Noncopyable.h"
14 #include <memory> 15 #include <memory>
15 16
16 class SkCanvas;
17 class SkPicture;
18 class SkPictureRecorder;
19
20 namespace blink { 17 namespace blink {
21 18
22 class ImageBuffer; 19 class ImageBuffer;
23 class RecordingImageBufferSurfaceTest; 20 class RecordingImageBufferSurfaceTest;
24 21
25 class RecordingImageBufferFallbackSurfaceFactory { 22 class RecordingImageBufferFallbackSurfaceFactory {
26 USING_FAST_MALLOC(RecordingImageBufferFallbackSurfaceFactory); 23 USING_FAST_MALLOC(RecordingImageBufferFallbackSurfaceFactory);
27 WTF_MAKE_NONCOPYABLE(RecordingImageBufferFallbackSurfaceFactory); 24 WTF_MAKE_NONCOPYABLE(RecordingImageBufferFallbackSurfaceFactory);
28 25
29 public: 26 public:
(...skipping 19 matching lines...) Expand all
49 RecordingImageBufferSurface( 46 RecordingImageBufferSurface(
50 const IntSize&, 47 const IntSize&,
51 std::unique_ptr<RecordingImageBufferFallbackSurfaceFactory> 48 std::unique_ptr<RecordingImageBufferFallbackSurfaceFactory>
52 fallbackFactory = nullptr, 49 fallbackFactory = nullptr,
53 OpacityMode = NonOpaque, 50 OpacityMode = NonOpaque,
54 sk_sp<SkColorSpace> = nullptr, 51 sk_sp<SkColorSpace> = nullptr,
55 SkColorType = kN32_SkColorType); 52 SkColorType = kN32_SkColorType);
56 ~RecordingImageBufferSurface() override; 53 ~RecordingImageBufferSurface() override;
57 54
58 // Implementation of ImageBufferSurface interfaces 55 // Implementation of ImageBufferSurface interfaces
59 SkCanvas* canvas() override; 56 CdlCanvas* canvas() override;
60 void disableDeferral(DisableDeferralReason) override; 57 void disableDeferral(DisableDeferralReason) override;
61 sk_sp<SkPicture> getPicture() override; 58 sk_sp<CdlPicture> getPicture() override;
62 void flush(FlushReason) override; 59 void flush(FlushReason) override;
63 void didDraw(const FloatRect&) override; 60 void didDraw(const FloatRect&) override;
64 bool isValid() const override { return true; } 61 bool isValid() const override { return true; }
65 bool isRecording() const override { return !m_fallbackSurface; } 62 bool isRecording() const override { return !m_fallbackSurface; }
66 bool writePixels(const SkImageInfo& origInfo, 63 bool writePixels(const SkImageInfo& origInfo,
67 const void* pixels, 64 const void* pixels,
68 size_t rowBytes, 65 size_t rowBytes,
69 int x, 66 int x,
70 int y) override; 67 int y) override;
71 void willOverwriteCanvas() override; 68 void willOverwriteCanvas() override;
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 FallbackReasonCount, 113 FallbackReasonCount,
117 }; 114 };
118 115
119 private: 116 private:
120 friend class RecordingImageBufferSurfaceTest; // for unit testing 117 friend class RecordingImageBufferSurfaceTest; // for unit testing
121 void fallBackToRasterCanvas(FallbackReason); 118 void fallBackToRasterCanvas(FallbackReason);
122 void initializeCurrentFrame(); 119 void initializeCurrentFrame();
123 bool finalizeFrameInternal(FallbackReason*); 120 bool finalizeFrameInternal(FallbackReason*);
124 int approximateOpCount(); 121 int approximateOpCount();
125 122
126 std::unique_ptr<SkPictureRecorder> m_currentFrame; 123 std::unique_ptr<CdlPictureRecorder> m_currentFrame;
127 sk_sp<SkPicture> m_previousFrame; 124 sk_sp<CdlPicture> m_previousFrame;
128 std::unique_ptr<ImageBufferSurface> m_fallbackSurface; 125 std::unique_ptr<ImageBufferSurface> m_fallbackSurface;
129 ImageBuffer* m_imageBuffer; 126 ImageBuffer* m_imageBuffer;
130 int m_initialSaveCount; 127 int m_initialSaveCount;
131 int m_currentFramePixelCount; 128 int m_currentFramePixelCount;
132 int m_previousFramePixelCount; 129 int m_previousFramePixelCount;
133 bool m_frameWasCleared; 130 bool m_frameWasCleared;
134 bool m_didRecordDrawCommandsInCurrentFrame; 131 bool m_didRecordDrawCommandsInCurrentFrame;
135 bool m_currentFrameHasExpensiveOp; 132 bool m_currentFrameHasExpensiveOp;
136 bool m_previousFrameHasExpensiveOp; 133 bool m_previousFrameHasExpensiveOp;
137 std::unique_ptr<RecordingImageBufferFallbackSurfaceFactory> m_fallbackFactory; 134 std::unique_ptr<RecordingImageBufferFallbackSurfaceFactory> m_fallbackFactory;
138 }; 135 };
139 136
140 } // namespace blink 137 } // namespace blink
141 138
142 #endif 139 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698