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

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

Issue 1315323006: webgl: optimize webgl.texSubImage2D(video) path. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase to ToT Created 5 years, 1 month 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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 115
116 void putByteArray(Multiply, const unsigned char* source, const IntSize& sour ceSize, const IntRect& sourceRect, const IntPoint& destPoint); 116 void putByteArray(Multiply, const unsigned char* source, const IntSize& sour ceSize, const IntRect& sourceRect, const IntPoint& destPoint);
117 117
118 AffineTransform baseTransform() const { return AffineTransform(); } 118 AffineTransform baseTransform() const { return AffineTransform(); }
119 WebLayer* platformLayer() const; 119 WebLayer* platformLayer() const;
120 120
121 // FIXME: current implementations of this method have the restriction that t hey only work 121 // FIXME: current implementations of this method have the restriction that t hey only work
122 // with textures that are RGB or RGBA format, UNSIGNED_BYTE type and level 0 , as specified in 122 // with textures that are RGB or RGBA format, UNSIGNED_BYTE type and level 0 , as specified in
123 // Extensions3D::canUseCopyTextureCHROMIUM(). 123 // Extensions3D::canUseCopyTextureCHROMIUM().
124 // Destroys the TEXTURE_2D binding for the active texture unit of the passed context 124 // Destroys the TEXTURE_2D binding for the active texture unit of the passed context
125 bool copyToPlatformTexture(WebGraphicsContext3D*, Platform3DObject, GLenum, GLenum, GLint, bool, bool); 125 bool copyToPlatformTexture(WebGraphicsContext3D*, GLenum, Platform3DObject, GLenum, GLenum, GLint, bool, bool);
126 bool copySubToPlatformTexture(WebGraphicsContext3D*, GLenum, Platform3DObjec t, GLint, GLint xoffset,
127 GLint yoffset, GLsizei width, GLsizei height, bool, bool);
126 128
127 bool copyRenderingResultsFromDrawingBuffer(DrawingBuffer*, SourceDrawingBuff er); 129 bool copyRenderingResultsFromDrawingBuffer(DrawingBuffer*, SourceDrawingBuff er);
128 130
129 void flush(); // process deferred draw commands immediately 131 void flush(); // process deferred draw commands immediately
130 void flushGpu(); // Like flush(), but flushes all the way down to the Gpu co ntext if the surface is accelerated 132 void flushGpu(); // Like flush(), but flushes all the way down to the Gpu co ntext if the surface is accelerated
131 133
132 void notifySurfaceInvalid(); 134 void notifySurfaceInvalid();
133 135
134 PassRefPtr<SkImage> newSkImageSnapshot(AccelerationHint) const; 136 PassRefPtr<SkImage> newSkImageSnapshot(AccelerationHint) const;
135 PassRefPtr<Image> newImageSnapshot(AccelerationHint = PreferNoAcceleration) const; 137 PassRefPtr<Image> newImageSnapshot(AccelerationHint = PreferNoAcceleration) const;
136 138
137 DisplayItemClient displayItemClient() const { return toDisplayItemClient(thi s); } 139 DisplayItemClient displayItemClient() const { return toDisplayItemClient(thi s); }
138 String debugName() const { return "ImageBuffer"; } 140 String debugName() const { return "ImageBuffer"; }
139 141
140 void draw(GraphicsContext*, const FloatRect&, const FloatRect*, SkXfermode:: Mode); 142 void draw(GraphicsContext*, const FloatRect&, const FloatRect*, SkXfermode:: Mode);
141 143
142 private: 144 private:
143 ImageBuffer(PassOwnPtr<ImageBufferSurface>); 145 ImageBuffer(PassOwnPtr<ImageBufferSurface>);
144 146
145 enum SnapshotState { 147 enum SnapshotState {
146 InitialSnapshotState, 148 InitialSnapshotState,
147 DidAcquireSnapshot, 149 DidAcquireSnapshot,
148 DrawnToAfterSnapshot, 150 DrawnToAfterSnapshot,
149 }; 151 };
150 mutable SnapshotState m_snapshotState; 152 mutable SnapshotState m_snapshotState;
153
154 bool copyToPlatformTextureInternal(bool isFullCopy, WebGraphicsContext3D*, G Lenum, Platform3DObject, GLenum, GLenum,
155 GLint, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, bool , bool);
156
151 OwnPtr<ImageBufferSurface> m_surface; 157 OwnPtr<ImageBufferSurface> m_surface;
152 ImageBufferClient* m_client; 158 ImageBufferClient* m_client;
153 }; 159 };
154 160
155 struct ImageDataBuffer { 161 struct ImageDataBuffer {
156 ImageDataBuffer(const IntSize& size, const unsigned char* data) : m_data(dat a), m_size(size) { } 162 ImageDataBuffer(const IntSize& size, const unsigned char* data) : m_data(dat a), m_size(size) { }
157 String PLATFORM_EXPORT toDataURL(const String& mimeType, const double& quali ty) const; 163 String PLATFORM_EXPORT toDataURL(const String& mimeType, const double& quali ty) const;
158 bool PLATFORM_EXPORT encodeImage(const String& mimeType, const double& quali ty, Vector<char>* output) const; 164 bool PLATFORM_EXPORT encodeImage(const String& mimeType, const double& quali ty, Vector<char>* output) const;
159 const unsigned char* pixels() const { return m_data; } 165 const unsigned char* pixels() const { return m_data; }
160 int height() const { return m_size.height(); } 166 int height() const { return m_size.height(); }
161 int width() const { return m_size.width(); } 167 int width() const { return m_size.width(); }
162 168
163 const unsigned char* m_data; 169 const unsigned char* m_data;
164 const IntSize m_size; 170 const IntSize m_size;
165 }; 171 };
166 172
167 } // namespace blink 173 } // namespace blink
168 174
169 #endif // ImageBuffer_h 175 #endif // ImageBuffer_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698