| 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); | |
| 353 | 352 |
| 354 SkImageInfo info; | |
| 355 resultBM->setConfig(srcBM.config(), dst->width(), dst->height()); | 353 resultBM->setConfig(srcBM.config(), dst->width(), dst->height()); |
| 356 if (resultBM->asImageInfo(&info)) { | 354 resultBM->setPixelRef(SkNEW_ARGS(SkGrPixelRef, (dst)))->unref(); |
| 357 return false; | 355 dst->unref(); |
| 358 } | |
| 359 resultBM->setPixelRef(SkNEW_ARGS(SkGrPixelRef, (info, dst)))->unref(); | |
| 360 return true; | 356 return true; |
| 361 } | 357 } |
| 362 | 358 |
| 363 bool SkMaskFilter::filterMaskGPU(GrTexture* src, | 359 bool SkMaskFilter::filterMaskGPU(GrTexture* src, |
| 364 const SkRect& maskRect, | 360 const SkRect& maskRect, |
| 365 GrTexture** result, | 361 GrTexture** result, |
| 366 bool canOverwriteSrc) const { | 362 bool canOverwriteSrc) const { |
| 367 return false; | 363 return false; |
| 368 } | 364 } |
| 369 #endif | 365 #endif |
| 370 | 366 |
| 371 void SkMaskFilter::computeFastBounds(const SkRect& src, SkRect* dst) const { | 367 void SkMaskFilter::computeFastBounds(const SkRect& src, SkRect* dst) const { |
| 372 SkMask srcM, dstM; | 368 SkMask srcM, dstM; |
| 373 | 369 |
| 374 srcM.fImage = NULL; | 370 srcM.fImage = NULL; |
| 375 src.roundOut(&srcM.fBounds); | 371 src.roundOut(&srcM.fBounds); |
| 376 srcM.fRowBytes = 0; | 372 srcM.fRowBytes = 0; |
| 377 srcM.fFormat = SkMask::kA8_Format; | 373 srcM.fFormat = SkMask::kA8_Format; |
| 378 | 374 |
| 379 SkIPoint margin; // ignored | 375 SkIPoint margin; // ignored |
| 380 if (this->filterMask(&dstM, srcM, SkMatrix::I(), &margin)) { | 376 if (this->filterMask(&dstM, srcM, SkMatrix::I(), &margin)) { |
| 381 dst->set(dstM.fBounds); | 377 dst->set(dstM.fBounds); |
| 382 } else { | 378 } else { |
| 383 dst->set(srcM.fBounds); | 379 dst->set(srcM.fBounds); |
| 384 } | 380 } |
| 385 } | 381 } |
| OLD | NEW |