| 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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 | 125 |
| 126 GrEffect* xferEffect = NULL; | 126 GrEffect* xferEffect = NULL; |
| 127 | 127 |
| 128 GrTextureDesc desc; | 128 GrTextureDesc desc; |
| 129 desc.fFlags = kRenderTarget_GrTextureFlagBit | kNoStencil_GrTextureFlagBit; | 129 desc.fFlags = kRenderTarget_GrTextureFlagBit | kNoStencil_GrTextureFlagBit; |
| 130 desc.fWidth = src.width(); | 130 desc.fWidth = src.width(); |
| 131 desc.fHeight = src.height(); | 131 desc.fHeight = src.height(); |
| 132 desc.fConfig = kSkia8888_GrPixelConfig; | 132 desc.fConfig = kSkia8888_GrPixelConfig; |
| 133 | 133 |
| 134 GrAutoScratchTexture ast(context, desc); | 134 GrAutoScratchTexture ast(context, desc); |
| 135 if (NULL == ast.texture()) { |
| 136 return false; |
| 137 } |
| 135 SkAutoTUnref<GrTexture> dst(ast.detach()); | 138 SkAutoTUnref<GrTexture> dst(ast.detach()); |
| 136 | 139 |
| 137 GrContext::AutoRenderTarget art(context, dst->asRenderTarget()); | 140 GrContext::AutoRenderTarget art(context, dst->asRenderTarget()); |
| 138 | 141 |
| 139 if (!fMode || !fMode->asNewEffect(&xferEffect, backgroundTex)) { | 142 if (!fMode || !fMode->asNewEffect(&xferEffect, backgroundTex)) { |
| 140 // canFilterImageGPU() should've taken care of this | 143 // canFilterImageGPU() should've taken care of this |
| 141 SkASSERT(false); | 144 SkASSERT(false); |
| 142 return false; | 145 return false; |
| 143 } | 146 } |
| 144 | 147 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 155 paint.addColorEffect(xferEffect)->unref(); | 158 paint.addColorEffect(xferEffect)->unref(); |
| 156 context->drawRect(paint, srcRect); | 159 context->drawRect(paint, srcRect); |
| 157 | 160 |
| 158 offset->fX = backgroundOffset.fX; | 161 offset->fX = backgroundOffset.fX; |
| 159 offset->fY = backgroundOffset.fY; | 162 offset->fY = backgroundOffset.fY; |
| 160 WrapTexture(dst, src.width(), src.height(), result); | 163 WrapTexture(dst, src.width(), src.height(), result); |
| 161 return true; | 164 return true; |
| 162 } | 165 } |
| 163 | 166 |
| 164 #endif | 167 #endif |
| OLD | NEW |