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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 SkIPoint backgroundOffset = SkIPoint::Make(0, 0); | 50 SkIPoint backgroundOffset = SkIPoint::Make(0, 0); |
51 if (!this->filterInput(0, proxy, src, ctx, &background, &backgroundOffset))
{ | 51 if (!this->filterInput(0, proxy, src, ctx, &background, &backgroundOffset))
{ |
52 background.reset(); | 52 background.reset(); |
53 } | 53 } |
54 SkIPoint foregroundOffset = SkIPoint::Make(0, 0); | 54 SkIPoint foregroundOffset = SkIPoint::Make(0, 0); |
55 if (!this->filterInput(1, proxy, src, ctx, &foreground, &foregroundOffset))
{ | 55 if (!this->filterInput(1, proxy, src, ctx, &foreground, &foregroundOffset))
{ |
56 foreground.reset(); | 56 foreground.reset(); |
57 } | 57 } |
58 | 58 |
59 SkIRect bounds, foregroundBounds; | 59 SkIRect bounds, foregroundBounds; |
60 if (!applyCropRect(ctx, foreground, foregroundOffset, &foregroundBounds)) { | 60 SkIRect foregroundSrcBounds = foreground.bounds(); |
| 61 foregroundSrcBounds.offset(foregroundOffset); |
| 62 if (!applyCropRect(ctx, foregroundSrcBounds, &foregroundBounds)) { |
61 foregroundBounds.setEmpty(); | 63 foregroundBounds.setEmpty(); |
62 foreground.reset(); | 64 foreground.reset(); |
63 } | 65 } |
64 if (!applyCropRect(ctx, background, backgroundOffset, &bounds)) { | 66 SkIRect backgroundSrcBounds = background.bounds(); |
| 67 backgroundSrcBounds.offset(backgroundOffset); |
| 68 if (!applyCropRect(ctx, backgroundSrcBounds, &bounds)) { |
65 bounds.setEmpty(); | 69 bounds.setEmpty(); |
66 background.reset(); | 70 background.reset(); |
67 } | 71 } |
68 bounds.join(foregroundBounds); | 72 bounds.join(foregroundBounds); |
69 if (bounds.isEmpty()) { | 73 if (bounds.isEmpty()) { |
70 return false; | 74 return false; |
71 } | 75 } |
72 | 76 |
73 SkAutoTUnref<SkBaseDevice> device(proxy->createDevice(bounds.width(), bounds
.height())); | 77 SkAutoTUnref<SkBaseDevice> device(proxy->createDevice(bounds.width(), bounds
.height())); |
74 if (nullptr == device.get()) { | 78 if (nullptr == device.get()) { |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 drawContext->drawRect(GrClip::WideOpen(), paint, matrix, SkRect::Make(bounds
)); | 241 drawContext->drawRect(GrClip::WideOpen(), paint, matrix, SkRect::Make(bounds
)); |
238 | 242 |
239 offset->fX = bounds.left(); | 243 offset->fX = bounds.left(); |
240 offset->fY = bounds.top(); | 244 offset->fY = bounds.top(); |
241 GrWrapTextureInBitmap(dst, bounds.width(), bounds.height(), false, result); | 245 GrWrapTextureInBitmap(dst, bounds.width(), bounds.height(), false, result); |
242 return true; | 246 return true; |
243 } | 247 } |
244 | 248 |
245 #endif | 249 #endif |
246 | 250 |
OLD | NEW |