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 #ifndef SkBitmap_DEFINED | 10 #ifndef SkBitmap_DEFINED |
(...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
531 * the cpu, then so will the dst. If the src pixels are allocated on the | 531 * the cpu, then so will the dst. If the src pixels are allocated on the |
532 * gpu (typically as a texture), the it will do the same for the dst. | 532 * gpu (typically as a texture), the it will do the same for the dst. |
533 * If the request cannot be fulfilled, returns false and dst is unmodified. | 533 * If the request cannot be fulfilled, returns false and dst is unmodified. |
534 */ | 534 */ |
535 bool deepCopyTo(SkBitmap* dst, Config c) const; | 535 bool deepCopyTo(SkBitmap* dst, Config c) const; |
536 | 536 |
537 /** Returns true if this bitmap can be deep copied into the requested config | 537 /** Returns true if this bitmap can be deep copied into the requested config |
538 by calling copyTo(). | 538 by calling copyTo(). |
539 */ | 539 */ |
540 bool canCopyTo(Config newConfig) const; | 540 bool canCopyTo(Config newConfig) const; |
541 | 541 |
542 /** | 542 /** |
543 * DEPRECATED -- will be replaced with API on SkPaint | 543 * DEPRECATED -- will be replaced with API on SkPaint |
544 */ | 544 */ |
545 void buildMipMap(bool forceRebuild = false); | 545 void buildMipMap(bool forceRebuild = false); |
546 | 546 |
547 #ifdef SK_BUILD_FOR_ANDROID | 547 #ifdef SK_BUILD_FOR_ANDROID |
548 bool hasHardwareMipMap() const { | 548 bool hasHardwareMipMap() const { |
549 return (fFlags & kHasHardwareMipMap_Flag) != 0; | 549 return (fFlags & kHasHardwareMipMap_Flag) != 0; |
550 } | 550 } |
551 | 551 |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
695 | 695 |
696 static SkFixed ComputeMipLevel(SkFixed sx, SkFixed dy); | 696 static SkFixed ComputeMipLevel(SkFixed sx, SkFixed dy); |
697 | 697 |
698 /** Given scale factors sx, sy, determine the miplevel available in the | 698 /** Given scale factors sx, sy, determine the miplevel available in the |
699 bitmap, and return it (this is the amount to shift matrix iterators | 699 bitmap, and return it (this is the amount to shift matrix iterators |
700 by). If dst is not null, it is set to the correct level. | 700 by). If dst is not null, it is set to the correct level. |
701 */ | 701 */ |
702 int extractMipLevel(SkBitmap* dst, SkFixed sx, SkFixed sy); | 702 int extractMipLevel(SkBitmap* dst, SkFixed sx, SkFixed sy); |
703 bool hasMipMap() const; | 703 bool hasMipMap() const; |
704 void freeMipMap(); | 704 void freeMipMap(); |
| 705 |
| 706 /** Make a scaled copy of this bitmap into the provided destination. |
| 707 * The caller is responsible for having set the width and height of the |
| 708 * provided destination bitmap, and also having allocated its pixel |
| 709 * memory. |
| 710 * |
| 711 * This function is temporary and for testing purposes only; it will |
| 712 * likely move once it has been properly plumbed into the bitmap |
| 713 * shader infrastructure. |
| 714 */ |
| 715 |
| 716 void scale(SkBitmap *dst) const; |
705 | 717 |
706 friend struct SkBitmapProcState; | 718 friend struct SkBitmapProcState; |
707 }; | 719 }; |
708 | 720 |
709 class SkAutoLockPixels : public SkNoncopyable { | 721 class SkAutoLockPixels : public SkNoncopyable { |
710 public: | 722 public: |
711 SkAutoLockPixels(const SkBitmap& bm, bool doLock = true) : fBitmap(bm) { | 723 SkAutoLockPixels(const SkBitmap& bm, bool doLock = true) : fBitmap(bm) { |
712 fDidLock = doLock; | 724 fDidLock = doLock; |
713 if (doLock) { | 725 if (doLock) { |
714 bm.lockPixels(); | 726 bm.lockPixels(); |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
811 | 823 |
812 // returns the address of the byte that contains the x coordinate | 824 // returns the address of the byte that contains the x coordinate |
813 inline uint8_t* SkBitmap::getAddr1(int x, int y) const { | 825 inline uint8_t* SkBitmap::getAddr1(int x, int y) const { |
814 SkASSERT(fPixels); | 826 SkASSERT(fPixels); |
815 SkASSERT(fConfig == kA1_Config); | 827 SkASSERT(fConfig == kA1_Config); |
816 SkASSERT((unsigned)x < fWidth && (unsigned)y < fHeight); | 828 SkASSERT((unsigned)x < fWidth && (unsigned)y < fHeight); |
817 return (uint8_t*)fPixels + y * fRowBytes + (x >> 3); | 829 return (uint8_t*)fPixels + y * fRowBytes + (x >> 3); |
818 } | 830 } |
819 | 831 |
820 #endif | 832 #endif |
OLD | NEW |