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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
128 void notifySurfaceInvalid(); | 128 void notifySurfaceInvalid(); |
129 | 129 |
130 PassRefPtr<SkImage> newSkImageSnapshot(AccelerationHint) const; | 130 PassRefPtr<SkImage> newSkImageSnapshot(AccelerationHint) const; |
131 PassRefPtr<Image> newImageSnapshot(AccelerationHint = PreferNoAcceleration) const; | 131 PassRefPtr<Image> newImageSnapshot(AccelerationHint = PreferNoAcceleration) const; |
132 | 132 |
133 DisplayItemClient displayItemClient() const { return toDisplayItemClient(thi s); } | 133 DisplayItemClient displayItemClient() const { return toDisplayItemClient(thi s); } |
134 String debugName() const { return "ImageBuffer"; } | 134 String debugName() const { return "ImageBuffer"; } |
135 | 135 |
136 void draw(GraphicsContext*, const FloatRect&, const FloatRect*, SkXfermode:: Mode); | 136 void draw(GraphicsContext*, const FloatRect&, const FloatRect*, SkXfermode:: Mode); |
137 | 137 |
138 void updateGPUMemoryUsage() const; | |
139 static intptr_t getTotalGPUMemoryUsage() { return s_totalGPUMemoryUsage; } | |
Justin Novosad
2015/12/08 22:15:27
Total -> Global
| |
140 intptr_t getGPUMemoryUsage() { return m_gpuMemoryUsage; } | |
141 | |
138 private: | 142 private: |
139 ImageBuffer(PassOwnPtr<ImageBufferSurface>); | 143 ImageBuffer(PassOwnPtr<ImageBufferSurface>); |
140 | 144 |
141 enum SnapshotState { | 145 enum SnapshotState { |
142 InitialSnapshotState, | 146 InitialSnapshotState, |
143 DidAcquireSnapshot, | 147 DidAcquireSnapshot, |
144 DrawnToAfterSnapshot, | 148 DrawnToAfterSnapshot, |
145 }; | 149 }; |
146 mutable SnapshotState m_snapshotState; | 150 mutable SnapshotState m_snapshotState; |
147 OwnPtr<ImageBufferSurface> m_surface; | 151 OwnPtr<ImageBufferSurface> m_surface; |
148 ImageBufferClient* m_client; | 152 ImageBufferClient* m_client; |
153 | |
154 mutable intptr_t m_gpuMemoryUsage; | |
155 static intptr_t s_totalGPUMemoryUsage; | |
149 }; | 156 }; |
150 | 157 |
151 struct ImageDataBuffer { | 158 struct ImageDataBuffer { |
152 STACK_ALLOCATED(); | 159 STACK_ALLOCATED(); |
153 ImageDataBuffer(const IntSize& size, const unsigned char* data) : m_data(dat a), m_size(size) { } | 160 ImageDataBuffer(const IntSize& size, const unsigned char* data) : m_data(dat a), m_size(size) { } |
154 String PLATFORM_EXPORT toDataURL(const String& mimeType, const double& quali ty) const; | 161 String PLATFORM_EXPORT toDataURL(const String& mimeType, const double& quali ty) const; |
155 bool PLATFORM_EXPORT encodeImage(const String& mimeType, const double& quali ty, Vector<unsigned char>* encodedImage) const; | 162 bool PLATFORM_EXPORT encodeImage(const String& mimeType, const double& quali ty, Vector<unsigned char>* encodedImage) const; |
156 const unsigned char* pixels() const { return m_data; } | 163 const unsigned char* pixels() const { return m_data; } |
157 int height() const { return m_size.height(); } | 164 int height() const { return m_size.height(); } |
158 int width() const { return m_size.width(); } | 165 int width() const { return m_size.width(); } |
159 | 166 |
160 const unsigned char* m_data; | 167 const unsigned char* m_data; |
161 const IntSize m_size; | 168 const IntSize m_size; |
162 }; | 169 }; |
163 | 170 |
164 } // namespace blink | 171 } // namespace blink |
165 | 172 |
166 #endif // ImageBuffer_h | 173 #endif // ImageBuffer_h |
OLD | NEW |