• xidachen's avatar
    Pack repeated code in tex(Sub)Image2D and texSubImage3D into helper func · 11401539
    xidachen authored
    There are some repeated code in these functions and the only diff amongest
    them is whether it gives "texImage2D" or "texSubImage2D" or "texSubImage3D".
    
    This CL packs the repeated part into helper function. After this, when
    we make changes to these functions in the future, we would only need to
    change one place instead of 3 places. Also, this will reduce potential
    bugs in the code. For example, at this moment, line 4131 in
    WebGLRenderingContextBase.cpp (texImage2D) does this:
    if (imageForRender && imageForRender->isSVGImage())
    
    while line 1095 in WebGL2RenderingContextBase.cpp (texSubImage3D) does:
    if (imageForRender->isSVGImage())
    which doesn't do a null check on imageForRender.
    
    This change can certainly prevent bugs like this.
    
    For this change, we just need to make sure that all bots are green.
    
    CQ_INCLUDE_TRYBOTS=tryserver.chromium.win:win_optional_gpu_tests_rel;tryserver.chromium.mac:mac_optional_gpu_tests_rel
    
    Review-Url: https://codereview.chromium.org/2025703002
    Cr-Commit-Position: refs/heads/master@{#398286}
    11401539
WebGL2RenderingContextBase.h 16.8 KB