OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 Google Inc. |
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 "SkBitmapScaler.h" | 8 #include "SkBitmapScaler.h" |
9 #include "SkBitmapFilter.h" | 9 #include "SkBitmapFilter.h" |
10 #include "SkConvolver.h" | 10 #include "SkConvolver.h" |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 // Convolve into the result. | 238 // Convolve into the result. |
239 SkBitmap result; | 239 SkBitmap result; |
240 result.setInfo(SkImageInfo::MakeN32(SkScalarCeilToInt(destSubset.width()), | 240 result.setInfo(SkImageInfo::MakeN32(SkScalarCeilToInt(destSubset.width()), |
241 SkScalarCeilToInt(destSubset.height()), | 241 SkScalarCeilToInt(destSubset.height()), |
242 source.alphaType())); | 242 source.alphaType())); |
243 result.allocPixels(allocator, nullptr); | 243 result.allocPixels(allocator, nullptr); |
244 if (!result.readyToDraw()) { | 244 if (!result.readyToDraw()) { |
245 return false; | 245 return false; |
246 } | 246 } |
247 | 247 |
248 BGRAConvolve2D(sourceSubset, static_cast<int>(source.rowBytes()), | 248 if (!BGRAConvolve2D(sourceSubset, static_cast<int>(source.rowBytes()), |
249 !source.isOpaque(), filter.xFilter(), filter.yFilter(), | 249 !source.isOpaque(), filter.xFilter(), filter.yFilter(), |
250 static_cast<int>(result.rowBytes()), | 250 static_cast<int>(result.rowBytes()), |
251 static_cast<unsigned char*>(result.getPixels()), | 251 static_cast<unsigned char*>(result.getPixels()), |
252 convolveProcs, true); | 252 convolveProcs, true)) { |
| 253 return false; |
| 254 } |
253 | 255 |
254 *resultPtr = result; | 256 *resultPtr = result; |
255 resultPtr->lockPixels(); | 257 resultPtr->lockPixels(); |
256 SkASSERT(resultPtr->getPixels()); | 258 SkASSERT(resultPtr->getPixels()); |
257 return true; | 259 return true; |
258 } | 260 } |
259 | 261 |
OLD | NEW |