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 "SkGpuDevice.h" | 8 #include "SkGpuDevice.h" |
9 | 9 |
10 #include "effects/GrTextureDomainEffect.h" | 10 #include "effects/GrTextureDomainEffect.h" |
(...skipping 829 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
840 const SkStrokeRec& stroke, | 840 const SkStrokeRec& stroke, |
841 bool doAA, | 841 bool doAA, |
842 GrAutoScratchTexture* mask) { | 842 GrAutoScratchTexture* mask) { |
843 GrTextureDesc desc; | 843 GrTextureDesc desc; |
844 desc.fFlags = kRenderTarget_GrTextureFlagBit; | 844 desc.fFlags = kRenderTarget_GrTextureFlagBit; |
845 desc.fWidth = SkScalarCeilToInt(maskRect.width()); | 845 desc.fWidth = SkScalarCeilToInt(maskRect.width()); |
846 desc.fHeight = SkScalarCeilToInt(maskRect.height()); | 846 desc.fHeight = SkScalarCeilToInt(maskRect.height()); |
847 // We actually only need A8, but it often isn't supported as a | 847 // We actually only need A8, but it often isn't supported as a |
848 // render target so default to RGBA_8888 | 848 // render target so default to RGBA_8888 |
849 desc.fConfig = kRGBA_8888_GrPixelConfig; | 849 desc.fConfig = kRGBA_8888_GrPixelConfig; |
850 if (context->isConfigRenderable(kAlpha_8_GrPixelConfig)) { | 850 if (context->isConfigRenderable(kAlpha_8_GrPixelConfig, false)) { |
851 desc.fConfig = kAlpha_8_GrPixelConfig; | 851 desc.fConfig = kAlpha_8_GrPixelConfig; |
852 } | 852 } |
853 | 853 |
854 mask->set(context, desc); | 854 mask->set(context, desc); |
855 if (NULL == mask->texture()) { | 855 if (NULL == mask->texture()) { |
856 return false; | 856 return false; |
857 } | 857 } |
858 | 858 |
859 GrTexture* maskTexture = mask->texture(); | 859 GrTexture* maskTexture = mask->texture(); |
860 SkRect clipRect = SkRect::MakeWH(maskRect.width(), maskRect.height()); | 860 SkRect clipRect = SkRect::MakeWH(maskRect.width(), maskRect.height()); |
(...skipping 1017 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1878 GrTexture* texture, | 1878 GrTexture* texture, |
1879 bool needClear) | 1879 bool needClear) |
1880 : SkBitmapDevice(make_bitmap(context, texture->asRenderTarget())) { | 1880 : SkBitmapDevice(make_bitmap(context, texture->asRenderTarget())) { |
1881 | 1881 |
1882 SkASSERT(texture && texture->asRenderTarget()); | 1882 SkASSERT(texture && texture->asRenderTarget()); |
1883 // This constructor is called from onCreateCompatibleDevice. It has locked t
he RT in the texture | 1883 // This constructor is called from onCreateCompatibleDevice. It has locked t
he RT in the texture |
1884 // cache. We pass true for the third argument so that it will get unlocked. | 1884 // cache. We pass true for the third argument so that it will get unlocked. |
1885 this->initFromRenderTarget(context, texture->asRenderTarget(), true); | 1885 this->initFromRenderTarget(context, texture->asRenderTarget(), true); |
1886 fNeedClear = needClear; | 1886 fNeedClear = needClear; |
1887 } | 1887 } |
OLD | NEW |