| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2006 The Android Open Source Project | 3 * Copyright 2006 The Android Open Source Project |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 | 9 |
| 10 #include "SkMaskFilter.h" | 10 #include "SkMaskFilter.h" |
| (...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 342 } else { | 342 } else { |
| 343 src.reset((GrTexture*) srcBM.getTexture()); | 343 src.reset((GrTexture*) srcBM.getTexture()); |
| 344 src.get()->ref(); | 344 src.get()->ref(); |
| 345 } | 345 } |
| 346 GrTexture* dst; | 346 GrTexture* dst; |
| 347 | 347 |
| 348 bool result = this->filterMaskGPU(src, maskRect, &dst, canOverwriteSrc); | 348 bool result = this->filterMaskGPU(src, maskRect, &dst, canOverwriteSrc); |
| 349 if (!result) { | 349 if (!result) { |
| 350 return false; | 350 return false; |
| 351 } | 351 } |
| 352 SkAutoUnref aur(dst); |
| 352 | 353 |
| 354 SkImageInfo info; |
| 353 resultBM->setConfig(srcBM.config(), dst->width(), dst->height()); | 355 resultBM->setConfig(srcBM.config(), dst->width(), dst->height()); |
| 354 resultBM->setPixelRef(SkNEW_ARGS(SkGrPixelRef, (dst)))->unref(); | 356 if (!resultBM->asImageInfo(&info)) { |
| 355 dst->unref(); | 357 return false; |
| 358 } |
| 359 resultBM->setPixelRef(SkNEW_ARGS(SkGrPixelRef, (info, dst)))->unref(); |
| 356 return true; | 360 return true; |
| 357 } | 361 } |
| 358 | 362 |
| 359 bool SkMaskFilter::filterMaskGPU(GrTexture* src, | 363 bool SkMaskFilter::filterMaskGPU(GrTexture* src, |
| 360 const SkRect& maskRect, | 364 const SkRect& maskRect, |
| 361 GrTexture** result, | 365 GrTexture** result, |
| 362 bool canOverwriteSrc) const { | 366 bool canOverwriteSrc) const { |
| 363 return false; | 367 return false; |
| 364 } | 368 } |
| 365 #endif | 369 #endif |
| 366 | 370 |
| 367 void SkMaskFilter::computeFastBounds(const SkRect& src, SkRect* dst) const { | 371 void SkMaskFilter::computeFastBounds(const SkRect& src, SkRect* dst) const { |
| 368 SkMask srcM, dstM; | 372 SkMask srcM, dstM; |
| 369 | 373 |
| 370 srcM.fImage = NULL; | 374 srcM.fImage = NULL; |
| 371 src.roundOut(&srcM.fBounds); | 375 src.roundOut(&srcM.fBounds); |
| 372 srcM.fRowBytes = 0; | 376 srcM.fRowBytes = 0; |
| 373 srcM.fFormat = SkMask::kA8_Format; | 377 srcM.fFormat = SkMask::kA8_Format; |
| 374 | 378 |
| 375 SkIPoint margin; // ignored | 379 SkIPoint margin; // ignored |
| 376 if (this->filterMask(&dstM, srcM, SkMatrix::I(), &margin)) { | 380 if (this->filterMask(&dstM, srcM, SkMatrix::I(), &margin)) { |
| 377 dst->set(dstM.fBounds); | 381 dst->set(dstM.fBounds); |
| 378 } else { | 382 } else { |
| 379 dst->set(srcM.fBounds); | 383 dst->set(srcM.fBounds); |
| 380 } | 384 } |
| 381 } | 385 } |
| OLD | NEW |