Chromium Code Reviews| 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 56 SkIPoint* offset) const { | 56 SkIPoint* offset) const { |
| 57 SkBitmap background = src, foreground = src; | 57 SkBitmap background = src, foreground = src; |
| 58 SkIPoint backgroundOffset = SkIPoint::Make(0, 0); | 58 SkIPoint backgroundOffset = SkIPoint::Make(0, 0); |
| 59 if (!this->filterInputDeprecated(0, proxy, src, ctx, &background, &backgroun dOffset)) { | 59 if (!this->filterInputDeprecated(0, proxy, src, ctx, &background, &backgroun dOffset)) { |
| 60 background.reset(); | 60 background.reset(); |
| 61 } | 61 } |
| 62 SkIPoint foregroundOffset = SkIPoint::Make(0, 0); | 62 SkIPoint foregroundOffset = SkIPoint::Make(0, 0); |
| 63 if (!this->filterInputDeprecated(1, proxy, src, ctx, &foreground, &foregroun dOffset)) { | 63 if (!this->filterInputDeprecated(1, proxy, src, ctx, &foreground, &foregroun dOffset)) { |
| 64 foreground.reset(); | 64 foreground.reset(); |
| 65 } | 65 } |
| 66 | 66 |
|
robertphillips
2016/03/31 14:44:39
overlength line
Stephen White
2016/03/31 15:18:17
Fixed.
| |
| 67 SkIRect bounds, foregroundBounds; | 67 SkIRect foregroundBounds = foreground.bounds().makeOffset(foregroundOffset.x (), foregroundOffset.y()); |
| 68 SkIRect foregroundSrcBounds = foreground.bounds(); | 68 SkIRect srcBounds = background.bounds().makeOffset(backgroundOffset.x(), bac kgroundOffset.y()); |
| 69 foregroundSrcBounds.offset(foregroundOffset); | 69 srcBounds.join(foregroundBounds); |
| 70 if (!applyCropRect(ctx, foregroundSrcBounds, &foregroundBounds)) { | 70 SkIRect bounds; |
| 71 foregroundBounds.setEmpty(); | 71 if (!this->applyCropRect(ctx, srcBounds, &bounds)) { |
| 72 foreground.reset(); | |
| 73 } | |
| 74 SkIRect backgroundSrcBounds = background.bounds(); | |
| 75 backgroundSrcBounds.offset(backgroundOffset); | |
| 76 if (!applyCropRect(ctx, backgroundSrcBounds, &bounds)) { | |
| 77 bounds.setEmpty(); | |
| 78 background.reset(); | |
| 79 } | |
| 80 bounds.join(foregroundBounds); | |
| 81 if (bounds.isEmpty()) { | |
| 82 return false; | 72 return false; |
| 83 } | 73 } |
| 84 | 74 |
| 85 SkAutoTUnref<SkBaseDevice> device(proxy->createDevice(bounds.width(), bounds .height())); | 75 SkAutoTUnref<SkBaseDevice> device(proxy->createDevice(bounds.width(), bounds .height())); |
| 86 if (nullptr == device.get()) { | 76 if (nullptr == device.get()) { |
| 87 return false; | 77 return false; |
| 88 } | 78 } |
| 89 SkCanvas canvas(device); | 79 SkCanvas canvas(device); |
| 90 canvas.translate(SkIntToScalar(-bounds.left()), SkIntToScalar(-bounds.top()) ); | 80 canvas.translate(SkIntToScalar(-bounds.left()), SkIntToScalar(-bounds.top()) ); |
| 91 SkPaint paint; | 81 SkPaint paint; |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 248 matrix.setTranslate(SkIntToScalar(-bounds.left()), SkIntToScalar(-bounds.top ())); | 238 matrix.setTranslate(SkIntToScalar(-bounds.left()), SkIntToScalar(-bounds.top ())); |
| 249 drawContext->drawRect(GrClip::WideOpen(), paint, matrix, SkRect::Make(bounds )); | 239 drawContext->drawRect(GrClip::WideOpen(), paint, matrix, SkRect::Make(bounds )); |
| 250 | 240 |
| 251 offset->fX = bounds.left(); | 241 offset->fX = bounds.left(); |
| 252 offset->fY = bounds.top(); | 242 offset->fY = bounds.top(); |
| 253 GrWrapTextureInBitmap(dst, bounds.width(), bounds.height(), false, result); | 243 GrWrapTextureInBitmap(dst, bounds.width(), bounds.height(), false, result); |
| 254 return true; | 244 return true; |
| 255 } | 245 } |
| 256 | 246 |
| 257 #endif | 247 #endif |
| OLD | NEW |