OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2010 Google Inc. | 2 * Copyright 2010 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 "SkGr.h" | 9 #include "SkGr.h" |
10 #include "SkGrPriv.h" | 10 #include "SkGrPriv.h" |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 (pixelRef->info().height() != bm.info().height())) { | 191 (pixelRef->info().height() != bm.info().height())) { |
192 return nullptr; | 192 return nullptr; |
193 } | 193 } |
194 | 194 |
195 PixelRef_GrYUVProvider provider(pixelRef); | 195 PixelRef_GrYUVProvider provider(pixelRef); |
196 | 196 |
197 return provider.refAsTexture(ctx, desc, !bm.isVolatile()); | 197 return provider.refAsTexture(ctx, desc, !bm.isVolatile()); |
198 } | 198 } |
199 | 199 |
200 static GrTexture* load_etc1_texture(GrContext* ctx, const SkBitmap &bm, GrSurfac
eDesc desc) { | 200 static GrTexture* load_etc1_texture(GrContext* ctx, const SkBitmap &bm, GrSurfac
eDesc desc) { |
201 SkAutoTUnref<SkData> data(bm.pixelRef()->refEncodedData()); | 201 sk_sp<SkData> data(bm.pixelRef()->refEncodedData()); |
202 if (!data) { | 202 if (!data) { |
203 return nullptr; | 203 return nullptr; |
204 } | 204 } |
205 | 205 |
206 const void* startOfTexData; | 206 const void* startOfTexData; |
207 desc.fConfig = GrIsCompressedTextureDataSupported(ctx, data, bm.width(), bm.
height(), | 207 desc.fConfig = GrIsCompressedTextureDataSupported(ctx, data.get(), bm.width(
), bm.height(), |
208 &startOfTexData); | 208 &startOfTexData); |
209 if (kUnknown_GrPixelConfig == desc.fConfig) { | 209 if (kUnknown_GrPixelConfig == desc.fConfig) { |
210 return nullptr; | 210 return nullptr; |
211 } | 211 } |
212 | 212 |
213 return ctx->textureProvider()->createTexture(desc, SkBudgeted::kYes, startOf
TexData, 0); | 213 return ctx->textureProvider()->createTexture(desc, SkBudgeted::kYes, startOf
TexData, 0); |
214 } | 214 } |
215 | 215 |
216 GrTexture* GrUploadBitmapToTexture(GrContext* ctx, const SkBitmap& bitmap) { | 216 GrTexture* GrUploadBitmapToTexture(GrContext* ctx, const SkBitmap& bitmap) { |
217 GrSurfaceDesc desc = GrImageInfoToSurfaceDesc(bitmap.info(), *ctx->caps()); | 217 GrSurfaceDesc desc = GrImageInfoToSurfaceDesc(bitmap.info(), *ctx->caps()); |
(...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
772 SkErrorInternals::SetError( kInvalidPaint_SkError, | 772 SkErrorInternals::SetError( kInvalidPaint_SkError, |
773 "Sorry, I don't understand the filtering
" | 773 "Sorry, I don't understand the filtering
" |
774 "mode you asked for. Falling back to " | 774 "mode you asked for. Falling back to " |
775 "MIPMaps."); | 775 "MIPMaps."); |
776 textureFilterMode = GrTextureParams::kMipMap_FilterMode; | 776 textureFilterMode = GrTextureParams::kMipMap_FilterMode; |
777 break; | 777 break; |
778 | 778 |
779 } | 779 } |
780 return textureFilterMode; | 780 return textureFilterMode; |
781 } | 781 } |
OLD | NEW |