| 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 5408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5419 texImage2DBase(target, level, internalformat, width, height, 0, format, | 5419 texImage2DBase(target, level, internalformat, width, height, 0, format, |
| 5420 type, 0); | 5420 type, 0); |
| 5421 texImageByGPU(functionID, texture, target, level, internalformat, type, 0, | 5421 texImageByGPU(functionID, texture, target, level, internalformat, type, 0, |
| 5422 0, 0, bitmap, sourceSubRect); | 5422 0, 0, bitmap, sourceSubRect); |
| 5423 } else if (functionID == TexSubImage2D) { | 5423 } else if (functionID == TexSubImage2D) { |
| 5424 texImageByGPU(functionID, texture, target, level, GL_RGBA, type, xoffset, | 5424 texImageByGPU(functionID, texture, target, level, GL_RGBA, type, xoffset, |
| 5425 yoffset, 0, bitmap, sourceSubRect); | 5425 yoffset, 0, bitmap, sourceSubRect); |
| 5426 } | 5426 } |
| 5427 return; | 5427 return; |
| 5428 } | 5428 } |
| 5429 // TODO(ccameron): WebGL should produce sRGB images. | 5429 sk_sp<SkImage> skImage = bitmap->bitmapImage()->imageForCurrentFrame(); |
| 5430 // https://crbug.com/672299 | |
| 5431 sk_sp<SkImage> skImage = bitmap->bitmapImage()->imageForCurrentFrame( | |
| 5432 ColorBehavior::transformToGlobalTarget()); | |
| 5433 SkPixmap pixmap; | 5430 SkPixmap pixmap; |
| 5434 uint8_t* pixelDataPtr = nullptr; | 5431 uint8_t* pixelDataPtr = nullptr; |
| 5435 RefPtr<Uint8Array> pixelData; | 5432 RefPtr<Uint8Array> pixelData; |
| 5436 // In the case where an ImageBitmap is not texture backed, peekPixels() always | 5433 // In the case where an ImageBitmap is not texture backed, peekPixels() always |
| 5437 // succeed. However, when it is texture backed and !canUseTexImageByGPU, we | 5434 // succeed. However, when it is texture backed and !canUseTexImageByGPU, we |
| 5438 // do a GPU read back. | 5435 // do a GPU read back. |
| 5439 bool peekSucceed = skImage->peekPixels(&pixmap); | 5436 bool peekSucceed = skImage->peekPixels(&pixmap); |
| 5440 if (peekSucceed) { | 5437 if (peekSucceed) { |
| 5441 pixelDataPtr = static_cast<uint8_t*>(pixmap.writable_addr()); | 5438 pixelDataPtr = static_cast<uint8_t*>(pixmap.writable_addr()); |
| 5442 } else { | 5439 } else { |
| (...skipping 2396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7839 | 7836 |
| 7840 void WebGLRenderingContextBase::getHTMLOrOffscreenCanvas( | 7837 void WebGLRenderingContextBase::getHTMLOrOffscreenCanvas( |
| 7841 HTMLCanvasElementOrOffscreenCanvas& result) const { | 7838 HTMLCanvasElementOrOffscreenCanvas& result) const { |
| 7842 if (canvas()) | 7839 if (canvas()) |
| 7843 result.setHTMLCanvasElement(canvas()); | 7840 result.setHTMLCanvasElement(canvas()); |
| 7844 else | 7841 else |
| 7845 result.setOffscreenCanvas(offscreenCanvas()); | 7842 result.setOffscreenCanvas(offscreenCanvas()); |
| 7846 } | 7843 } |
| 7847 | 7844 |
| 7848 } // namespace blink | 7845 } // namespace blink |
| OLD | NEW |