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 SkBitmapFilter; | |
26 class SkConvolutionProcs; | |
Stephen White
2013/07/18 17:39:45
Are these necessary? They don't seem to be used in
humper
2013/07/18 18:15:46
Whoops, testing leakage. Deleting.
| |
25 | 27 |
26 class GrTexture; | 28 class GrTexture; |
27 | 29 |
28 /** \class SkBitmap | 30 /** \class SkBitmap |
29 | 31 |
30 The SkBitmap class specifies a raster bitmap. A bitmap has an integer width | 32 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. | 33 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 | 34 Bitmaps can be drawn into a SkCanvas, but they are also used to specify the |
33 target of a SkCanvas' drawing operations. | 35 target of a SkCanvas' drawing operations. |
34 A const SkBitmap exposes getAddr(), which lets a caller write its pixels; | 36 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 | 697 |
696 static SkFixed ComputeMipLevel(SkFixed sx, SkFixed dy); | 698 static SkFixed ComputeMipLevel(SkFixed sx, SkFixed dy); |
697 | 699 |
698 /** Given scale factors sx, sy, determine the miplevel available in the | 700 /** Given scale factors sx, sy, determine the miplevel available in the |
699 bitmap, and return it (this is the amount to shift matrix iterators | 701 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. | 702 by). If dst is not null, it is set to the correct level. |
701 */ | 703 */ |
702 int extractMipLevel(SkBitmap* dst, SkFixed sx, SkFixed sy); | 704 int extractMipLevel(SkBitmap* dst, SkFixed sx, SkFixed sy); |
703 bool hasMipMap() const; | 705 bool hasMipMap() const; |
704 void freeMipMap(); | 706 void freeMipMap(); |
705 | 707 |
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; | 708 friend struct SkBitmapProcState; |
719 }; | 709 }; |
720 | 710 |
721 class SkAutoLockPixels : public SkNoncopyable { | 711 class SkAutoLockPixels : public SkNoncopyable { |
722 public: | 712 public: |
723 SkAutoLockPixels(const SkBitmap& bm, bool doLock = true) : fBitmap(bm) { | 713 SkAutoLockPixels(const SkBitmap& bm, bool doLock = true) : fBitmap(bm) { |
724 fDidLock = doLock; | 714 fDidLock = doLock; |
725 if (doLock) { | 715 if (doLock) { |
726 bm.lockPixels(); | 716 bm.lockPixels(); |
727 } | 717 } |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
823 | 813 |
824 // returns the address of the byte that contains the x coordinate | 814 // returns the address of the byte that contains the x coordinate |
825 inline uint8_t* SkBitmap::getAddr1(int x, int y) const { | 815 inline uint8_t* SkBitmap::getAddr1(int x, int y) const { |
826 SkASSERT(fPixels); | 816 SkASSERT(fPixels); |
827 SkASSERT(fConfig == kA1_Config); | 817 SkASSERT(fConfig == kA1_Config); |
828 SkASSERT((unsigned)x < fWidth && (unsigned)y < fHeight); | 818 SkASSERT((unsigned)x < fWidth && (unsigned)y < fHeight); |
829 return (uint8_t*)fPixels + y * fRowBytes + (x >> 3); | 819 return (uint8_t*)fPixels + y * fRowBytes + (x >> 3); |
830 } | 820 } |
831 | 821 |
832 #endif | 822 #endif |
OLD | NEW |