| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2009 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 5407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5418 texImage2DBase(target, level, internalformat, width, height, 0, format, | 5418 texImage2DBase(target, level, internalformat, width, height, 0, format, |
| 5419 type, 0); | 5419 type, 0); |
| 5420 texImageByGPU(functionID, texture, target, level, internalformat, type, 0, | 5420 texImageByGPU(functionID, texture, target, level, internalformat, type, 0, |
| 5421 0, 0, bitmap, sourceSubRect); | 5421 0, 0, bitmap, sourceSubRect); |
| 5422 } else if (functionID == TexSubImage2D) { | 5422 } else if (functionID == TexSubImage2D) { |
| 5423 texImageByGPU(functionID, texture, target, level, GL_RGBA, type, xoffset, | 5423 texImageByGPU(functionID, texture, target, level, GL_RGBA, type, xoffset, |
| 5424 yoffset, 0, bitmap, sourceSubRect); | 5424 yoffset, 0, bitmap, sourceSubRect); |
| 5425 } | 5425 } |
| 5426 return; | 5426 return; |
| 5427 } | 5427 } |
| 5428 // TODO(ccameron): WebGL should produce sRGB images. | 5428 sk_sp<SkImage> skImage = bitmap->bitmapImage()->imageForCurrentFrame(); |
| 5429 // https://crbug.com/672299 | |
| 5430 sk_sp<SkImage> skImage = bitmap->bitmapImage()->imageForCurrentFrame( | |
| 5431 ColorBehavior::transformToGlobalTarget()); | |
| 5432 SkPixmap pixmap; | 5429 SkPixmap pixmap; |
| 5433 uint8_t* pixelDataPtr = nullptr; | 5430 uint8_t* pixelDataPtr = nullptr; |
| 5434 RefPtr<Uint8Array> pixelData; | 5431 RefPtr<Uint8Array> pixelData; |
| 5435 // In the case where an ImageBitmap is not texture backed, peekPixels() always | 5432 // In the case where an ImageBitmap is not texture backed, peekPixels() always |
| 5436 // succeed. However, when it is texture backed and !canUseTexImageByGPU, we | 5433 // succeed. However, when it is texture backed and !canUseTexImageByGPU, we |
| 5437 // do a GPU read back. | 5434 // do a GPU read back. |
| 5438 bool peekSucceed = skImage->peekPixels(&pixmap); | 5435 bool peekSucceed = skImage->peekPixels(&pixmap); |
| 5439 if (peekSucceed) { | 5436 if (peekSucceed) { |
| 5440 pixelDataPtr = static_cast<uint8_t*>(pixmap.writable_addr()); | 5437 pixelDataPtr = static_cast<uint8_t*>(pixmap.writable_addr()); |
| 5441 } else { | 5438 } else { |
| (...skipping 2396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7838 | 7835 |
| 7839 void WebGLRenderingContextBase::getHTMLOrOffscreenCanvas( | 7836 void WebGLRenderingContextBase::getHTMLOrOffscreenCanvas( |
| 7840 HTMLCanvasElementOrOffscreenCanvas& result) const { | 7837 HTMLCanvasElementOrOffscreenCanvas& result) const { |
| 7841 if (canvas()) | 7838 if (canvas()) |
| 7842 result.setHTMLCanvasElement(canvas()); | 7839 result.setHTMLCanvasElement(canvas()); |
| 7843 else | 7840 else |
| 7844 result.setOffscreenCanvas(offscreenCanvas()); | 7841 result.setOffscreenCanvas(offscreenCanvas()); |
| 7845 } | 7842 } |
| 7846 | 7843 |
| 7847 } // namespace blink | 7844 } // namespace blink |
| OLD | NEW |