| 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 4505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4516 | 4516 |
| 4517 if (functionID != TexSubImage3D && bitmap->isTextureBacked() && canUseTexIma
geByGPU(functionID, internalformat, type)) { | 4517 if (functionID != TexSubImage3D && bitmap->isTextureBacked() && canUseTexIma
geByGPU(functionID, internalformat, type)) { |
| 4518 if (functionID == TexImage2D) { | 4518 if (functionID == TexImage2D) { |
| 4519 texImage2DBase(target, level, internalformat, bitmap->width(), bitma
p->height(), 0, format, type, 0); | 4519 texImage2DBase(target, level, internalformat, bitmap->width(), bitma
p->height(), 0, format, type, 0); |
| 4520 texImageByGPU(TexImage2DByGPU, texture, target, level, internalforma
t, type, 0, 0, 0, bitmap); | 4520 texImageByGPU(TexImage2DByGPU, texture, target, level, internalforma
t, type, 0, 0, 0, bitmap); |
| 4521 } else if (functionID == TexSubImage2D) { | 4521 } else if (functionID == TexSubImage2D) { |
| 4522 texImageByGPU(TexSubImage2DByGPU, texture, target, level, GL_RGBA, t
ype, xoffset, yoffset, 0, bitmap); | 4522 texImageByGPU(TexSubImage2DByGPU, texture, target, level, GL_RGBA, t
ype, xoffset, yoffset, 0, bitmap); |
| 4523 } | 4523 } |
| 4524 return; | 4524 return; |
| 4525 } | 4525 } |
| 4526 RefPtr<SkImage> skImage = bitmap->bitmapImage()->imageForCurrentFrame(); | 4526 sk_sp<SkImage> skImage = bitmap->bitmapImage()->imageForCurrentFrame(); |
| 4527 SkPixmap pixmap; | 4527 SkPixmap pixmap; |
| 4528 uint8_t* pixelDataPtr = nullptr; | 4528 uint8_t* pixelDataPtr = nullptr; |
| 4529 RefPtr<Uint8Array> pixelData; | 4529 RefPtr<Uint8Array> pixelData; |
| 4530 // In the case where an ImageBitmap is not texture backed, peekPixels() alwa
ys succeed. | 4530 // In the case where an ImageBitmap is not texture backed, peekPixels() alwa
ys succeed. |
| 4531 // However, when it is texture backed and !canUseTexImageByGPU, we do a GPU
read back. | 4531 // However, when it is texture backed and !canUseTexImageByGPU, we do a GPU
read back. |
| 4532 bool peekSucceed = skImage->peekPixels(&pixmap); | 4532 bool peekSucceed = skImage->peekPixels(&pixmap); |
| 4533 if (peekSucceed) { | 4533 if (peekSucceed) { |
| 4534 pixelDataPtr = static_cast<uint8_t*>(pixmap.writable_addr()); | 4534 pixelDataPtr = static_cast<uint8_t*>(pixmap.writable_addr()); |
| 4535 } else { | 4535 } else { |
| 4536 pixelData = bitmap->copyBitmapData(bitmap->isPremultiplied() ? Premultip
lyAlpha : DontPremultiplyAlpha); | 4536 pixelData = bitmap->copyBitmapData(bitmap->isPremultiplied() ? Premultip
lyAlpha : DontPremultiplyAlpha); |
| (...skipping 1955 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6492 | 6492 |
| 6493 void WebGLRenderingContextBase::getHTMLOrOffscreenCanvas(HTMLCanvasElementOrOffs
creenCanvas& result) const | 6493 void WebGLRenderingContextBase::getHTMLOrOffscreenCanvas(HTMLCanvasElementOrOffs
creenCanvas& result) const |
| 6494 { | 6494 { |
| 6495 if (canvas()) | 6495 if (canvas()) |
| 6496 result.setHTMLCanvasElement(canvas()); | 6496 result.setHTMLCanvasElement(canvas()); |
| 6497 else | 6497 else |
| 6498 result.setOffscreenCanvas(getOffscreenCanvas()); | 6498 result.setOffscreenCanvas(getOffscreenCanvas()); |
| 6499 } | 6499 } |
| 6500 | 6500 |
| 6501 } // namespace blink | 6501 } // namespace blink |
| OLD | NEW |