| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 | 8 |
| 9 #include "GrGpuGL.h" | 9 #include "GrGpuGL.h" |
| 10 #include "GrGLStencilBuffer.h" | 10 #include "GrGLStencilBuffer.h" |
| (...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 571 SkASSERT(!GrPixelConfigIsCompressed(dataConfig)); | 571 SkASSERT(!GrPixelConfigIsCompressed(dataConfig)); |
| 572 | 572 |
| 573 size_t bpp = GrBytesPerPixel(dataConfig); | 573 size_t bpp = GrBytesPerPixel(dataConfig); |
| 574 if (!adjust_pixel_ops_params(desc.fWidth, desc.fHeight, bpp, &left, &top, | 574 if (!adjust_pixel_ops_params(desc.fWidth, desc.fHeight, bpp, &left, &top, |
| 575 &width, &height, &data, &rowBytes)) { | 575 &width, &height, &data, &rowBytes)) { |
| 576 return false; | 576 return false; |
| 577 } | 577 } |
| 578 size_t trimRowBytes = width * bpp; | 578 size_t trimRowBytes = width * bpp; |
| 579 | 579 |
| 580 // in case we need a temporary, trimmed copy of the src pixels | 580 // in case we need a temporary, trimmed copy of the src pixels |
| 581 SkAutoSMalloc<128 * 128> tempStorage; | 581 GrAutoMalloc<128 * 128> tempStorage; |
| 582 | 582 |
| 583 // We currently lazily create MIPMAPs when the we see a draw with | 583 // We currently lazily create MIPMAPs when the we see a draw with |
| 584 // GrTextureParams::kMipMap_FilterMode. Using texture storage requires that
the | 584 // GrTextureParams::kMipMap_FilterMode. Using texture storage requires that
the |
| 585 // MIP levels are all created when the texture is created. So for now we don
't use | 585 // MIP levels are all created when the texture is created. So for now we don
't use |
| 586 // texture storage. | 586 // texture storage. |
| 587 bool useTexStorage = false && | 587 bool useTexStorage = false && |
| 588 isNewTexture && | 588 isNewTexture && |
| 589 this->glCaps().texStorageSupport(); | 589 this->glCaps().texStorageSupport(); |
| 590 | 590 |
| 591 if (useTexStorage && kGL_GrGLStandard == this->glStandard()) { | 591 if (useTexStorage && kGL_GrGLStandard == this->glStandard()) { |
| (...skipping 1067 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1659 | 1659 |
| 1660 size_t tightRowBytes = bpp * width; | 1660 size_t tightRowBytes = bpp * width; |
| 1661 if (0 == rowBytes) { | 1661 if (0 == rowBytes) { |
| 1662 rowBytes = tightRowBytes; | 1662 rowBytes = tightRowBytes; |
| 1663 } | 1663 } |
| 1664 size_t readDstRowBytes = tightRowBytes; | 1664 size_t readDstRowBytes = tightRowBytes; |
| 1665 void* readDst = buffer; | 1665 void* readDst = buffer; |
| 1666 | 1666 |
| 1667 // determine if GL can read using the passed rowBytes or if we need | 1667 // determine if GL can read using the passed rowBytes or if we need |
| 1668 // a scratch buffer. | 1668 // a scratch buffer. |
| 1669 SkAutoSMalloc<32 * sizeof(GrColor)> scratch; | 1669 GrAutoMalloc<32 * sizeof(GrColor)> scratch; |
| 1670 if (rowBytes != tightRowBytes) { | 1670 if (rowBytes != tightRowBytes) { |
| 1671 if (this->glCaps().packRowLengthSupport()) { | 1671 if (this->glCaps().packRowLengthSupport()) { |
| 1672 SkASSERT(!(rowBytes % sizeof(GrColor))); | 1672 SkASSERT(!(rowBytes % sizeof(GrColor))); |
| 1673 GL_CALL(PixelStorei(GR_GL_PACK_ROW_LENGTH, | 1673 GL_CALL(PixelStorei(GR_GL_PACK_ROW_LENGTH, |
| 1674 static_cast<GrGLint>(rowBytes / sizeof(GrColor))
)); | 1674 static_cast<GrGLint>(rowBytes / sizeof(GrColor))
)); |
| 1675 readDstRowBytes = rowBytes; | 1675 readDstRowBytes = rowBytes; |
| 1676 } else { | 1676 } else { |
| 1677 scratch.reset(tightRowBytes * height); | 1677 scratch.reset(tightRowBytes * height); |
| 1678 readDst = scratch.get(); | 1678 readDst = scratch.get(); |
| 1679 } | 1679 } |
| (...skipping 1263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2943 this->setVertexArrayID(gpu, 0); | 2943 this->setVertexArrayID(gpu, 0); |
| 2944 } | 2944 } |
| 2945 int attrCount = gpu->glCaps().maxVertexAttributes(); | 2945 int attrCount = gpu->glCaps().maxVertexAttributes(); |
| 2946 if (fDefaultVertexArrayAttribState.count() != attrCount) { | 2946 if (fDefaultVertexArrayAttribState.count() != attrCount) { |
| 2947 fDefaultVertexArrayAttribState.resize(attrCount); | 2947 fDefaultVertexArrayAttribState.resize(attrCount); |
| 2948 } | 2948 } |
| 2949 attribState = &fDefaultVertexArrayAttribState; | 2949 attribState = &fDefaultVertexArrayAttribState; |
| 2950 } | 2950 } |
| 2951 return attribState; | 2951 return attribState; |
| 2952 } | 2952 } |
| OLD | NEW |