| 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 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
| 10 #include "SkDevice.h" | 10 #include "SkDevice.h" |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 GrTexture* foregroundTex = foreground.getTexture(); | 148 GrTexture* foregroundTex = foreground.getTexture(); |
| 149 GrContext* context = foregroundTex->getContext(); | 149 GrContext* context = foregroundTex->getContext(); |
| 150 | 150 |
| 151 const GrFragmentProcessor* xferFP = nullptr; | 151 const GrFragmentProcessor* xferFP = nullptr; |
| 152 | 152 |
| 153 GrSurfaceDesc desc; | 153 GrSurfaceDesc desc; |
| 154 desc.fFlags = kRenderTarget_GrSurfaceFlag; | 154 desc.fFlags = kRenderTarget_GrSurfaceFlag; |
| 155 desc.fWidth = src.width(); | 155 desc.fWidth = src.width(); |
| 156 desc.fHeight = src.height(); | 156 desc.fHeight = src.height(); |
| 157 desc.fConfig = kSkia8888_GrPixelConfig; | 157 desc.fConfig = kSkia8888_GrPixelConfig; |
| 158 SkAutoTUnref<GrTexture> dst(context->textureProvider()->createApproxTexture(
desc)); | 158 auto constraint = GrTextureProvider::FromImageFilter(ctx.sizeConstraint()); |
| 159 SkAutoTUnref<GrTexture> dst(context->textureProvider()->createTexture(desc,
constraint)); |
| 159 if (!dst) { | 160 if (!dst) { |
| 160 return false; | 161 return false; |
| 161 } | 162 } |
| 162 | 163 |
| 163 GrPaint paint; | 164 GrPaint paint; |
| 164 SkMatrix bgMatrix; | 165 SkMatrix bgMatrix; |
| 165 bgMatrix.setIDiv(backgroundTex->width(), backgroundTex->height()); | 166 bgMatrix.setIDiv(backgroundTex->width(), backgroundTex->height()); |
| 166 SkAutoTUnref<const GrFragmentProcessor> bgFP( | 167 SkAutoTUnref<const GrFragmentProcessor> bgFP( |
| 167 GrSimpleTextureEffect::Create(backgroundTex, bgMatrix)); | 168 GrSimpleTextureEffect::Create(backgroundTex, bgMatrix)); |
| 168 if (!fMode || !fMode->asFragmentProcessor(&xferFP, bgFP)) { | 169 if (!fMode || !fMode->asFragmentProcessor(&xferFP, bgFP)) { |
| (...skipping 30 matching lines...) Expand all Loading... |
| 199 drawContext->drawRect(GrClip::WideOpen(), paint, SkMatrix::I(), srcRect); | 200 drawContext->drawRect(GrClip::WideOpen(), paint, SkMatrix::I(), srcRect); |
| 200 | 201 |
| 201 offset->fX = backgroundOffset.fX; | 202 offset->fX = backgroundOffset.fX; |
| 202 offset->fY = backgroundOffset.fY; | 203 offset->fY = backgroundOffset.fY; |
| 203 WrapTexture(dst, src.width(), src.height(), result); | 204 WrapTexture(dst, src.width(), src.height(), result); |
| 204 return true; | 205 return true; |
| 205 } | 206 } |
| 206 | 207 |
| 207 #endif | 208 #endif |
| 208 | 209 |
| OLD | NEW |