| 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 4526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4537 | 4537 |
| 4538 if (functionID != TexSubImage3D && bitmap->isTextureBacked() && canUseTexIma
geByGPU(functionID, internalformat, type)) { | 4538 if (functionID != TexSubImage3D && bitmap->isTextureBacked() && canUseTexIma
geByGPU(functionID, internalformat, type)) { |
| 4539 if (functionID == TexImage2D) { | 4539 if (functionID == TexImage2D) { |
| 4540 texImage2DBase(target, level, internalformat, bitmap->width(), bitma
p->height(), 0, format, type, 0); | 4540 texImage2DBase(target, level, internalformat, bitmap->width(), bitma
p->height(), 0, format, type, 0); |
| 4541 texImageByGPU(TexImage2DByGPU, texture, target, level, internalforma
t, type, 0, 0, 0, bitmap); | 4541 texImageByGPU(TexImage2DByGPU, texture, target, level, internalforma
t, type, 0, 0, 0, bitmap); |
| 4542 } else if (functionID == TexSubImage2D) { | 4542 } else if (functionID == TexSubImage2D) { |
| 4543 texImageByGPU(TexSubImage2DByGPU, texture, target, level, GL_RGBA, t
ype, xoffset, yoffset, 0, bitmap); | 4543 texImageByGPU(TexSubImage2DByGPU, texture, target, level, GL_RGBA, t
ype, xoffset, yoffset, 0, bitmap); |
| 4544 } | 4544 } |
| 4545 return; | 4545 return; |
| 4546 } | 4546 } |
| 4547 RefPtr<SkImage> skImage = bitmap->bitmapImage()->imageForCurrentFrame(); | 4547 sk_sp<SkImage> skImage = bitmap->bitmapImage()->imageForCurrentFrame(); |
| 4548 SkPixmap pixmap; | 4548 SkPixmap pixmap; |
| 4549 uint8_t* pixelDataPtr = nullptr; | 4549 uint8_t* pixelDataPtr = nullptr; |
| 4550 RefPtr<Uint8Array> pixelData; | 4550 RefPtr<Uint8Array> pixelData; |
| 4551 // In the case where an ImageBitmap is not texture backed, peekPixels() alwa
ys succeed. | 4551 // In the case where an ImageBitmap is not texture backed, peekPixels() alwa
ys succeed. |
| 4552 // However, when it is texture backed and !canUseTexImageByGPU, we do a GPU
read back. | 4552 // However, when it is texture backed and !canUseTexImageByGPU, we do a GPU
read back. |
| 4553 bool peekSucceed = skImage->peekPixels(&pixmap); | 4553 bool peekSucceed = skImage->peekPixels(&pixmap); |
| 4554 if (peekSucceed) { | 4554 if (peekSucceed) { |
| 4555 pixelDataPtr = static_cast<uint8_t*>(pixmap.writable_addr()); | 4555 pixelDataPtr = static_cast<uint8_t*>(pixmap.writable_addr()); |
| 4556 } else { | 4556 } else { |
| 4557 pixelData = bitmap->copyBitmapData(bitmap->isPremultiplied() ? Premultip
lyAlpha : DontPremultiplyAlpha); | 4557 pixelData = bitmap->copyBitmapData(bitmap->isPremultiplied() ? Premultip
lyAlpha : DontPremultiplyAlpha); |
| (...skipping 1955 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6513 | 6513 |
| 6514 void WebGLRenderingContextBase::getHTMLOrOffscreenCanvas(HTMLCanvasElementOrOffs
creenCanvas& result) const | 6514 void WebGLRenderingContextBase::getHTMLOrOffscreenCanvas(HTMLCanvasElementOrOffs
creenCanvas& result) const |
| 6515 { | 6515 { |
| 6516 if (canvas()) | 6516 if (canvas()) |
| 6517 result.setHTMLCanvasElement(canvas()); | 6517 result.setHTMLCanvasElement(canvas()); |
| 6518 else | 6518 else |
| 6519 result.setOffscreenCanvas(getOffscreenCanvas()); | 6519 result.setOffscreenCanvas(getOffscreenCanvas()); |
| 6520 } | 6520 } |
| 6521 | 6521 |
| 6522 } // namespace blink | 6522 } // namespace blink |
| OLD | NEW |