| 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 background.getBounds(&bounds); | 65 background.getBounds(&bounds); |
| 66 if (!applyCropRect(&bounds, ctm)) { | 66 if (!applyCropRect(&bounds, ctm)) { |
| 67 return false; | 67 return false; |
| 68 } | 68 } |
| 69 backgroundOffset.fX -= bounds.left(); | 69 backgroundOffset.fX -= bounds.left(); |
| 70 backgroundOffset.fY -= bounds.top(); | 70 backgroundOffset.fY -= bounds.top(); |
| 71 foregroundOffset.fX -= bounds.left(); | 71 foregroundOffset.fX -= bounds.left(); |
| 72 foregroundOffset.fY -= bounds.top(); | 72 foregroundOffset.fY -= bounds.top(); |
| 73 | 73 |
| 74 SkAutoTUnref<SkBaseDevice> device(proxy->createDevice(bounds.width(), bounds
.height())); | 74 SkAutoTUnref<SkBaseDevice> device(proxy->createDevice(bounds.width(), bounds
.height())); |
| 75 if (NULL == device.get()) { |
| 76 return false; |
| 77 } |
| 75 SkCanvas canvas(device); | 78 SkCanvas canvas(device); |
| 76 SkPaint paint; | 79 SkPaint paint; |
| 77 paint.setXfermodeMode(SkXfermode::kSrc_Mode); | 80 paint.setXfermodeMode(SkXfermode::kSrc_Mode); |
| 78 canvas.drawBitmap(background, SkIntToScalar(backgroundOffset.fX), | 81 canvas.drawBitmap(background, SkIntToScalar(backgroundOffset.fX), |
| 79 SkIntToScalar(backgroundOffset.fY), &paint); | 82 SkIntToScalar(backgroundOffset.fY), &paint); |
| 80 paint.setXfermode(fMode); | 83 paint.setXfermode(fMode); |
| 81 canvas.drawBitmap(foreground, SkIntToScalar(foregroundOffset.fX), | 84 canvas.drawBitmap(foreground, SkIntToScalar(foregroundOffset.fX), |
| 82 SkIntToScalar(foregroundOffset.fY), &paint); | 85 SkIntToScalar(foregroundOffset.fY), &paint); |
| 83 *dst = device->accessBitmap(false); | 86 *dst = device->accessBitmap(false); |
| 84 offset->fX += bounds.left(); | 87 offset->fX += bounds.left(); |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 foregroundPaint.setBlendFunc(sk_blend_to_grblend(sm), sk_blend_to_grblen
d(dm)); | 152 foregroundPaint.setBlendFunc(sk_blend_to_grblend(sm), sk_blend_to_grblen
d(dm)); |
| 150 foregroundPaint.addColorTextureEffect(foregroundTex, foregroundMatrix); | 153 foregroundPaint.addColorTextureEffect(foregroundTex, foregroundMatrix); |
| 151 context->drawRect(foregroundPaint, srcRect); | 154 context->drawRect(foregroundPaint, srcRect); |
| 152 } | 155 } |
| 153 offset->fX += backgroundOffset.fX; | 156 offset->fX += backgroundOffset.fX; |
| 154 offset->fY += backgroundOffset.fY; | 157 offset->fY += backgroundOffset.fY; |
| 155 return SkImageFilterUtils::WrapTexture(dst, src.width(), src.height(), resul
t); | 158 return SkImageFilterUtils::WrapTexture(dst, src.width(), src.height(), resul
t); |
| 156 } | 159 } |
| 157 | 160 |
| 158 #endif | 161 #endif |
| OLD | NEW |