Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(155)

Side by Side Diff: third_party/WebKit/Source/platform/graphics/ImageBuffer.h

Issue 2687073003: Make disabling 2d canvas GPU acceleration for getImageData less aggressive. (Closed)
Patch Set: Address comments Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 private: 189 private:
190 enum SnapshotState { 190 enum SnapshotState {
191 InitialSnapshotState, 191 InitialSnapshotState,
192 DidAcquireSnapshot, 192 DidAcquireSnapshot,
193 DrawnToAfterSnapshot, 193 DrawnToAfterSnapshot,
194 }; 194 };
195 mutable SnapshotState m_snapshotState; 195 mutable SnapshotState m_snapshotState;
196 std::unique_ptr<ImageBufferSurface> m_surface; 196 std::unique_ptr<ImageBufferSurface> m_surface;
197 ImageBufferClient* m_client; 197 ImageBufferClient* m_client;
198 198
199 mutable bool m_gpuReadbackInvokedInCurrentFrame;
200 int m_gpuReadbackSuccessiveFrames;
201
199 mutable intptr_t m_gpuMemoryUsage; 202 mutable intptr_t m_gpuMemoryUsage;
200 static intptr_t s_globalGPUMemoryUsage; 203 static intptr_t s_globalGPUMemoryUsage;
201 static unsigned s_globalAcceleratedImageBufferCount; 204 static unsigned s_globalAcceleratedImageBufferCount;
202 }; 205 };
203 206
204 struct ImageDataBuffer { 207 struct ImageDataBuffer {
205 STACK_ALLOCATED(); 208 STACK_ALLOCATED();
206 ImageDataBuffer(const IntSize& size, const unsigned char* data) 209 ImageDataBuffer(const IntSize& size, const unsigned char* data)
207 : m_data(data), m_size(size) {} 210 : m_data(data), m_size(size) {}
208 String PLATFORM_EXPORT toDataURL(const String& mimeType, 211 String PLATFORM_EXPORT toDataURL(const String& mimeType,
209 const double& quality) const; 212 const double& quality) const;
210 bool PLATFORM_EXPORT encodeImage(const String& mimeType, 213 bool PLATFORM_EXPORT encodeImage(const String& mimeType,
211 const double& quality, 214 const double& quality,
212 Vector<unsigned char>* encodedImage) const; 215 Vector<unsigned char>* encodedImage) const;
213 const unsigned char* pixels() const { return m_data; } 216 const unsigned char* pixels() const { return m_data; }
214 const IntSize& size() const { return m_size; } 217 const IntSize& size() const { return m_size; }
215 int height() const { return m_size.height(); } 218 int height() const { return m_size.height(); }
216 int width() const { return m_size.width(); } 219 int width() const { return m_size.width(); }
217 220
218 const unsigned char* m_data; 221 const unsigned char* m_data;
219 const IntSize m_size; 222 const IntSize m_size;
220 }; 223 };
221 224
222 } // namespace blink 225 } // namespace blink
223 226
224 #endif // ImageBuffer_h 227 #endif // ImageBuffer_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698