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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 } else { | 107 } else { |
108 localRect = SkRect::MakeWH(1.f, 1.f); | 108 localRect = SkRect::MakeWH(1.f, 1.f); |
109 } | 109 } |
110 | 110 |
111 SkAutoTUnref<GrDrawContext> drawContext(context->drawContext(copy->asRenderT
arget())); | 111 SkAutoTUnref<GrDrawContext> drawContext(context->drawContext(copy->asRenderT
arget())); |
112 if (!drawContext) { | 112 if (!drawContext) { |
113 return nullptr; | 113 return nullptr; |
114 } | 114 } |
115 | 115 |
116 SkRect dstRect = SkRect::MakeWH(SkIntToScalar(rtDesc.fWidth), SkIntToScalar(
rtDesc.fHeight)); | 116 SkRect dstRect = SkRect::MakeWH(SkIntToScalar(rtDesc.fWidth), SkIntToScalar(
rtDesc.fHeight)); |
117 drawContext->drawNonAARectToRect(GrClip::WideOpen(), paint, SkMatrix::I(), d
stRect, localRect); | 117 drawContext->fillRectToRect(GrClip::WideOpen(), paint, SkMatrix::I(), dstRec
t, localRect); |
118 return copy.detach(); | 118 return copy.detach(); |
119 } | 119 } |
120 | 120 |
121 GrTextureAdjuster::GrTextureAdjuster(GrTexture* original, const SkIRect& content
Area) | 121 GrTextureAdjuster::GrTextureAdjuster(GrTexture* original, const SkIRect& content
Area) |
122 : fOriginal(original) { | 122 : fOriginal(original) { |
123 if (contentArea.fLeft > 0 || contentArea.fTop > 0 || | 123 if (contentArea.fLeft > 0 || contentArea.fTop > 0 || |
124 contentArea.fRight < original->width() || contentArea.fBottom < original
->height()) { | 124 contentArea.fRight < original->width() || contentArea.fBottom < original
->height()) { |
125 fContentArea.set(contentArea); | 125 fContentArea.set(contentArea); |
126 } | 126 } |
127 } | 127 } |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 return result; | 200 return result; |
201 } | 201 } |
202 | 202 |
203 GrTexture* GrTextureMaker::generateTextureForParams(GrContext* ctx, const CopyPa
rams& copyParams) { | 203 GrTexture* GrTextureMaker::generateTextureForParams(GrContext* ctx, const CopyPa
rams& copyParams) { |
204 SkAutoTUnref<GrTexture> original(this->refOriginalTexture(ctx)); | 204 SkAutoTUnref<GrTexture> original(this->refOriginalTexture(ctx)); |
205 if (!original) { | 205 if (!original) { |
206 return nullptr; | 206 return nullptr; |
207 } | 207 } |
208 return copy_on_gpu(original, nullptr, copyParams); | 208 return copy_on_gpu(original, nullptr, copyParams); |
209 } | 209 } |
OLD | NEW |