| 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 "GrGLGpu.h" | 9 #include "GrGLGpu.h" |
| 10 #include "GrGLStencilAttachment.h" | 10 #include "GrGLStencilAttachment.h" |
| (...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 603 SkASSERT(!GrPixelConfigIsCompressed(dataConfig)); | 603 SkASSERT(!GrPixelConfigIsCompressed(dataConfig)); |
| 604 | 604 |
| 605 size_t bpp = GrBytesPerPixel(dataConfig); | 605 size_t bpp = GrBytesPerPixel(dataConfig); |
| 606 if (!adjust_pixel_ops_params(desc.fWidth, desc.fHeight, bpp, &left, &top, | 606 if (!adjust_pixel_ops_params(desc.fWidth, desc.fHeight, bpp, &left, &top, |
| 607 &width, &height, &data, &rowBytes)) { | 607 &width, &height, &data, &rowBytes)) { |
| 608 return false; | 608 return false; |
| 609 } | 609 } |
| 610 size_t trimRowBytes = width * bpp; | 610 size_t trimRowBytes = width * bpp; |
| 611 | 611 |
| 612 // in case we need a temporary, trimmed copy of the src pixels | 612 // in case we need a temporary, trimmed copy of the src pixels |
| 613 GrAutoMalloc<128 * 128> tempStorage; | 613 SkAutoSMalloc<128 * 128> tempStorage; |
| 614 | 614 |
| 615 // We currently lazily create MIPMAPs when the we see a draw with | 615 // We currently lazily create MIPMAPs when the we see a draw with |
| 616 // GrTextureParams::kMipMap_FilterMode. Using texture storage requires that
the | 616 // GrTextureParams::kMipMap_FilterMode. Using texture storage requires that
the |
| 617 // MIP levels are all created when the texture is created. So for now we don
't use | 617 // MIP levels are all created when the texture is created. So for now we don
't use |
| 618 // texture storage. | 618 // texture storage. |
| 619 bool useTexStorage = false && | 619 bool useTexStorage = false && |
| 620 isNewTexture && | 620 isNewTexture && |
| 621 this->glCaps().texStorageSupport(); | 621 this->glCaps().texStorageSupport(); |
| 622 | 622 |
| 623 if (useTexStorage && kGL_GrGLStandard == this->glStandard()) { | 623 if (useTexStorage && kGL_GrGLStandard == this->glStandard()) { |
| (...skipping 1142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1766 | 1766 |
| 1767 size_t tightRowBytes = bpp * width; | 1767 size_t tightRowBytes = bpp * width; |
| 1768 if (0 == rowBytes) { | 1768 if (0 == rowBytes) { |
| 1769 rowBytes = tightRowBytes; | 1769 rowBytes = tightRowBytes; |
| 1770 } | 1770 } |
| 1771 size_t readDstRowBytes = tightRowBytes; | 1771 size_t readDstRowBytes = tightRowBytes; |
| 1772 void* readDst = buffer; | 1772 void* readDst = buffer; |
| 1773 | 1773 |
| 1774 // determine if GL can read using the passed rowBytes or if we need | 1774 // determine if GL can read using the passed rowBytes or if we need |
| 1775 // a scratch buffer. | 1775 // a scratch buffer. |
| 1776 GrAutoMalloc<32 * sizeof(GrColor)> scratch; | 1776 SkAutoSMalloc<32 * sizeof(GrColor)> scratch; |
| 1777 if (rowBytes != tightRowBytes) { | 1777 if (rowBytes != tightRowBytes) { |
| 1778 if (this->glCaps().packRowLengthSupport()) { | 1778 if (this->glCaps().packRowLengthSupport()) { |
| 1779 SkASSERT(!(rowBytes % sizeof(GrColor))); | 1779 SkASSERT(!(rowBytes % sizeof(GrColor))); |
| 1780 GL_CALL(PixelStorei(GR_GL_PACK_ROW_LENGTH, | 1780 GL_CALL(PixelStorei(GR_GL_PACK_ROW_LENGTH, |
| 1781 static_cast<GrGLint>(rowBytes / sizeof(GrColor))
)); | 1781 static_cast<GrGLint>(rowBytes / sizeof(GrColor))
)); |
| 1782 readDstRowBytes = rowBytes; | 1782 readDstRowBytes = rowBytes; |
| 1783 } else { | 1783 } else { |
| 1784 scratch.reset(tightRowBytes * height); | 1784 scratch.reset(tightRowBytes * height); |
| 1785 readDst = scratch.get(); | 1785 readDst = scratch.get(); |
| 1786 } | 1786 } |
| (...skipping 1104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2891 this->setVertexArrayID(gpu, 0); | 2891 this->setVertexArrayID(gpu, 0); |
| 2892 } | 2892 } |
| 2893 int attrCount = gpu->glCaps().maxVertexAttributes(); | 2893 int attrCount = gpu->glCaps().maxVertexAttributes(); |
| 2894 if (fDefaultVertexArrayAttribState.count() != attrCount) { | 2894 if (fDefaultVertexArrayAttribState.count() != attrCount) { |
| 2895 fDefaultVertexArrayAttribState.resize(attrCount); | 2895 fDefaultVertexArrayAttribState.resize(attrCount); |
| 2896 } | 2896 } |
| 2897 attribState = &fDefaultVertexArrayAttribState; | 2897 attribState = &fDefaultVertexArrayAttribState; |
| 2898 } | 2898 } |
| 2899 return attribState; | 2899 return attribState; |
| 2900 } | 2900 } |
| OLD | NEW |