Changeset 69588 in webkit
- Timestamp:
- Oct 12, 2010 10:30:55 AM (13 years ago)
- Location:
- trunk/WebKit/chromium
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebKit/chromium/ChangeLog
r69586 r69588 1 2010-10-07 Stephen White <senorblanco@chromium.org> 2 3 Reviewed by James Robinson. 4 5 [chromium] Zero-out all textures created via WebGraphicsContext3DDefaultImpl::texImage2D(). 6 https://bugs.webkit.org/show_bug.cgi?id=47178 7 8 Covered by fast/canvas/toDataURL-alpha.html, when run with --accelerated-2d-canvas. 9 10 * src/WebGraphicsContext3DDefaultImpl.cpp: 11 (WebKit::bytesPerComponent): 12 (WebKit::componentsPerPixel): 13 (WebKit::imageSizeInBytes): 14 (WebKit::WebGraphicsContext3DDefaultImpl::texImage2D): 15 1 16 2010-10-12 Dave Moore <davemoore@chromium.org> 2 17 -
trunk/WebKit/chromium/src/WebGraphicsContext3DDefaultImpl.cpp
r69139 r69588 39 39 #include "NotImplemented.h" 40 40 #include "WebView.h" 41 #include <wtf/OwnArrayPtr.h> 41 42 #include <wtf/PassOwnPtr.h> 42 43 #include <wtf/text/CString.h> … … 1191 1192 DELEGATE_TO_GL_4(scissor, Scissor, long, long, unsigned long, unsigned long) 1192 1193 1194 unsigned bytesPerComponent(unsigned type) 1195 { 1196 switch (type) { 1197 case GL_BYTE: 1198 case GL_UNSIGNED_BYTE: 1199 return 1; 1200 case GL_SHORT: 1201 case GL_UNSIGNED_SHORT: 1202 case GL_UNSIGNED_SHORT_5_6_5: 1203 case GL_UNSIGNED_SHORT_4_4_4_4: 1204 case GL_UNSIGNED_SHORT_5_5_5_1: 1205 return 2; 1206 case GL_FLOAT: 1207 return 4; 1208 default: 1209 return 4; 1210 } 1211 } 1212 1213 unsigned componentsPerPixel(unsigned format, unsigned type) 1214 { 1215 switch (type) { 1216 case GL_UNSIGNED_SHORT_5_6_5: 1217 case GL_UNSIGNED_SHORT_4_4_4_4: 1218 case GL_UNSIGNED_SHORT_5_5_5_1: 1219 return 1; 1220 default: 1221 break; 1222 } 1223 switch (format) { 1224 case GL_LUMINANCE: 1225 return 1; 1226 case GL_LUMINANCE_ALPHA: 1227 return 2; 1228 case GL_RGB: 1229 return 3; 1230 case GL_RGBA: 1231 case GL_BGRA_EXT: 1232 return 4; 1233 default: 1234 return 4; 1235 } 1236 } 1237 1238 // N.B.: This code does not protect against integer overflow (as the command 1239 // buffer implementation does), so it should not be considered robust enough 1240 // for use in the browser. Since this implementation is only used for layout 1241 // tests, this should be ok for now. 1242 size_t imageSizeInBytes(unsigned width, unsigned height, unsigned format, unsigned type) 1243 { 1244 return width * height * bytesPerComponent(type) * componentsPerPixel(format, type); 1245 } 1246 1247 void WebGraphicsContext3DDefaultImpl::texImage2D(unsigned target, unsigned level, unsigned internalFormat, unsigned width, unsigned height, unsigned border, unsigned format, unsigned type, const void* pixels) 1248 { 1249 OwnArrayPtr<uint8> zero; 1250 if (!pixels) { 1251 size_t size = imageSizeInBytes(width, height, format, type); 1252 zero.set(new uint8[size]); 1253 memset(zero.get(), 0, size); 1254 pixels = zero.get(); 1255 } 1256 glTexImage2D(target, level, internalFormat, width, height, border, format, type, pixels); 1257 } 1258 1193 1259 void WebGraphicsContext3DDefaultImpl::shaderSource(WebGLId shader, const char* string) 1194 1260 { … … 1221 1287 1222 1288 DELEGATE_TO_GL_4(stencilOpSeparate, StencilOpSeparate, unsigned long, unsigned long, unsigned long, unsigned long) 1223 1224 DELEGATE_TO_GL_9(texImage2D, TexImage2D, unsigned, unsigned, unsigned, unsigned, unsigned, unsigned, unsigned, unsigned, const void*)1225 1289 1226 1290 DELEGATE_TO_GL_3(texParameterf, TexParameterf, unsigned, unsigned, float);
Note: See TracChangeset
for help on using the changeset viewer.