OLD | NEW |
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/ImageBufferSurface.h" | 8 #include "platform/graphics/ImageBufferSurface.h" |
9 #include "public/platform/WebThread.h" | 9 #include "public/platform/WebThread.h" |
10 #include "third_party/skia/include/core/SkCanvas.h" | 10 #include "third_party/skia/include/core/SkCanvas.h" |
11 #include "wtf/LinkedStack.h" | 11 #include "wtf/LinkedStack.h" |
12 #include "wtf/OwnPtr.h" | 12 #include "wtf/OwnPtr.h" |
13 #include "wtf/RefPtr.h" | 13 #include "wtf/RefPtr.h" |
14 | 14 |
15 class SkPicture; | 15 class SkPicture; |
16 class SkPictureRecorder; | 16 class SkPictureRecorder; |
17 class RecordingImageBufferSurfaceTest; | 17 class RecordingImageBufferSurfaceTest; |
18 | 18 |
19 namespace blink { | 19 namespace blink { |
20 | 20 |
21 class ImageBuffer; | 21 class ImageBuffer; |
22 | 22 |
23 class PLATFORM_EXPORT RecordingImageBufferSurface : public ImageBufferSurface { | 23 class PLATFORM_EXPORT RecordingImageBufferSurface : public ImageBufferSurface { |
24 WTF_MAKE_NONCOPYABLE(RecordingImageBufferSurface); WTF_MAKE_FAST_ALLOCATED; | 24 WTF_MAKE_NONCOPYABLE(RecordingImageBufferSurface); WTF_MAKE_FAST_ALLOCATED; |
25 public: | 25 public: |
26 RecordingImageBufferSurface(const IntSize&, OpacityMode = NonOpaque); | 26 RecordingImageBufferSurface(const IntSize&, OpacityMode = NonOpaque); |
27 virtual ~RecordingImageBufferSurface(); | 27 virtual ~RecordingImageBufferSurface(); |
28 | 28 |
29 // Implementation of ImageBufferSurface interfaces | 29 // Implementation of ImageBufferSurface interfaces |
30 virtual SkCanvas* canvas() const OVERRIDE; | 30 virtual SkCanvas* canvas() const override; |
31 virtual PassRefPtr<SkPicture> getPicture() OVERRIDE; | 31 virtual PassRefPtr<SkPicture> getPicture() override; |
32 virtual bool isValid() const OVERRIDE { return true; } | 32 virtual bool isValid() const override { return true; } |
33 virtual void willAccessPixels() OVERRIDE; | 33 virtual void willAccessPixels() override; |
34 virtual void finalizeFrame(const FloatRect&) OVERRIDE; | 34 virtual void finalizeFrame(const FloatRect&) override; |
35 virtual void didClearCanvas() OVERRIDE; | 35 virtual void didClearCanvas() override; |
36 virtual void setImageBuffer(ImageBuffer*) OVERRIDE; | 36 virtual void setImageBuffer(ImageBuffer*) override; |
37 | 37 |
38 private: | 38 private: |
39 struct StateRec { | 39 struct StateRec { |
40 public: | 40 public: |
41 SkMatrix m_ctm; | 41 SkMatrix m_ctm; |
42 // FIXME: handle transferring non-rectangular clip to the new frame, crb
ug.com/392614 | 42 // FIXME: handle transferring non-rectangular clip to the new frame, crb
ug.com/392614 |
43 SkIRect m_clip; | 43 SkIRect m_clip; |
44 }; | 44 }; |
45 typedef LinkedStack<StateRec> StateStack; | 45 typedef LinkedStack<StateRec> StateStack; |
46 friend class ::RecordingImageBufferSurfaceTest; // for unit testing | 46 friend class ::RecordingImageBufferSurfaceTest; // for unit testing |
(...skipping 10 matching lines...) Expand all Loading... |
57 RefPtr<SkPicture> m_previousFrame; | 57 RefPtr<SkPicture> m_previousFrame; |
58 OwnPtr<SkCanvas> m_rasterCanvas; | 58 OwnPtr<SkCanvas> m_rasterCanvas; |
59 ImageBuffer* m_imageBuffer; | 59 ImageBuffer* m_imageBuffer; |
60 int m_initialSaveCount; | 60 int m_initialSaveCount; |
61 bool m_frameWasCleared; | 61 bool m_frameWasCleared; |
62 }; | 62 }; |
63 | 63 |
64 } // namespace blink | 64 } // namespace blink |
65 | 65 |
66 #endif | 66 #endif |
OLD | NEW |