OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2013, Google Inc. All rights reserved. | 2 * Copyright (c) 2013, Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 18 matching lines...) Expand all Loading... |
29 */ | 29 */ |
30 | 30 |
31 #ifndef ImageBufferSurface_h | 31 #ifndef ImageBufferSurface_h |
32 #define ImageBufferSurface_h | 32 #define ImageBufferSurface_h |
33 | 33 |
34 #include "platform/PlatformExport.h" | 34 #include "platform/PlatformExport.h" |
35 #include "platform/geometry/IntSize.h" | 35 #include "platform/geometry/IntSize.h" |
36 #include "platform/graphics/GraphicsTypes.h" | 36 #include "platform/graphics/GraphicsTypes.h" |
37 #include "third_party/khronos/GLES2/gl2.h" | 37 #include "third_party/khronos/GLES2/gl2.h" |
38 #include "third_party/skia/include/core/SkPaint.h" | 38 #include "third_party/skia/include/core/SkPaint.h" |
| 39 #include "third_party/skia/include/core/SkRefCnt.h" |
39 #include "wtf/Allocator.h" | 40 #include "wtf/Allocator.h" |
40 #include "wtf/Noncopyable.h" | 41 #include "wtf/Noncopyable.h" |
41 #include "wtf/PassRefPtr.h" | |
42 | 42 |
43 class SkBitmap; | 43 class SkBitmap; |
44 class SkCanvas; | 44 class SkCanvas; |
45 class SkColorSpace; | 45 class SkColorSpace; |
46 class SkImage; | 46 class SkImage; |
47 struct SkImageInfo; | 47 struct SkImageInfo; |
48 class SkPicture; | 48 class SkPicture; |
49 | 49 |
50 namespace blink { | 50 namespace blink { |
51 | 51 |
(...skipping 13 matching lines...) Expand all Loading... |
65 virtual void didDraw(const FloatRect& rect) { } | 65 virtual void didDraw(const FloatRect& rect) { } |
66 virtual bool isValid() const = 0; | 66 virtual bool isValid() const = 0; |
67 virtual bool restore() { return false; } | 67 virtual bool restore() { return false; } |
68 virtual WebLayer* layer() const { return 0; } | 68 virtual WebLayer* layer() const { return 0; } |
69 virtual bool isAccelerated() const { return false; } | 69 virtual bool isAccelerated() const { return false; } |
70 virtual bool isRecording() const { return false; } | 70 virtual bool isRecording() const { return false; } |
71 virtual bool isExpensiveToPaint() { return false; } | 71 virtual bool isExpensiveToPaint() { return false; } |
72 virtual void setFilterQuality(SkFilterQuality) { } | 72 virtual void setFilterQuality(SkFilterQuality) { } |
73 virtual void setIsHidden(bool) { } | 73 virtual void setIsHidden(bool) { } |
74 virtual void setImageBuffer(ImageBuffer*) { } | 74 virtual void setImageBuffer(ImageBuffer*) { } |
75 virtual PassRefPtr<SkPicture> getPicture(); | 75 virtual sk_sp<SkPicture> getPicture(); |
76 virtual void finalizeFrame(const FloatRect &dirtyRect) { } | 76 virtual void finalizeFrame(const FloatRect &dirtyRect) { } |
77 virtual void draw(GraphicsContext&, const FloatRect& destRect, const FloatRe
ct& srcRect, SkXfermode::Mode); | 77 virtual void draw(GraphicsContext&, const FloatRect& destRect, const FloatRe
ct& srcRect, SkXfermode::Mode); |
78 virtual void setHasExpensiveOp() { } | 78 virtual void setHasExpensiveOp() { } |
79 virtual GLuint getBackingTextureHandleForOverwrite() { return 0; } | 79 virtual GLuint getBackingTextureHandleForOverwrite() { return 0; } |
80 virtual void flush(FlushReason); // Execute all deferred rendering immediate
ly | 80 virtual void flush(FlushReason); // Execute all deferred rendering immediate
ly |
81 virtual void flushGpu(FlushReason reason) { flush(reason); } // Like flush,
but flushes all the way down to the GPU context if the surface uses the GPU | 81 virtual void flushGpu(FlushReason reason) { flush(reason); } // Like flush,
but flushes all the way down to the GPU context if the surface uses the GPU |
82 virtual void prepareSurfaceForPaintingIfNeeded() { } | 82 virtual void prepareSurfaceForPaintingIfNeeded() { } |
83 virtual bool writePixels(const SkImageInfo& origInfo, const void* pixels, si
ze_t rowBytes, int x, int y); | 83 virtual bool writePixels(const SkImageInfo& origInfo, const void* pixels, si
ze_t rowBytes, int x, int y); |
84 | 84 |
85 // May return nullptr if the surface is GPU-backed and the GPU context was l
ost. | 85 // May return nullptr if the surface is GPU-backed and the GPU context was l
ost. |
86 virtual PassRefPtr<SkImage> newImageSnapshot(AccelerationHint, SnapshotReaso
n) = 0; | 86 virtual sk_sp<SkImage> newImageSnapshot(AccelerationHint, SnapshotReason) =
0; |
87 | 87 |
88 OpacityMode getOpacityMode() const { return m_opacityMode; } | 88 OpacityMode getOpacityMode() const { return m_opacityMode; } |
89 const IntSize& size() const { return m_size; } | 89 const IntSize& size() const { return m_size; } |
90 const sk_sp<SkColorSpace> colorSpace() const { return m_colorSpace; } | 90 const sk_sp<SkColorSpace> colorSpace() const { return m_colorSpace; } |
91 void notifyIsValidChanged(bool isValid) const; | 91 void notifyIsValidChanged(bool isValid) const; |
92 | 92 |
93 protected: | 93 protected: |
94 ImageBufferSurface(const IntSize&, OpacityMode, sk_sp<SkColorSpace>); | 94 ImageBufferSurface(const IntSize&, OpacityMode, sk_sp<SkColorSpace>); |
95 void clear(); | 95 void clear(); |
96 | 96 |
97 private: | 97 private: |
98 OpacityMode m_opacityMode; | 98 OpacityMode m_opacityMode; |
99 IntSize m_size; | 99 IntSize m_size; |
100 sk_sp<SkColorSpace> m_colorSpace; | 100 sk_sp<SkColorSpace> m_colorSpace; |
101 }; | 101 }; |
102 | 102 |
103 } // namespace blink | 103 } // namespace blink |
104 | 104 |
105 #endif | 105 #endif |
OLD | NEW |