| 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" |
| 11 #include "SkColorPriv.h" | 11 #include "SkColorPriv.h" |
| 12 #include "SkReadBuffer.h" | 12 #include "SkReadBuffer.h" |
| 13 #include "SkWriteBuffer.h" | 13 #include "SkWriteBuffer.h" |
| 14 #include "SkXfermode.h" | 14 #include "SkXfermode.h" |
| 15 #if SK_SUPPORT_GPU | 15 #if SK_SUPPORT_GPU |
| 16 #include "GrContext.h" | 16 #include "GrContext.h" |
| 17 #include "GrDrawContext.h" |
| 17 #include "effects/GrTextureDomain.h" | 18 #include "effects/GrTextureDomain.h" |
| 18 #include "SkGr.h" | 19 #include "SkGr.h" |
| 19 #endif | 20 #endif |
| 20 | 21 |
| 21 /////////////////////////////////////////////////////////////////////////////// | 22 /////////////////////////////////////////////////////////////////////////////// |
| 22 | 23 |
| 23 SkXfermodeImageFilter::SkXfermodeImageFilter(SkXfermode* mode, | 24 SkXfermodeImageFilter::SkXfermodeImageFilter(SkXfermode* mode, |
| 24 SkImageFilter* inputs[2], | 25 SkImageFilter* inputs[2], |
| 25 const CropRect* cropRect) | 26 const CropRect* cropRect) |
| 26 : INHERITED(2, inputs, cropRect), fMode(mode) { | 27 : INHERITED(2, inputs, cropRect), fMode(mode) { |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 GrPaint paint; | 172 GrPaint paint; |
| 172 SkAutoTUnref<GrFragmentProcessor> foregroundDomain(GrTextureDomainEffect::Cr
eate( | 173 SkAutoTUnref<GrFragmentProcessor> foregroundDomain(GrTextureDomainEffect::Cr
eate( |
| 173 foregroundTex, foregroundMatrix, | 174 foregroundTex, foregroundMatrix, |
| 174 GrTextureDomain::MakeTexelDomain(foregroundTex, foreground.bounds()), | 175 GrTextureDomain::MakeTexelDomain(foregroundTex, foreground.bounds()), |
| 175 GrTextureDomain::kDecal_Mode, | 176 GrTextureDomain::kDecal_Mode, |
| 176 GrTextureParams::kNone_FilterMode) | 177 GrTextureParams::kNone_FilterMode) |
| 177 ); | 178 ); |
| 178 | 179 |
| 179 paint.addColorProcessor(foregroundDomain.get()); | 180 paint.addColorProcessor(foregroundDomain.get()); |
| 180 paint.addColorProcessor(xferProcessor)->unref(); | 181 paint.addColorProcessor(xferProcessor)->unref(); |
| 181 context->drawRect(dst->asRenderTarget(), GrClip::WideOpen(), paint, SkMatrix
::I(), srcRect); | 182 |
| 183 GrDrawContext* drawContext = context->drawContext(); |
| 184 if (!drawContext) { |
| 185 return false; |
| 186 } |
| 187 |
| 188 drawContext->drawRect(dst->asRenderTarget(), GrClip::WideOpen(), paint, |
| 189 SkMatrix::I(), srcRect); |
| 182 | 190 |
| 183 offset->fX = backgroundOffset.fX; | 191 offset->fX = backgroundOffset.fX; |
| 184 offset->fY = backgroundOffset.fY; | 192 offset->fY = backgroundOffset.fY; |
| 185 WrapTexture(dst, src.width(), src.height(), result); | 193 WrapTexture(dst, src.width(), src.height(), result); |
| 186 return true; | 194 return true; |
| 187 } | 195 } |
| 188 | 196 |
| 189 #endif | 197 #endif |
| 190 | 198 |
| OLD | NEW |