OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2016 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 ImagePixelLocker_h | 5 #ifndef OffscreenCanvasRenderingContextFactory_h |
6 #define ImagePixelLocker_h | 6 #define OffscreenCanvasRenderingContextFactory_h |
7 | 7 |
8 #include "platform/heap/Heap.h" | |
9 #include "third_party/skia/include/core/SkImageInfo.h" | |
10 #include "third_party/skia/include/core/SkPixmap.h" | |
11 #include "wtf/Allocator.h" | 8 #include "wtf/Allocator.h" |
12 #include "wtf/Noncopyable.h" | |
13 #include "wtf/PassRefPtr.h" | 9 #include "wtf/PassRefPtr.h" |
14 #include "wtf/RefPtr.h" | |
15 | |
16 class SkImage; | |
17 | 10 |
18 namespace blink { | 11 namespace blink { |
19 | 12 |
20 class ImagePixelLocker final { | 13 class CanvasContextCreationAttributes; |
21 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); | 14 class OffscreenCanvas; |
22 WTF_MAKE_NONCOPYABLE(ImagePixelLocker); | 15 class OffscreenCanvasRenderingContext; |
| 16 |
| 17 class OffscreenCanvasRenderingContextFactory { |
| 18 USING_FAST_MALLOC(OffscreenCanvasRenderingContextFactory); |
| 19 WTF_MAKE_NONCOPYABLE(OffscreenCanvasRenderingContextFactory); |
23 public: | 20 public: |
24 ImagePixelLocker(PassRefPtr<const SkImage>, SkAlphaType, SkColorType); | 21 OffscreenCanvasRenderingContextFactory() = default; |
| 22 virtual ~OffscreenCanvasRenderingContextFactory() { } |
25 | 23 |
26 const void* pixels() const { return m_pixels; } | 24 virtual OffscreenCanvasRenderingContext* create(OffscreenCanvas*, const Canv
asContextCreationAttributes&) = 0; |
27 | 25 virtual OffscreenCanvasRenderingContext::ContextType contextType() const = 0
; |
28 private: | 26 virtual void onError(OffscreenCanvas*, const String& error) = 0; |
29 const RefPtr<const SkImage> m_image; | |
30 const void* m_pixels; | |
31 SkAutoPixmapStorage m_pixelStorage; | |
32 }; | 27 }; |
33 | 28 |
34 } // namespace blink | 29 } // namespace blink |
35 | 30 |
36 #endif | 31 #endif // OffscreenCanvasRenderingContextFactory_h |
OLD | NEW |