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 "SkScalerContext.h" | 10 #include "SkScalerContext.h" |
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
430 SkDEBUGFAIL("unexpected mask format"); | 430 SkDEBUGFAIL("unexpected mask format"); |
431 } | 431 } |
432 | 432 |
433 SkRasterClip clip; | 433 SkRasterClip clip; |
434 clip.setRect(SkIRect::MakeWH(dstW, dstH)); | 434 clip.setRect(SkIRect::MakeWH(dstW, dstH)); |
435 | 435 |
436 const SkImageInfo info = SkImageInfo::MakeA8(dstW, dstH); | 436 const SkImageInfo info = SkImageInfo::MakeA8(dstW, dstH); |
437 SkBitmap bm; | 437 SkBitmap bm; |
438 | 438 |
439 if (0 == dstRB) { | 439 if (0 == dstRB) { |
440 if (!bm.allocPixels(info)) { | 440 if (!bm.tryAllocPixels(info)) { |
441 // can't allocate offscreen, so empty the mask and return | 441 // can't allocate offscreen, so empty the mask and return |
442 sk_bzero(mask.fImage, mask.computeImageSize()); | 442 sk_bzero(mask.fImage, mask.computeImageSize()); |
443 return; | 443 return; |
444 } | 444 } |
445 } else { | 445 } else { |
446 bm.installPixels(info, mask.fImage, dstRB); | 446 bm.installPixels(info, mask.fImage, dstRB); |
447 } | 447 } |
448 sk_bzero(bm.getPixels(), bm.getSafeSize()); | 448 sk_bzero(bm.getPixels(), bm.getSafeSize()); |
449 | 449 |
450 SkDraw draw; | 450 SkDraw draw; |
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
792 SkScalerContext* SkTypeface::createScalerContext(const SkDescriptor* desc, | 792 SkScalerContext* SkTypeface::createScalerContext(const SkDescriptor* desc, |
793 bool allowFailure) const { | 793 bool allowFailure) const { |
794 SkScalerContext* c = this->onCreateScalerContext(desc); | 794 SkScalerContext* c = this->onCreateScalerContext(desc); |
795 | 795 |
796 if (!c && !allowFailure) { | 796 if (!c && !allowFailure) { |
797 c = SkNEW_ARGS(SkScalerContext_Empty, | 797 c = SkNEW_ARGS(SkScalerContext_Empty, |
798 (const_cast<SkTypeface*>(this), desc)); | 798 (const_cast<SkTypeface*>(this), desc)); |
799 } | 799 } |
800 return c; | 800 return c; |
801 } | 801 } |
OLD | NEW |