| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 "GrTextureParamsAdjuster.h" | 8 #include "GrTextureParamsAdjuster.h" |
| 9 | 9 |
| 10 #include "GrCaps.h" | 10 #include "GrCaps.h" |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 | 65 |
| 66 SkAutoTUnref<GrTexture> copy(context->textureProvider()->createTexture(rtDes
c, true)); | 66 SkAutoTUnref<GrTexture> copy(context->textureProvider()->createTexture(rtDes
c, true)); |
| 67 if (!copy) { | 67 if (!copy) { |
| 68 return nullptr; | 68 return nullptr; |
| 69 } | 69 } |
| 70 | 70 |
| 71 // TODO: If no scaling is being performed then use copySurface. | 71 // TODO: If no scaling is being performed then use copySurface. |
| 72 | 72 |
| 73 GrPaint paint; | 73 GrPaint paint; |
| 74 | 74 |
| 75 SkScalar sx; | 75 // TODO: Initializing these values for no reason cause the compiler is compl
aining |
| 76 SkScalar sy; | 76 SkScalar sx = 0.f; |
| 77 SkScalar sy = 0.f; |
| 77 if (subset) { | 78 if (subset) { |
| 78 sx = 1.f / inputTexture->width(); | 79 sx = 1.f / inputTexture->width(); |
| 79 sy = 1.f / inputTexture->height(); | 80 sy = 1.f / inputTexture->height(); |
| 80 } | 81 } |
| 81 | 82 |
| 82 if (copyParams.fFilter != GrTextureParams::kNone_FilterMode && subset && | 83 if (copyParams.fFilter != GrTextureParams::kNone_FilterMode && subset && |
| 83 (subset->width() != copyParams.fWidth || subset->height() != copyParams.
fHeight)) { | 84 (subset->width() != copyParams.fWidth || subset->height() != copyParams.
fHeight)) { |
| 84 SkRect domain; | 85 SkRect domain; |
| 85 domain.fLeft = (subset->fLeft + 0.5f) * sx; | 86 domain.fLeft = (subset->fLeft + 0.5f) * sx; |
| 86 domain.fTop = (subset->fTop + 0.5f)* sy; | 87 domain.fTop = (subset->fTop + 0.5f)* sy; |
| (...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 474 filterOrNullForBicubic); | 475 filterOrNullForBicubic); |
| 475 } | 476 } |
| 476 | 477 |
| 477 GrTexture* GrTextureMaker::generateTextureForParams(const CopyParams& copyParams
) { | 478 GrTexture* GrTextureMaker::generateTextureForParams(const CopyParams& copyParams
) { |
| 478 SkAutoTUnref<GrTexture> original(this->refOriginalTexture()); | 479 SkAutoTUnref<GrTexture> original(this->refOriginalTexture()); |
| 479 if (!original) { | 480 if (!original) { |
| 480 return nullptr; | 481 return nullptr; |
| 481 } | 482 } |
| 482 return copy_on_gpu(original, nullptr, copyParams); | 483 return copy_on_gpu(original, nullptr, copyParams); |
| 483 } | 484 } |
| OLD | NEW |