| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2013 The Android Open Source Project | 2 * Copyright 2013 The Android Open Source Project |
| 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 "SkXfermodeImageFilter.h" | 8 #include "SkXfermodeImageFilter.h" |
| 9 | 9 |
| 10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 sk_sp<SkSpecialImage
> foreground, | 162 sk_sp<SkSpecialImage
> foreground, |
| 163 const SkIPoint& fore
groundOffset, | 163 const SkIPoint& fore
groundOffset, |
| 164 const SkIRect& bound
s) const { | 164 const SkIRect& bound
s) const { |
| 165 SkASSERT(source->isTextureBacked()); | 165 SkASSERT(source->isTextureBacked()); |
| 166 | 166 |
| 167 GrContext* context = source->getContext(); | 167 GrContext* context = source->getContext(); |
| 168 | 168 |
| 169 sk_sp<GrTexture> backgroundTex, foregroundTex; | 169 sk_sp<GrTexture> backgroundTex, foregroundTex; |
| 170 | 170 |
| 171 if (background) { | 171 if (background) { |
| 172 backgroundTex.reset(background->asTextureRef(context)); | 172 backgroundTex = background->asTextureRef(context); |
| 173 } | 173 } |
| 174 | 174 |
| 175 if (foreground) { | 175 if (foreground) { |
| 176 foregroundTex.reset(foreground->asTextureRef(context)); | 176 foregroundTex = foreground->asTextureRef(context); |
| 177 } | 177 } |
| 178 | 178 |
| 179 GrSurfaceDesc desc; | 179 GrSurfaceDesc desc; |
| 180 desc.fFlags = kRenderTarget_GrSurfaceFlag; | 180 desc.fFlags = kRenderTarget_GrSurfaceFlag; |
| 181 desc.fWidth = bounds.width(); | 181 desc.fWidth = bounds.width(); |
| 182 desc.fHeight = bounds.height(); | 182 desc.fHeight = bounds.height(); |
| 183 desc.fConfig = kSkia8888_GrPixelConfig; | 183 desc.fConfig = kSkia8888_GrPixelConfig; |
| 184 SkAutoTUnref<GrTexture> dst(context->textureProvider()->createApproxTexture(
desc)); | 184 sk_sp<GrTexture> dst(context->textureProvider()->createApproxTexture(desc)); |
| 185 if (!dst) { | 185 if (!dst) { |
| 186 return nullptr; | 186 return nullptr; |
| 187 } | 187 } |
| 188 | 188 |
| 189 GrPaint paint; | 189 GrPaint paint; |
| 190 // SRGBTODO: AllowSRGBInputs? | 190 // SRGBTODO: AllowSRGBInputs? |
| 191 SkAutoTUnref<const GrFragmentProcessor> bgFP; | 191 SkAutoTUnref<const GrFragmentProcessor> bgFP; |
| 192 | 192 |
| 193 if (backgroundTex) { | 193 if (backgroundTex) { |
| 194 SkMatrix backgroundMatrix; | 194 SkMatrix backgroundMatrix; |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 if (!drawContext) { | 252 if (!drawContext) { |
| 253 return nullptr; | 253 return nullptr; |
| 254 } | 254 } |
| 255 | 255 |
| 256 SkMatrix matrix; | 256 SkMatrix matrix; |
| 257 matrix.setTranslate(SkIntToScalar(-bounds.left()), SkIntToScalar(-bounds.top
())); | 257 matrix.setTranslate(SkIntToScalar(-bounds.left()), SkIntToScalar(-bounds.top
())); |
| 258 drawContext->drawRect(GrClip::WideOpen(), paint, matrix, SkRect::Make(bounds
)); | 258 drawContext->drawRect(GrClip::WideOpen(), paint, matrix, SkRect::Make(bounds
)); |
| 259 | 259 |
| 260 return SkSpecialImage::MakeFromGpu(SkIRect::MakeWH(bounds.width(), bounds.he
ight()), | 260 return SkSpecialImage::MakeFromGpu(SkIRect::MakeWH(bounds.width(), bounds.he
ight()), |
| 261 kNeedNewImageUniqueID_SpecialImage, | 261 kNeedNewImageUniqueID_SpecialImage, |
| 262 dst.get()); | 262 std::move(dst)); |
| 263 } | 263 } |
| 264 | 264 |
| 265 #endif | 265 #endif |
| OLD | NEW |