| 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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 SkIntToScalar(foregroundOffset.fY), &paint); | 91 SkIntToScalar(foregroundOffset.fY), &paint); |
| 92 canvas.clipRect(SkRect::Make(foregroundBounds), SkRegion::kDifference_Op); | 92 canvas.clipRect(SkRect::Make(foregroundBounds), SkRegion::kDifference_Op); |
| 93 paint.setColor(SK_ColorTRANSPARENT); | 93 paint.setColor(SK_ColorTRANSPARENT); |
| 94 canvas.drawPaint(paint); | 94 canvas.drawPaint(paint); |
| 95 *dst = device->accessBitmap(false); | 95 *dst = device->accessBitmap(false); |
| 96 offset->fX = bounds.left(); | 96 offset->fX = bounds.left(); |
| 97 offset->fY = bounds.top(); | 97 offset->fY = bounds.top(); |
| 98 return true; | 98 return true; |
| 99 } | 99 } |
| 100 | 100 |
| 101 #ifndef SK_IGNORE_TO_STRING |
| 102 void SkXfermodeImageFilter::toString(SkString* str) const { |
| 103 str->appendf("SkXfermodeImageFilter: ("); |
| 104 str->appendf("xfermode: ("); |
| 105 if (fMode) { |
| 106 fMode->toString(str); |
| 107 } |
| 108 str->append("))"); |
| 109 } |
| 110 #endif |
| 111 |
| 101 #if SK_SUPPORT_GPU | 112 #if SK_SUPPORT_GPU |
| 102 | 113 |
| 103 bool SkXfermodeImageFilter::canFilterImageGPU() const { | 114 bool SkXfermodeImageFilter::canFilterImageGPU() const { |
| 104 return fMode && fMode->asFragmentProcessor(NULL, NULL) && !cropRectIsSet(); | 115 return fMode && fMode->asFragmentProcessor(NULL, NULL) && !cropRectIsSet(); |
| 105 } | 116 } |
| 106 | 117 |
| 107 bool SkXfermodeImageFilter::filterImageGPU(Proxy* proxy, | 118 bool SkXfermodeImageFilter::filterImageGPU(Proxy* proxy, |
| 108 const SkBitmap& src, | 119 const SkBitmap& src, |
| 109 const Context& ctx, | 120 const Context& ctx, |
| 110 SkBitmap* result, | 121 SkBitmap* result, |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 paint.addColorProcessor(xferProcessor)->unref(); | 169 paint.addColorProcessor(xferProcessor)->unref(); |
| 159 context->drawRect(paint, SkMatrix::I(), srcRect); | 170 context->drawRect(paint, SkMatrix::I(), srcRect); |
| 160 | 171 |
| 161 offset->fX = backgroundOffset.fX; | 172 offset->fX = backgroundOffset.fX; |
| 162 offset->fY = backgroundOffset.fY; | 173 offset->fY = backgroundOffset.fY; |
| 163 WrapTexture(dst, src.width(), src.height(), result); | 174 WrapTexture(dst, src.width(), src.height(), result); |
| 164 return true; | 175 return true; |
| 165 } | 176 } |
| 166 | 177 |
| 167 #endif | 178 #endif |
| 179 |
| OLD | NEW |