OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2010 Google Inc. | 2 * Copyright 2010 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 "SkGr.h" | 8 #include "SkGr.h" |
9 | 9 |
10 #include "GrCaps.h" | 10 #include "GrCaps.h" |
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
522 paint.setFilterQuality(kNone_SkFilterQuality); | 522 paint.setFilterQuality(kNone_SkFilterQuality); |
523 break; | 523 break; |
524 case Stretch::kBilerp_Type: | 524 case Stretch::kBilerp_Type: |
525 paint.setFilterQuality(kLow_SkFilterQuality); | 525 paint.setFilterQuality(kLow_SkFilterQuality); |
526 break; | 526 break; |
527 case Stretch::kNone_Type: | 527 case Stretch::kNone_Type: |
528 SkDEBUGFAIL("Shouldn't get here."); | 528 SkDEBUGFAIL("Shouldn't get here."); |
529 break; | 529 break; |
530 } | 530 } |
531 SkRect dstRect = SkRect::MakeWH(SkIntToScalar(stretch.fWidth), SkIntToScalar
(stretch.fHeight)); | 531 SkRect dstRect = SkRect::MakeWH(SkIntToScalar(stretch.fWidth), SkIntToScalar
(stretch.fHeight)); |
532 canvas.drawBitmapRectToRect(bmp, NULL, dstRect, &paint); | 532 canvas.drawBitmapRect(bmp, dstRect, &paint); |
533 return stretched; | 533 return stretched; |
534 } | 534 } |
535 | 535 |
536 static GrTexture* create_bitmap_texture(GrContext* ctx, | 536 static GrTexture* create_bitmap_texture(GrContext* ctx, |
537 const SkBitmap& bmp, | 537 const SkBitmap& bmp, |
538 const Stretch& stretch, | 538 const Stretch& stretch, |
539 const GrUniqueKey& unstretchedKey, | 539 const GrUniqueKey& unstretchedKey, |
540 const GrUniqueKey& stretchedKey) { | 540 const GrUniqueKey& stretchedKey) { |
541 if (Stretch::kNone_Type != stretch.fType) { | 541 if (Stretch::kNone_Type != stretch.fType) { |
542 SkAutoTUnref<GrTexture> unstretched; | 542 SkAutoTUnref<GrTexture> unstretched; |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
826 } | 826 } |
827 return SkImageInfo::Make(w, h, ct, at); | 827 return SkImageInfo::Make(w, h, ct, at); |
828 } | 828 } |
829 | 829 |
830 | 830 |
831 void GrWrapTextureInBitmap(GrTexture* src, int w, int h, bool isOpaque, SkBitmap
* dst) { | 831 void GrWrapTextureInBitmap(GrTexture* src, int w, int h, bool isOpaque, SkBitmap
* dst) { |
832 const SkImageInfo info = GrMakeInfoFromTexture(src, w, h, isOpaque); | 832 const SkImageInfo info = GrMakeInfoFromTexture(src, w, h, isOpaque); |
833 dst->setInfo(info); | 833 dst->setInfo(info); |
834 dst->setPixelRef(SkNEW_ARGS(SkGrPixelRef, (info, src)))->unref(); | 834 dst->setPixelRef(SkNEW_ARGS(SkGrPixelRef, (info, src)))->unref(); |
835 } | 835 } |
OLD | NEW |