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 #include "GrGLGpu.h" | 8 #include "GrGLGpu.h" |
9 #include "GrGLBuffer.h" | 9 #include "GrGLBuffer.h" |
10 #include "GrGLGLSL.h" | 10 #include "GrGLGLSL.h" |
(...skipping 705 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
716 if (!desc.fTextureHandle) { | 716 if (!desc.fTextureHandle) { |
717 return nullptr; | 717 return nullptr; |
718 } | 718 } |
719 #else | 719 #else |
720 const GrGLTextureInfo* info = reinterpret_cast<const GrGLTextureInfo*>(desc.
fTextureHandle); | 720 const GrGLTextureInfo* info = reinterpret_cast<const GrGLTextureInfo*>(desc.
fTextureHandle); |
721 if (!info || !info->fID) { | 721 if (!info || !info->fID) { |
722 return nullptr; | 722 return nullptr; |
723 } | 723 } |
724 #endif | 724 #endif |
725 | 725 |
726 GrGLTexture::IDDesc idDesc; | 726 GrGLTextureInfo texInfo; |
727 idDesc.fOwnership = GrBackendObjectOwnership::kBorrowed; | |
728 GrSurfaceDesc surfDesc; | 727 GrSurfaceDesc surfDesc; |
729 | 728 |
730 #ifdef SK_IGNORE_GL_TEXTURE_TARGET | 729 #ifdef SK_IGNORE_GL_TEXTURE_TARGET |
731 idDesc.fInfo.fID = static_cast<GrGLuint>(desc.fTextureHandle); | 730 texInfo.fID = static_cast<GrGLuint>(desc.fTextureHandle); |
732 // We only support GL_TEXTURE_2D at the moment. | 731 // We only support GL_TEXTURE_2D at the moment. |
733 idDesc.fInfo.fTarget = GR_GL_TEXTURE_2D; | 732 texInfo.fTarget = GR_GL_TEXTURE_2D; |
734 #else | 733 #else |
735 idDesc.fInfo = *info; | 734 texInfo = *info; |
736 #endif | 735 #endif |
737 | 736 |
738 if (GR_GL_TEXTURE_RECTANGLE != idDesc.fInfo.fTarget && | 737 if (GR_GL_TEXTURE_RECTANGLE != texInfo.fTarget && |
739 GR_GL_TEXTURE_2D != idDesc.fInfo.fTarget) { | 738 GR_GL_TEXTURE_2D != texInfo.fTarget) { |
740 // Only texture rectangle and texture 2d are supported. We do not check
whether texture | 739 // Only texture rectangle and texture 2d are supported. We do not check
whether texture |
741 // rectangle is supported by Skia - if the caller provided us with a tex
ture rectangle, | 740 // rectangle is supported by Skia - if the caller provided us with a tex
ture rectangle, |
742 // we assume the necessary support exists. | 741 // we assume the necessary support exists. |
743 return nullptr; | 742 return nullptr; |
744 } | 743 } |
745 | 744 |
746 surfDesc.fFlags = (GrSurfaceFlags) desc.fFlags; | 745 surfDesc.fFlags = (GrSurfaceFlags) desc.fFlags; |
747 surfDesc.fWidth = desc.fWidth; | 746 surfDesc.fWidth = desc.fWidth; |
748 surfDesc.fHeight = desc.fHeight; | 747 surfDesc.fHeight = desc.fHeight; |
749 surfDesc.fConfig = desc.fConfig; | 748 surfDesc.fConfig = desc.fConfig; |
750 surfDesc.fSampleCnt = SkTMin(desc.fSampleCnt, this->caps()->maxSampleCount()
); | 749 surfDesc.fSampleCnt = SkTMin(desc.fSampleCnt, this->caps()->maxSampleCount()
); |
751 // FIXME: this should be calling resolve_origin(), but Chrome code is curre
ntly | 750 // FIXME: this should be calling resolve_origin(), but Chrome code is curre
ntly |
752 // assuming the old behaviour, which is that backend textures are always | 751 // assuming the old behaviour, which is that backend textures are always |
753 // BottomLeft, even for non-RT's. Once Chrome is fixed, change this to: | 752 // BottomLeft, even for non-RT's. Once Chrome is fixed, change this to: |
754 // glTexDesc.fOrigin = resolve_origin(desc.fOrigin, renderTarget); | 753 // glTexDesc.fOrigin = resolve_origin(desc.fOrigin, renderTarget); |
755 if (kDefault_GrSurfaceOrigin == desc.fOrigin) { | 754 if (kDefault_GrSurfaceOrigin == desc.fOrigin) { |
756 surfDesc.fOrigin = kBottomLeft_GrSurfaceOrigin; | 755 surfDesc.fOrigin = kBottomLeft_GrSurfaceOrigin; |
757 } else { | 756 } else { |
758 surfDesc.fOrigin = desc.fOrigin; | 757 surfDesc.fOrigin = desc.fOrigin; |
759 } | 758 } |
760 | 759 |
761 GrGLRenderTarget::IDDesc rtIDDesc; | 760 GrGLRenderTarget::IDDesc rtIDDesc; |
762 if (!this->createRenderTargetObjects(surfDesc, idDesc.fInfo, &rtIDDesc)) { | 761 if (!this->createRenderTargetObjects(surfDesc, texInfo, &rtIDDesc)) { |
763 return nullptr; | 762 return nullptr; |
764 } | 763 } |
765 return GrGLTextureRenderTarget::CreateWrapped(this, surfDesc, idDesc, rtIDDe
sc); | 764 return GrGLRenderTarget::CreateWrapped(this, surfDesc, rtIDDesc, 0); |
766 } | 765 } |
767 | 766 |
768 //////////////////////////////////////////////////////////////////////////////// | 767 //////////////////////////////////////////////////////////////////////////////// |
769 | 768 |
770 bool GrGLGpu::onGetWritePixelsInfo(GrSurface* dstSurface, int width, int height, | 769 bool GrGLGpu::onGetWritePixelsInfo(GrSurface* dstSurface, int width, int height, |
771 GrPixelConfig srcConfig, | 770 GrPixelConfig srcConfig, |
772 DrawPreference* drawPreference, | 771 DrawPreference* drawPreference, |
773 WritePixelTempDrawInfo* tempDrawInfo) { | 772 WritePixelTempDrawInfo* tempDrawInfo) { |
774 if (kIndex_8_GrPixelConfig == srcConfig || GrPixelConfigIsCompressed(dstSurf
ace->config())) { | 773 if (kIndex_8_GrPixelConfig == srcConfig || GrPixelConfigIsCompressed(dstSurf
ace->config())) { |
775 return false; | 774 return false; |
(...skipping 3495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4271 if (GR_GL_TEXTURE_EXTERNAL == glTexture->target() || | 4270 if (GR_GL_TEXTURE_EXTERNAL == glTexture->target() || |
4272 GR_GL_TEXTURE_RECTANGLE == glTexture->target()) { | 4271 GR_GL_TEXTURE_RECTANGLE == glTexture->target()) { |
4273 copyParams->fFilter = GrTextureParams::kNone_FilterMode; | 4272 copyParams->fFilter = GrTextureParams::kNone_FilterMode; |
4274 copyParams->fWidth = texture->width(); | 4273 copyParams->fWidth = texture->width(); |
4275 copyParams->fHeight = texture->height(); | 4274 copyParams->fHeight = texture->height(); |
4276 return true; | 4275 return true; |
4277 } | 4276 } |
4278 } | 4277 } |
4279 return false; | 4278 return false; |
4280 } | 4279 } |
OLD | NEW |