| 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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 localRect = SkRect::MakeWH(1.f, 1.f); | 112 localRect = SkRect::MakeWH(1.f, 1.f); |
| 113 } | 113 } |
| 114 | 114 |
| 115 SkAutoTUnref<GrDrawContext> drawContext(context->drawContext(copy->asRenderT
arget())); | 115 SkAutoTUnref<GrDrawContext> drawContext(context->drawContext(copy->asRenderT
arget())); |
| 116 if (!drawContext) { | 116 if (!drawContext) { |
| 117 return nullptr; | 117 return nullptr; |
| 118 } | 118 } |
| 119 | 119 |
| 120 SkRect dstRect = SkRect::MakeWH(SkIntToScalar(rtDesc.fWidth), SkIntToScalar(
rtDesc.fHeight)); | 120 SkRect dstRect = SkRect::MakeWH(SkIntToScalar(rtDesc.fWidth), SkIntToScalar(
rtDesc.fHeight)); |
| 121 drawContext->fillRectToRect(GrClip::WideOpen(), paint, SkMatrix::I(), dstRec
t, localRect); | 121 drawContext->fillRectToRect(GrClip::WideOpen(), paint, SkMatrix::I(), dstRec
t, localRect); |
| 122 return copy.detach(); | 122 return copy.release(); |
| 123 } | 123 } |
| 124 | 124 |
| 125 GrTextureAdjuster::GrTextureAdjuster(GrTexture* original, | 125 GrTextureAdjuster::GrTextureAdjuster(GrTexture* original, |
| 126 const SkIRect& contentArea, | 126 const SkIRect& contentArea, |
| 127 bool isAlphaOnly) | 127 bool isAlphaOnly) |
| 128 : INHERITED(contentArea.width(), contentArea.height(), isAlphaOnly) | 128 : INHERITED(contentArea.width(), contentArea.height(), isAlphaOnly) |
| 129 , fOriginal(original) { | 129 , fOriginal(original) { |
| 130 SkASSERT(SkIRect::MakeWH(original->width(), original->height()).contains(con
tentArea)); | 130 SkASSERT(SkIRect::MakeWH(original->width(), original->height()).contains(con
tentArea)); |
| 131 if (contentArea.fLeft > 0 || contentArea.fTop > 0 || | 131 if (contentArea.fLeft > 0 || contentArea.fTop > 0 || |
| 132 contentArea.fRight < original->width() || contentArea.fBottom < original
->height()) { | 132 contentArea.fRight < original->width() || contentArea.fBottom < original
->height()) { |
| (...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 506 } | 506 } |
| 507 | 507 |
| 508 GrTexture* GrTextureMaker::generateTextureForParams(const CopyParams& copyParams
, | 508 GrTexture* GrTextureMaker::generateTextureForParams(const CopyParams& copyParams
, |
| 509 bool willBeMipped) { | 509 bool willBeMipped) { |
| 510 SkAutoTUnref<GrTexture> original(this->refOriginalTexture(willBeMipped)); | 510 SkAutoTUnref<GrTexture> original(this->refOriginalTexture(willBeMipped)); |
| 511 if (!original) { | 511 if (!original) { |
| 512 return nullptr; | 512 return nullptr; |
| 513 } | 513 } |
| 514 return copy_on_gpu(original, nullptr, copyParams); | 514 return copy_on_gpu(original, nullptr, copyParams); |
| 515 } | 515 } |
| OLD | NEW |