Chromium Code Reviews| 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 1497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1508 if (buffer && !buffer->getInitialTarget()) | 1508 if (buffer && !buffer->getInitialTarget()) |
| 1509 buffer->setInitialTarget(target); | 1509 buffer->setInitialTarget(target); |
| 1510 return true; | 1510 return true; |
| 1511 } | 1511 } |
| 1512 | 1512 |
| 1513 void WebGLRenderingContextBase::bindBuffer(GLenum target, WebGLBuffer* buffer) | 1513 void WebGLRenderingContextBase::bindBuffer(GLenum target, WebGLBuffer* buffer) |
| 1514 { | 1514 { |
| 1515 bool deleted; | 1515 bool deleted; |
| 1516 if (!checkObjectToBeBound("bindBuffer", buffer, deleted)) | 1516 if (!checkObjectToBeBound("bindBuffer", buffer, deleted)) |
| 1517 return; | 1517 return; |
| 1518 if (deleted) | 1518 if (deleted) { |
| 1519 buffer = 0; | 1519 synthesizeGLError(GL_INVALID_OPERATION, "bindBuffer", "attempt to bind a deleted buffer"); |
| 1520 return; | |
| 1521 } | |
| 1520 if (!validateAndUpdateBufferBindTarget("bindBuffer", target, buffer)) | 1522 if (!validateAndUpdateBufferBindTarget("bindBuffer", target, buffer)) |
| 1521 return; | 1523 return; |
| 1522 | 1524 |
| 1523 contextGL()->BindBuffer(target, objectOrZero(buffer)); | 1525 contextGL()->BindBuffer(target, objectOrZero(buffer)); |
| 1524 } | 1526 } |
| 1525 | 1527 |
| 1526 void WebGLRenderingContextBase::bindFramebuffer(GLenum target, WebGLFramebuffer* buffer) | 1528 void WebGLRenderingContextBase::bindFramebuffer(GLenum target, WebGLFramebuffer* buffer) |
| 1527 { | 1529 { |
| 1528 bool deleted; | 1530 bool deleted; |
| 1529 if (!checkObjectToBeBound("bindFramebuffer", buffer, deleted)) | 1531 if (!checkObjectToBeBound("bindFramebuffer", buffer, deleted)) |
| 1530 return; | 1532 return; |
| 1531 | 1533 if (deleted) { |
| 1532 if (deleted) | 1534 synthesizeGLError(GL_INVALID_OPERATION, "bindFramebuffer", "attempt to b ind a deleted framebuffer"); |
| 1533 buffer = 0; | 1535 return; |
| 1536 } | |
| 1534 | 1537 |
| 1535 if (target != GL_FRAMEBUFFER) { | 1538 if (target != GL_FRAMEBUFFER) { |
| 1536 synthesizeGLError(GL_INVALID_ENUM, "bindFramebuffer", "invalid target"); | 1539 synthesizeGLError(GL_INVALID_ENUM, "bindFramebuffer", "invalid target"); |
| 1537 return; | 1540 return; |
| 1538 } | 1541 } |
| 1539 | 1542 |
| 1540 setFramebuffer(target, buffer); | 1543 setFramebuffer(target, buffer); |
| 1541 } | 1544 } |
| 1542 | 1545 |
| 1543 void WebGLRenderingContextBase::bindRenderbuffer(GLenum target, WebGLRenderbuffe r* renderBuffer) | 1546 void WebGLRenderingContextBase::bindRenderbuffer(GLenum target, WebGLRenderbuffe r* renderBuffer) |
| 1544 { | 1547 { |
| 1545 bool deleted; | 1548 bool deleted; |
| 1546 if (!checkObjectToBeBound("bindRenderbuffer", renderBuffer, deleted)) | 1549 if (!checkObjectToBeBound("bindRenderbuffer", renderBuffer, deleted)) |
| 1547 return; | 1550 return; |
| 1548 if (deleted) | 1551 if (deleted) { |
| 1549 renderBuffer = 0; | 1552 synthesizeGLError(GL_INVALID_OPERATION, "bindBuffer", "attempt to bind a deleted renderbuffer"); |
|
qiankun
2016/09/08 09:01:00
typo: bindBuffer -> bindRenderbuffer
| |
| 1553 return; | |
| 1554 } | |
| 1550 if (target != GL_RENDERBUFFER) { | 1555 if (target != GL_RENDERBUFFER) { |
| 1551 synthesizeGLError(GL_INVALID_ENUM, "bindRenderbuffer", "invalid target") ; | 1556 synthesizeGLError(GL_INVALID_ENUM, "bindRenderbuffer", "invalid target") ; |
| 1552 return; | 1557 return; |
| 1553 } | 1558 } |
| 1554 m_renderbufferBinding = renderBuffer; | 1559 m_renderbufferBinding = renderBuffer; |
| 1555 contextGL()->BindRenderbuffer(target, objectOrZero(renderBuffer)); | 1560 contextGL()->BindRenderbuffer(target, objectOrZero(renderBuffer)); |
| 1556 | 1561 |
| 1557 drawingBuffer()->setRenderbufferBinding(objectOrZero(renderBuffer)); | 1562 drawingBuffer()->setRenderbufferBinding(objectOrZero(renderBuffer)); |
| 1558 | 1563 |
| 1559 if (renderBuffer) | 1564 if (renderBuffer) |
| 1560 renderBuffer->setHasEverBeenBound(); | 1565 renderBuffer->setHasEverBeenBound(); |
| 1561 } | 1566 } |
| 1562 | 1567 |
| 1563 void WebGLRenderingContextBase::bindTexture(GLenum target, WebGLTexture* texture ) | 1568 void WebGLRenderingContextBase::bindTexture(GLenum target, WebGLTexture* texture ) |
| 1564 { | 1569 { |
| 1565 bool deleted; | 1570 bool deleted; |
| 1566 if (!checkObjectToBeBound("bindTexture", texture, deleted)) | 1571 if (!checkObjectToBeBound("bindTexture", texture, deleted)) |
| 1567 return; | 1572 return; |
| 1568 if (deleted) | 1573 if (deleted) { |
| 1569 texture = 0; | 1574 synthesizeGLError(GL_INVALID_OPERATION, "bindTexture", "attempt to bind a deleted texture"); |
| 1575 return; | |
| 1576 } | |
| 1570 if (texture && texture->getTarget() && texture->getTarget() != target) { | 1577 if (texture && texture->getTarget() && texture->getTarget() != target) { |
| 1571 synthesizeGLError(GL_INVALID_OPERATION, "bindTexture", "textures can not be used with multiple targets"); | 1578 synthesizeGLError(GL_INVALID_OPERATION, "bindTexture", "textures can not be used with multiple targets"); |
| 1572 return; | 1579 return; |
| 1573 } | 1580 } |
| 1574 | 1581 |
| 1575 if (target == GL_TEXTURE_2D) { | 1582 if (target == GL_TEXTURE_2D) { |
| 1576 m_textureUnits[m_activeTextureUnit].m_texture2DBinding = texture; | 1583 m_textureUnits[m_activeTextureUnit].m_texture2DBinding = texture; |
| 1577 | 1584 |
| 1578 if (!m_activeTextureUnit) | 1585 if (!m_activeTextureUnit) |
| 1579 drawingBuffer()->setTexture2DBinding(objectOrZero(texture)); | 1586 drawingBuffer()->setTexture2DBinding(objectOrZero(texture)); |
| (...skipping 4857 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6437 | 6444 |
| 6438 void WebGLRenderingContextBase::getHTMLOrOffscreenCanvas(HTMLCanvasElementOrOffs creenCanvas& result) const | 6445 void WebGLRenderingContextBase::getHTMLOrOffscreenCanvas(HTMLCanvasElementOrOffs creenCanvas& result) const |
| 6439 { | 6446 { |
| 6440 if (canvas()) | 6447 if (canvas()) |
| 6441 result.setHTMLCanvasElement(canvas()); | 6448 result.setHTMLCanvasElement(canvas()); |
| 6442 else | 6449 else |
| 6443 result.setOffscreenCanvas(getOffscreenCanvas()); | 6450 result.setOffscreenCanvas(getOffscreenCanvas()); |
| 6444 } | 6451 } |
| 6445 | 6452 |
| 6446 } // namespace blink | 6453 } // namespace blink |
| OLD | NEW |