| 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 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 desc.fFlags = kRenderTarget_GrSurfaceFlag; | 166 desc.fFlags = kRenderTarget_GrSurfaceFlag; |
| 167 desc.fWidth = bounds.width(); | 167 desc.fWidth = bounds.width(); |
| 168 desc.fHeight = bounds.height(); | 168 desc.fHeight = bounds.height(); |
| 169 desc.fConfig = kSkia8888_GrPixelConfig; | 169 desc.fConfig = kSkia8888_GrPixelConfig; |
| 170 SkAutoTUnref<GrTexture> dst(context->textureProvider()->createApproxTexture(
desc)); | 170 SkAutoTUnref<GrTexture> dst(context->textureProvider()->createApproxTexture(
desc)); |
| 171 if (!dst) { | 171 if (!dst) { |
| 172 return false; | 172 return false; |
| 173 } | 173 } |
| 174 | 174 |
| 175 GrPaint paint; | 175 GrPaint paint; |
| 176 // SRGBTODO: AllowSRGBInputs? |
| 176 SkAutoTUnref<const GrFragmentProcessor> bgFP; | 177 SkAutoTUnref<const GrFragmentProcessor> bgFP; |
| 177 | 178 |
| 178 if (backgroundTex) { | 179 if (backgroundTex) { |
| 179 SkMatrix backgroundMatrix; | 180 SkMatrix backgroundMatrix; |
| 180 backgroundMatrix.setIDiv(backgroundTex->width(), backgroundTex->height()
); | 181 backgroundMatrix.setIDiv(backgroundTex->width(), backgroundTex->height()
); |
| 181 backgroundMatrix.preTranslate(SkIntToScalar(-backgroundOffset.fX), | 182 backgroundMatrix.preTranslate(SkIntToScalar(-backgroundOffset.fX), |
| 182 SkIntToScalar(-backgroundOffset.fY)); | 183 SkIntToScalar(-backgroundOffset.fY)); |
| 183 bgFP.reset(GrTextureDomainEffect::Create( | 184 bgFP.reset(GrTextureDomainEffect::Create( |
| 184 backgroundTex, backgroundMatrix, | 185 backgroundTex, backgroundMatrix, |
| 185 GrTextureDomain::MakeTexelDomain(backgroundTex, back
ground.bounds()), | 186 GrTextureDomain::MakeTexelDomain(backgroundTex, back
ground.bounds()), |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 240 matrix.setTranslate(SkIntToScalar(-bounds.left()), SkIntToScalar(-bounds.top
())); | 241 matrix.setTranslate(SkIntToScalar(-bounds.left()), SkIntToScalar(-bounds.top
())); |
| 241 drawContext->drawRect(GrClip::WideOpen(), paint, matrix, SkRect::Make(bounds
)); | 242 drawContext->drawRect(GrClip::WideOpen(), paint, matrix, SkRect::Make(bounds
)); |
| 242 | 243 |
| 243 offset->fX = bounds.left(); | 244 offset->fX = bounds.left(); |
| 244 offset->fY = bounds.top(); | 245 offset->fY = bounds.top(); |
| 245 GrWrapTextureInBitmap(dst, bounds.width(), bounds.height(), false, result); | 246 GrWrapTextureInBitmap(dst, bounds.width(), bounds.height(), false, result); |
| 246 return true; | 247 return true; |
| 247 } | 248 } |
| 248 | 249 |
| 249 #endif | 250 #endif |
| OLD | NEW |