Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(226)

Side by Side Diff: include/core/SkBitmap.h

Issue 1143173011: use pixmaps for dst in sprites -- NO BITMAPS (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: add dox Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/core/SkBitmap.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2006 The Android Open Source Project 2 * Copyright 2006 The Android Open Source Project
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 #ifndef SkBitmap_DEFINED 8 #ifndef SkBitmap_DEFINED
9 #define SkBitmap_DEFINED 9 #define SkBitmap_DEFINED
10 10
(...skipping 636 matching lines...) Expand 10 before | Expand all | Expand 10 after
647 @param allocator Allocator used to allocate the pixelref for the dst 647 @param allocator Allocator used to allocate the pixelref for the dst
648 bitmap. If this is null, the standard HeapAllocator 648 bitmap. If this is null, the standard HeapAllocator
649 will be used. 649 will be used.
650 @param offset If not null, it is set to top-left coordinate to position 650 @param offset If not null, it is set to top-left coordinate to position
651 the returned bitmap so that it visually lines up with the 651 the returned bitmap so that it visually lines up with the
652 original 652 original
653 */ 653 */
654 bool extractAlpha(SkBitmap* dst, const SkPaint* paint, Allocator* allocator, 654 bool extractAlpha(SkBitmap* dst, const SkPaint* paint, Allocator* allocator,
655 SkIPoint* offset) const; 655 SkIPoint* offset) const;
656 656
657 /**
658 * If the pixels are available from this bitmap (w/o locking) return true, and fill out the
659 * specified pixmap (if not null). If the pixels are not available (either because there are
660 * none, or becuase accessing them would require locking or other machinary ) return false and
661 * ignore the pixmap parameter.
662 *
663 * Note: if this returns true, the results (in the pixmap) are only valid u ntil the bitmap
664 * is changed in anyway, in which case the results are invalid.
665 */
666 bool peekPixels(SkPixmap*) const;
667
657 SkDEBUGCODE(void validate() const;) 668 SkDEBUGCODE(void validate() const;)
658 669
659 class Allocator : public SkRefCnt { 670 class Allocator : public SkRefCnt {
660 public: 671 public:
661 SK_DECLARE_INST_COUNT(Allocator) 672 SK_DECLARE_INST_COUNT(Allocator)
662 673
663 /** Allocate the pixel memory for the bitmap, given its dimensions and 674 /** Allocate the pixel memory for the bitmap, given its dimensions and
664 colortype. Return true on success, where success means either setPix els 675 colortype. Return true on success, where success means either setPix els
665 or setPixelRef was called. The pixels need not be locked when this 676 or setPixelRef was called. The pixels need not be locked when this
666 returns. If the colortype requires a colortable, it also must be 677 returns. If the colortype requires a colortable, it also must be
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
792 803
793 inline SkPMColor SkBitmap::getIndex8Color(int x, int y) const { 804 inline SkPMColor SkBitmap::getIndex8Color(int x, int y) const {
794 SkASSERT(fPixels); 805 SkASSERT(fPixels);
795 SkASSERT(kIndex_8_SkColorType == this->colorType()); 806 SkASSERT(kIndex_8_SkColorType == this->colorType());
796 SkASSERT((unsigned)x < (unsigned)this->width() && (unsigned)y < (unsigned)th is->height()); 807 SkASSERT((unsigned)x < (unsigned)this->width() && (unsigned)y < (unsigned)th is->height());
797 SkASSERT(fColorTable); 808 SkASSERT(fColorTable);
798 return (*fColorTable)[*((const uint8_t*)fPixels + y * fRowBytes + x)]; 809 return (*fColorTable)[*((const uint8_t*)fPixels + y * fRowBytes + x)];
799 } 810 }
800 811
801 #endif 812 #endif
OLDNEW
« no previous file with comments | « no previous file | src/core/SkBitmap.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698