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 auto constraint = GrTextureProvider::FromImageFilter(ctx.sizeConstraint()); | 158 SkAutoTUnref<GrTexture> dst(context->textureProvider()->createApproxTexture(
desc)); |
159 SkAutoTUnref<GrTexture> dst(context->textureProvider()->createTexture(desc,
constraint)); | |
160 if (!dst) { | 159 if (!dst) { |
161 return false; | 160 return false; |
162 } | 161 } |
163 | 162 |
164 GrPaint paint; | 163 GrPaint paint; |
165 SkMatrix bgMatrix; | 164 SkMatrix bgMatrix; |
166 bgMatrix.setIDiv(backgroundTex->width(), backgroundTex->height()); | 165 bgMatrix.setIDiv(backgroundTex->width(), backgroundTex->height()); |
167 SkAutoTUnref<const GrFragmentProcessor> bgFP( | 166 SkAutoTUnref<const GrFragmentProcessor> bgFP( |
168 GrSimpleTextureEffect::Create(backgroundTex, bgMatrix)); | 167 GrSimpleTextureEffect::Create(backgroundTex, bgMatrix)); |
169 if (!fMode || !fMode->asFragmentProcessor(&xferFP, bgFP)) { | 168 if (!fMode || !fMode->asFragmentProcessor(&xferFP, bgFP)) { |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 drawContext->drawRect(GrClip::WideOpen(), paint, SkMatrix::I(), srcRect); | 200 drawContext->drawRect(GrClip::WideOpen(), paint, SkMatrix::I(), srcRect); |
202 | 201 |
203 offset->fX = backgroundOffset.fX; | 202 offset->fX = backgroundOffset.fX; |
204 offset->fY = backgroundOffset.fY; | 203 offset->fY = backgroundOffset.fY; |
205 WrapTexture(dst, src.width(), src.height(), result); | 204 WrapTexture(dst, src.width(), src.height(), result); |
206 return true; | 205 return true; |
207 } | 206 } |
208 | 207 |
209 #endif | 208 #endif |
210 | 209 |
OLD | NEW |