OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org> | 2 * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org> |
3 * Copyright (C) 2007, 2008, 2009 Apple Inc. All rights reserved. | 3 * Copyright (C) 2007, 2008, 2009 Apple Inc. All rights reserved. |
4 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved. | 4 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved. |
5 * | 5 * |
6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
8 * are met: | 8 * are met: |
9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 bool isExpensiveToPaint() const { return m_surface->isExpensiveToPaint(); } | 94 bool isExpensiveToPaint() const { return m_surface->isExpensiveToPaint(); } |
95 void prepareSurfaceForPaintingIfNeeded() { | 95 void prepareSurfaceForPaintingIfNeeded() { |
96 m_surface->prepareSurfaceForPaintingIfNeeded(); | 96 m_surface->prepareSurfaceForPaintingIfNeeded(); |
97 } | 97 } |
98 bool isSurfaceValid() const; | 98 bool isSurfaceValid() const; |
99 bool restoreSurface() const; | 99 bool restoreSurface() const; |
100 void didDraw(const FloatRect&) const; | 100 void didDraw(const FloatRect&) const; |
101 bool wasDrawnToAfterSnapshot() const { | 101 bool wasDrawnToAfterSnapshot() const { |
102 return m_snapshotState == DrawnToAfterSnapshot; | 102 return m_snapshotState == DrawnToAfterSnapshot; |
103 } | 103 } |
104 void didDisableAcceleration() const; | |
105 | 104 |
106 void setFilterQuality(SkFilterQuality filterQuality) { | 105 void setFilterQuality(SkFilterQuality filterQuality) { |
107 m_surface->setFilterQuality(filterQuality); | 106 m_surface->setFilterQuality(filterQuality); |
108 } | 107 } |
109 void setIsHidden(bool hidden) { m_surface->setIsHidden(hidden); } | 108 void setIsHidden(bool hidden) { m_surface->setIsHidden(hidden); } |
110 | 109 |
111 // Called by subclasses of ImageBufferSurface to install a new canvas object. | 110 // Called by subclasses of ImageBufferSurface to install a new canvas object. |
112 // Virtual for mocking | 111 // Virtual for mocking |
113 virtual void resetCanvas(SkCanvas*) const; | 112 virtual void resetCanvas(SkCanvas*) const; |
114 | 113 |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 void draw(GraphicsContext&, const FloatRect&, const FloatRect*, SkBlendMode); | 174 void draw(GraphicsContext&, const FloatRect&, const FloatRect*, SkBlendMode); |
176 | 175 |
177 void updateGPUMemoryUsage() const; | 176 void updateGPUMemoryUsage() const; |
178 static intptr_t getGlobalGPUMemoryUsage() { return s_globalGPUMemoryUsage; } | 177 static intptr_t getGlobalGPUMemoryUsage() { return s_globalGPUMemoryUsage; } |
179 static unsigned getGlobalAcceleratedImageBufferCount() { | 178 static unsigned getGlobalAcceleratedImageBufferCount() { |
180 return s_globalAcceleratedImageBufferCount; | 179 return s_globalAcceleratedImageBufferCount; |
181 } | 180 } |
182 intptr_t getGPUMemoryUsage() { return m_gpuMemoryUsage; } | 181 intptr_t getGPUMemoryUsage() { return m_gpuMemoryUsage; } |
183 | 182 |
184 void disableAcceleration(); | 183 void disableAcceleration(); |
| 184 void setSurface(std::unique_ptr<ImageBufferSurface>); |
185 | 185 |
186 WeakPtrFactory<ImageBuffer> m_weakPtrFactory; | 186 WeakPtrFactory<ImageBuffer> m_weakPtrFactory; |
187 | 187 |
188 protected: | 188 protected: |
189 ImageBuffer(std::unique_ptr<ImageBufferSurface>); | 189 ImageBuffer(std::unique_ptr<ImageBufferSurface>); |
190 | 190 |
191 private: | 191 private: |
192 enum SnapshotState { | 192 enum SnapshotState { |
193 InitialSnapshotState, | 193 InitialSnapshotState, |
194 DidAcquireSnapshot, | 194 DidAcquireSnapshot, |
(...skipping 22 matching lines...) Expand all Loading... |
217 int height() const { return m_size.height(); } | 217 int height() const { return m_size.height(); } |
218 int width() const { return m_size.width(); } | 218 int width() const { return m_size.width(); } |
219 | 219 |
220 const unsigned char* m_data; | 220 const unsigned char* m_data; |
221 const IntSize m_size; | 221 const IntSize m_size; |
222 }; | 222 }; |
223 | 223 |
224 } // namespace blink | 224 } // namespace blink |
225 | 225 |
226 #endif // ImageBuffer_h | 226 #endif // ImageBuffer_h |
OLD | NEW |