| 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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 SkAutoTUnref<GrDrawContext> drawContext(context->drawContext(copy->asRenderT
arget())); | 114 SkAutoTUnref<GrDrawContext> drawContext(context->drawContext(copy->asRenderT
arget())); |
| 115 if (!drawContext) { | 115 if (!drawContext) { |
| 116 return nullptr; | 116 return nullptr; |
| 117 } | 117 } |
| 118 | 118 |
| 119 SkRect dstRect = SkRect::MakeWH(SkIntToScalar(rtDesc.fWidth), SkIntToScalar(
rtDesc.fHeight)); | 119 SkRect dstRect = SkRect::MakeWH(SkIntToScalar(rtDesc.fWidth), SkIntToScalar(
rtDesc.fHeight)); |
| 120 drawContext->fillRectToRect(GrClip::WideOpen(), paint, SkMatrix::I(), dstRec
t, localRect); | 120 drawContext->fillRectToRect(GrClip::WideOpen(), paint, SkMatrix::I(), dstRec
t, localRect); |
| 121 return copy.detach(); | 121 return copy.detach(); |
| 122 } | 122 } |
| 123 | 123 |
| 124 GrTextureAdjuster::GrTextureAdjuster(GrTexture* original, const SkIRect& content
Area) | 124 GrTextureAdjuster::GrTextureAdjuster(GrTexture* original, |
| 125 : INHERITED(contentArea.width(), contentArea.height()) | 125 const SkIRect& contentArea, |
| 126 bool isAlphaOnly) |
| 127 : INHERITED(contentArea.width(), contentArea.height(), isAlphaOnly) |
| 126 , fOriginal(original) { | 128 , fOriginal(original) { |
| 127 SkASSERT(SkIRect::MakeWH(original->width(), original->height()).contains(con
tentArea)); | 129 SkASSERT(SkIRect::MakeWH(original->width(), original->height()).contains(con
tentArea)); |
| 128 if (contentArea.fLeft > 0 || contentArea.fTop > 0 || | 130 if (contentArea.fLeft > 0 || contentArea.fTop > 0 || |
| 129 contentArea.fRight < original->width() || contentArea.fBottom < original
->height()) { | 131 contentArea.fRight < original->width() || contentArea.fBottom < original
->height()) { |
| 130 fContentArea.set(contentArea); | 132 fContentArea.set(contentArea); |
| 131 } | 133 } |
| 132 } | 134 } |
| 133 | 135 |
| 134 GrTexture* GrTextureAdjuster::refTextureSafeForParams(const GrTextureParams& par
ams, | 136 GrTexture* GrTextureAdjuster::refTextureSafeForParams(const GrTextureParams& par
ams, |
| 135 SkIPoint* outOffset) { | 137 SkIPoint* outOffset) { |
| (...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 475 filterOrNullForBicubic); | 477 filterOrNullForBicubic); |
| 476 } | 478 } |
| 477 | 479 |
| 478 GrTexture* GrTextureMaker::generateTextureForParams(const CopyParams& copyParams
) { | 480 GrTexture* GrTextureMaker::generateTextureForParams(const CopyParams& copyParams
) { |
| 479 SkAutoTUnref<GrTexture> original(this->refOriginalTexture()); | 481 SkAutoTUnref<GrTexture> original(this->refOriginalTexture()); |
| 480 if (!original) { | 482 if (!original) { |
| 481 return nullptr; | 483 return nullptr; |
| 482 } | 484 } |
| 483 return copy_on_gpu(original, nullptr, copyParams); | 485 return copy_on_gpu(original, nullptr, copyParams); |
| 484 } | 486 } |
| OLD | NEW |