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

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

Issue 134163010: Refactor read and write buffers. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: original write flags were fine Created 6 years, 10 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
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 640 matching lines...) Expand 10 before | Expand all | Expand 10 after
651 bool extractAlpha(SkBitmap* dst, const SkPaint* paint, Allocator* allocator, 651 bool extractAlpha(SkBitmap* dst, const SkPaint* paint, Allocator* allocator,
652 SkIPoint* offset) const; 652 SkIPoint* offset) const;
653 653
654 /** The following two functions provide the means to both flatten and 654 /** The following two functions provide the means to both flatten and
655 unflatten the bitmap AND its pixels into the provided buffer. 655 unflatten the bitmap AND its pixels into the provided buffer.
656 It is recommended that you do not call these functions directly, 656 It is recommended that you do not call these functions directly,
657 but instead call the write/readBitmap functions on the respective 657 but instead call the write/readBitmap functions on the respective
658 buffers as they can optimize the recording process and avoid recording 658 buffers as they can optimize the recording process and avoid recording
659 duplicate bitmaps and pixelRefs. 659 duplicate bitmaps and pixelRefs.
660 */ 660 */
661 void flatten(SkFlattenableWriteBuffer&) const; 661 void flatten(SkWriteBuffer&) const;
662 void unflatten(SkFlattenableReadBuffer&); 662 void unflatten(SkReadBuffer&);
663 663
664 SkDEBUGCODE(void validate() const;) 664 SkDEBUGCODE(void validate() const;)
665 665
666 class Allocator : public SkRefCnt { 666 class Allocator : public SkRefCnt {
667 public: 667 public:
668 SK_DECLARE_INST_COUNT(Allocator) 668 SK_DECLARE_INST_COUNT(Allocator)
669 669
670 /** Allocate the pixel memory for the bitmap, given its dimensions and 670 /** Allocate the pixel memory for the bitmap, given its dimensions and
671 config. Return true on success, where success means either setPixels 671 config. Return true on success, where success means either setPixels
672 or setPixelRef was called. The pixels need not be locked when this 672 or setPixelRef was called. The pixels need not be locked when this
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
875 875
876 inline SkPMColor SkBitmap::getIndex8Color(int x, int y) const { 876 inline SkPMColor SkBitmap::getIndex8Color(int x, int y) const {
877 SkASSERT(fPixels); 877 SkASSERT(fPixels);
878 SkASSERT(fConfig == kIndex8_Config); 878 SkASSERT(fConfig == kIndex8_Config);
879 SkASSERT((unsigned)x < fWidth && (unsigned)y < fHeight); 879 SkASSERT((unsigned)x < fWidth && (unsigned)y < fHeight);
880 SkASSERT(fColorTable); 880 SkASSERT(fColorTable);
881 return (*fColorTable)[*((const uint8_t*)fPixels + y * fRowBytes + x)]; 881 return (*fColorTable)[*((const uint8_t*)fPixels + y * fRowBytes + x)];
882 } 882 }
883 883
884 #endif 884 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698