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 | 9 |
10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 | 88 |
89 #if SK_SUPPORT_GPU | 89 #if SK_SUPPORT_GPU |
90 if (source->isTextureBacked()) { | 90 if (source->isTextureBacked()) { |
91 return this->filterImageGPU(source, | 91 return this->filterImageGPU(source, |
92 background, backgroundOffset, | 92 background, backgroundOffset, |
93 foreground, foregroundOffset, | 93 foreground, foregroundOffset, |
94 bounds); | 94 bounds); |
95 } | 95 } |
96 #endif | 96 #endif |
97 | 97 |
98 const SkImageInfo info = SkImageInfo::MakeN32(bounds.width(), bounds.height(
), | 98 sk_sp<SkSpecialSurface> surf(source->makeSurface(bounds)); |
99 kPremul_SkAlphaType); | |
100 sk_sp<SkSpecialSurface> surf(source->makeSurface(info)); | |
101 if (!surf) { | 99 if (!surf) { |
102 return nullptr; | 100 return nullptr; |
103 } | 101 } |
104 | 102 |
105 SkCanvas* canvas = surf->getCanvas(); | 103 SkCanvas* canvas = surf->getCanvas(); |
106 SkASSERT(canvas); | 104 SkASSERT(canvas); |
107 | 105 |
108 canvas->clear(0x0); // can't count on background to fully clear the backgrou
nd | 106 canvas->clear(0x0); // can't count on background to fully clear the backgrou
nd |
109 | 107 |
110 canvas->translate(SkIntToScalar(-bounds.left()), SkIntToScalar(-bounds.top()
)); | 108 canvas->translate(SkIntToScalar(-bounds.left()), SkIntToScalar(-bounds.top()
)); |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 matrix.setTranslate(SkIntToScalar(-bounds.left()), SkIntToScalar(-bounds.top
())); | 252 matrix.setTranslate(SkIntToScalar(-bounds.left()), SkIntToScalar(-bounds.top
())); |
255 drawContext->drawRect(GrNoClip(), paint, matrix, SkRect::Make(bounds)); | 253 drawContext->drawRect(GrNoClip(), paint, matrix, SkRect::Make(bounds)); |
256 | 254 |
257 return SkSpecialImage::MakeFromGpu(SkIRect::MakeWH(bounds.width(), bounds.he
ight()), | 255 return SkSpecialImage::MakeFromGpu(SkIRect::MakeWH(bounds.width(), bounds.he
ight()), |
258 kNeedNewImageUniqueID_SpecialImage, | 256 kNeedNewImageUniqueID_SpecialImage, |
259 drawContext->asTexture(), | 257 drawContext->asTexture(), |
260 sk_ref_sp(drawContext->getColorSpace())); | 258 sk_ref_sp(drawContext->getColorSpace())); |
261 } | 259 } |
262 | 260 |
263 #endif | 261 #endif |
OLD | NEW |