| 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 |
| 11 #define SkBitmap_DEFINED | 11 #define SkBitmap_DEFINED |
| 12 | 12 |
| 13 #include "Sk64.h" | 13 #include "Sk64.h" |
| 14 #include "SkColor.h" | 14 #include "SkColor.h" |
| 15 #include "SkColorTable.h" | 15 #include "SkColorTable.h" |
| 16 #include "SkPoint.h" | 16 #include "SkPoint.h" |
| 17 #include "SkRefCnt.h" | 17 #include "SkRefCnt.h" |
| 18 | 18 |
| 19 struct SkIRect; | 19 struct SkIRect; |
| 20 struct SkRect; | 20 struct SkRect; |
| 21 class SkPaint; | 21 class SkPaint; |
| 22 class SkPixelRef; | 22 class SkPixelRef; |
| 23 class SkRegion; | 23 class SkRegion; |
| 24 class SkString; | 24 class SkString; |
| 25 class SkConvolutionProcs; |
| 25 | 26 |
| 26 class GrTexture; | 27 class GrTexture; |
| 27 | 28 |
| 28 /** \class SkBitmap | 29 /** \class SkBitmap |
| 29 | 30 |
| 30 The SkBitmap class specifies a raster bitmap. A bitmap has an integer width | 31 The SkBitmap class specifies a raster bitmap. A bitmap has an integer width |
| 31 and height, and a format (config), and a pointer to the actual pixels. | 32 and height, and a format (config), and a pointer to the actual pixels. |
| 32 Bitmaps can be drawn into a SkCanvas, but they are also used to specify the | 33 Bitmaps can be drawn into a SkCanvas, but they are also used to specify the |
| 33 target of a SkCanvas' drawing operations. | 34 target of a SkCanvas' drawing operations. |
| 34 A const SkBitmap exposes getAddr(), which lets a caller write its pixels; | 35 A const SkBitmap exposes getAddr(), which lets a caller write its pixels; |
| (...skipping 660 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 695 | 696 |
| 696 static SkFixed ComputeMipLevel(SkFixed sx, SkFixed dy); | 697 static SkFixed ComputeMipLevel(SkFixed sx, SkFixed dy); |
| 697 | 698 |
| 698 /** Given scale factors sx, sy, determine the miplevel available in the | 699 /** Given scale factors sx, sy, determine the miplevel available in the |
| 699 bitmap, and return it (this is the amount to shift matrix iterators | 700 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. | 701 by). If dst is not null, it is set to the correct level. |
| 701 */ | 702 */ |
| 702 int extractMipLevel(SkBitmap* dst, SkFixed sx, SkFixed sy); | 703 int extractMipLevel(SkBitmap* dst, SkFixed sx, SkFixed sy); |
| 703 bool hasMipMap() const; | 704 bool hasMipMap() const; |
| 704 void freeMipMap(); | 705 void freeMipMap(); |
| 705 | 706 |
| 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; | |
| 717 | |
| 718 friend struct SkBitmapProcState; | 707 friend struct SkBitmapProcState; |
| 719 }; | 708 }; |
| 720 | 709 |
| 721 class SkAutoLockPixels : public SkNoncopyable { | 710 class SkAutoLockPixels : public SkNoncopyable { |
| 722 public: | 711 public: |
| 723 SkAutoLockPixels(const SkBitmap& bm, bool doLock = true) : fBitmap(bm) { | 712 SkAutoLockPixels(const SkBitmap& bm, bool doLock = true) : fBitmap(bm) { |
| 724 fDidLock = doLock; | 713 fDidLock = doLock; |
| 725 if (doLock) { | 714 if (doLock) { |
| 726 bm.lockPixels(); | 715 bm.lockPixels(); |
| 727 } | 716 } |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 823 | 812 |
| 824 // returns the address of the byte that contains the x coordinate | 813 // returns the address of the byte that contains the x coordinate |
| 825 inline uint8_t* SkBitmap::getAddr1(int x, int y) const { | 814 inline uint8_t* SkBitmap::getAddr1(int x, int y) const { |
| 826 SkASSERT(fPixels); | 815 SkASSERT(fPixels); |
| 827 SkASSERT(fConfig == kA1_Config); | 816 SkASSERT(fConfig == kA1_Config); |
| 828 SkASSERT((unsigned)x < fWidth && (unsigned)y < fHeight); | 817 SkASSERT((unsigned)x < fWidth && (unsigned)y < fHeight); |
| 829 return (uint8_t*)fPixels + y * fRowBytes + (x >> 3); | 818 return (uint8_t*)fPixels + y * fRowBytes + (x >> 3); |
| 830 } | 819 } |
| 831 | 820 |
| 832 #endif | 821 #endif |
| OLD | NEW |