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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 virtual void setIsHidden(bool) {} | 75 virtual void setIsHidden(bool) {} |
76 virtual void setImageBuffer(ImageBuffer*) {} | 76 virtual void setImageBuffer(ImageBuffer*) {} |
77 virtual sk_sp<SkPicture> getPicture(); | 77 virtual sk_sp<SkPicture> getPicture(); |
78 virtual void finalizeFrame(const FloatRect& dirtyRect) {} | 78 virtual void finalizeFrame(const FloatRect& dirtyRect) {} |
79 virtual void draw(GraphicsContext&, | 79 virtual void draw(GraphicsContext&, |
80 const FloatRect& destRect, | 80 const FloatRect& destRect, |
81 const FloatRect& srcRect, | 81 const FloatRect& srcRect, |
82 SkXfermode::Mode); | 82 SkXfermode::Mode); |
83 virtual void setHasExpensiveOp() {} | 83 virtual void setHasExpensiveOp() {} |
84 virtual GLuint getBackingTextureHandleForOverwrite() { return 0; } | 84 virtual GLuint getBackingTextureHandleForOverwrite() { return 0; } |
85 virtual void flush( | 85 |
86 FlushReason); // Execute all deferred rendering immediately | 86 // Executes all deferred rendering immediately. |
| 87 virtual void flush(FlushReason); |
| 88 |
| 89 // Like flush, but flushes all the way down to the GPU context if the surface |
| 90 // uses the GPU. |
87 virtual void flushGpu(FlushReason reason) { | 91 virtual void flushGpu(FlushReason reason) { |
88 flush(reason); | 92 flush(reason); |
89 } // Like flush, but flushes all the way down to the GPU context if the surfa
ce uses the GPU | 93 } |
| 94 |
90 virtual void prepareSurfaceForPaintingIfNeeded() {} | 95 virtual void prepareSurfaceForPaintingIfNeeded() {} |
91 virtual bool writePixels(const SkImageInfo& origInfo, | 96 virtual bool writePixels(const SkImageInfo& origInfo, |
92 const void* pixels, | 97 const void* pixels, |
93 size_t rowBytes, | 98 size_t rowBytes, |
94 int x, | 99 int x, |
95 int y); | 100 int y); |
96 | 101 |
97 // May return nullptr if the surface is GPU-backed and the GPU context was los
t. | 102 // May return nullptr if the surface is GPU-backed and the GPU context was |
| 103 // lost. |
98 virtual sk_sp<SkImage> newImageSnapshot(AccelerationHint, SnapshotReason) = 0; | 104 virtual sk_sp<SkImage> newImageSnapshot(AccelerationHint, SnapshotReason) = 0; |
99 | 105 |
100 OpacityMode getOpacityMode() const { return m_opacityMode; } | 106 OpacityMode getOpacityMode() const { return m_opacityMode; } |
101 const IntSize& size() const { return m_size; } | 107 const IntSize& size() const { return m_size; } |
102 const sk_sp<SkColorSpace> colorSpace() const { return m_colorSpace; } | 108 const sk_sp<SkColorSpace> colorSpace() const { return m_colorSpace; } |
103 void notifyIsValidChanged(bool isValid) const; | 109 void notifyIsValidChanged(bool isValid) const; |
104 | 110 |
105 protected: | 111 protected: |
106 ImageBufferSurface(const IntSize&, OpacityMode, sk_sp<SkColorSpace>); | 112 ImageBufferSurface(const IntSize&, OpacityMode, sk_sp<SkColorSpace>); |
107 void clear(); | 113 void clear(); |
108 | 114 |
109 private: | 115 private: |
110 OpacityMode m_opacityMode; | 116 OpacityMode m_opacityMode; |
111 IntSize m_size; | 117 IntSize m_size; |
112 sk_sp<SkColorSpace> m_colorSpace; | 118 sk_sp<SkColorSpace> m_colorSpace; |
113 }; | 119 }; |
114 | 120 |
115 } // namespace blink | 121 } // namespace blink |
116 | 122 |
117 #endif | 123 #endif |
OLD | NEW |