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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 GrTexture* foregroundTex = foreground.getTexture(); | 153 GrTexture* foregroundTex = foreground.getTexture(); |
154 GrContext* context = foregroundTex->getContext(); | 154 GrContext* context = foregroundTex->getContext(); |
155 | 155 |
156 GrFragmentProcessor* xferProcessor = NULL; | 156 GrFragmentProcessor* xferProcessor = NULL; |
157 | 157 |
158 GrSurfaceDesc desc; | 158 GrSurfaceDesc desc; |
159 desc.fFlags = kRenderTarget_GrSurfaceFlag; | 159 desc.fFlags = kRenderTarget_GrSurfaceFlag; |
160 desc.fWidth = src.width(); | 160 desc.fWidth = src.width(); |
161 desc.fHeight = src.height(); | 161 desc.fHeight = src.height(); |
162 desc.fConfig = kSkia8888_GrPixelConfig; | 162 desc.fConfig = kSkia8888_GrPixelConfig; |
163 SkAutoTUnref<GrTexture> dst(context->textureProvider()->refScratchTexture( | 163 SkAutoTUnref<GrTexture> dst(context->textureProvider()->createApproxTexture(
desc)); |
164 desc, GrTextureProvider::kApprox_ScratchTexMatch)); | |
165 if (!dst) { | 164 if (!dst) { |
166 return false; | 165 return false; |
167 } | 166 } |
168 | 167 |
169 GrPaint paint; | 168 GrPaint paint; |
170 if (!fMode || !fMode->asFragmentProcessor(&xferProcessor, paint.getProcessor
DataManager(), | 169 if (!fMode || !fMode->asFragmentProcessor(&xferProcessor, paint.getProcessor
DataManager(), |
171 backgroundTex)) { | 170 backgroundTex)) { |
172 // canFilterImageGPU() should've taken care of this | 171 // canFilterImageGPU() should've taken care of this |
173 SkASSERT(false); | 172 SkASSERT(false); |
174 return false; | 173 return false; |
(...skipping 27 matching lines...) Expand all Loading... |
202 SkMatrix::I(), srcRect); | 201 SkMatrix::I(), srcRect); |
203 | 202 |
204 offset->fX = backgroundOffset.fX; | 203 offset->fX = backgroundOffset.fX; |
205 offset->fY = backgroundOffset.fY; | 204 offset->fY = backgroundOffset.fY; |
206 WrapTexture(dst, src.width(), src.height(), result); | 205 WrapTexture(dst, src.width(), src.height(), result); |
207 return true; | 206 return true; |
208 } | 207 } |
209 | 208 |
210 #endif | 209 #endif |
211 | 210 |
OLD | NEW |