| 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 #include "GrTextureMaker.h" | 8 #include "GrTextureMaker.h" |
| 9 | 9 |
| 10 #include "SkGr.h" | 10 #include "SkGr.h" |
| (...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 // copies of texels from the original. | 278 // copies of texels from the original. |
| 279 GrTextureParams params(SkShader::kClamp_TileMode, | 279 GrTextureParams params(SkShader::kClamp_TileMode, |
| 280 SkGrStretch::kBilerp_Type == stretch.fType ? | 280 SkGrStretch::kBilerp_Type == stretch.fType ? |
| 281 GrTextureParams::kBilerp_FilterMode : | 281 GrTextureParams::kBilerp_FilterMode : |
| 282 GrTextureParams::kNone_FilterMode); | 282 GrTextureParams::kNone_FilterMode); |
| 283 paint.addColorTextureProcessor(inputTexture, SkMatrix::I(), params); | 283 paint.addColorTextureProcessor(inputTexture, SkMatrix::I(), params); |
| 284 | 284 |
| 285 SkRect rect = SkRect::MakeWH(SkIntToScalar(rtDesc.fWidth), SkIntToScalar(rtD
esc.fHeight)); | 285 SkRect rect = SkRect::MakeWH(SkIntToScalar(rtDesc.fWidth), SkIntToScalar(rtD
esc.fHeight)); |
| 286 SkRect localRect = SkRect::MakeWH(1.f, 1.f); | 286 SkRect localRect = SkRect::MakeWH(1.f, 1.f); |
| 287 | 287 |
| 288 SkAutoTUnref<GrDrawContext> drawContext(context->drawContext()); | 288 SkAutoTUnref<GrDrawContext> drawContext(context->drawContext(stretched->asRe
nderTarget())); |
| 289 if (!drawContext) { | 289 if (!drawContext) { |
| 290 return nullptr; | 290 return nullptr; |
| 291 } | 291 } |
| 292 | 292 |
| 293 drawContext->drawNonAARectToRect(stretched->asRenderTarget(), GrClip::WideOp
en(), paint, | 293 drawContext->drawNonAARectToRect(GrClip::WideOpen(), paint, SkMatrix::I(), r
ect, localRect); |
| 294 SkMatrix::I(), rect, localRect); | |
| 295 | 294 |
| 296 return stretched.detach(); | 295 return stretched.detach(); |
| 297 } | 296 } |
| 298 | 297 |
| 299 GrPixelConfig GrIsCompressedTextureDataSupported(GrContext* ctx, SkData* data, | 298 GrPixelConfig GrIsCompressedTextureDataSupported(GrContext* ctx, SkData* data, |
| 300 int expectedW, int expectedH, | 299 int expectedW, int expectedH, |
| 301 const void** outStartOfDataToUp
load) { | 300 const void** outStartOfDataToUp
load) { |
| 302 *outStartOfDataToUpload = nullptr; | 301 *outStartOfDataToUpload = nullptr; |
| 303 #ifndef SK_IGNORE_ETC1_SUPPORT | 302 #ifndef SK_IGNORE_ETC1_SUPPORT |
| 304 if (!ctx->caps()->isConfigTexturable(kETC1_GrPixelConfig)) { | 303 if (!ctx->caps()->isConfigTexturable(kETC1_GrPixelConfig)) { |
| (...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 919 SkBitmap stretchedBmp = stretch_on_cpu(bitmap, stretch); | 918 SkBitmap stretchedBmp = stretch_on_cpu(bitmap, stretch); |
| 920 return create_unstretched_bitmap_texture(ctx, stretchedBmp, GrUniqueKey(
)); | 919 return create_unstretched_bitmap_texture(ctx, stretchedBmp, GrUniqueKey(
)); |
| 921 } else { | 920 } else { |
| 922 SkAutoTUnref<GrTexture> unstretched(this->onRefUnstretchedTexture(ctx)); | 921 SkAutoTUnref<GrTexture> unstretched(this->onRefUnstretchedTexture(ctx)); |
| 923 if (!unstretched) { | 922 if (!unstretched) { |
| 924 return nullptr; | 923 return nullptr; |
| 925 } | 924 } |
| 926 return stretch_texture(unstretched, stretch, nullptr, GrUniqueKey()); | 925 return stretch_texture(unstretched, stretch, nullptr, GrUniqueKey()); |
| 927 } | 926 } |
| 928 } | 927 } |
| OLD | NEW |