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

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

Issue 295793002: stop calling SkBitmap::flatten (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | include/core/SkPicture.h » ('j') | include/core/SkReadBuffer.h » ('J')
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
11 #include "SkColor.h" 11 #include "SkColor.h"
12 #include "SkColorTable.h" 12 #include "SkColorTable.h"
13 #include "SkImageInfo.h" 13 #include "SkImageInfo.h"
14 #include "SkPoint.h" 14 #include "SkPoint.h"
15 #include "SkRefCnt.h" 15 #include "SkRefCnt.h"
16 16
17 struct SkMask; 17 struct SkMask;
18 struct SkIRect; 18 struct SkIRect;
19 struct SkRect; 19 struct SkRect;
20 class SkPaint; 20 class SkPaint;
21 class SkPixelRef; 21 class SkPixelRef;
22 class SkPixelRefFactory; 22 class SkPixelRefFactory;
23 class SkRegion; 23 class SkRegion;
24 class SkString; 24 class SkString;
25 class GrTexture; 25 class GrTexture;
26 26
27 //#define SK_SUPPORT_LEGACY_BITMAPFLATTEN
28
27 /** \class SkBitmap 29 /** \class SkBitmap
28 30
29 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
30 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.
31 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
32 target of a SkCanvas' drawing operations. 34 target of a SkCanvas' drawing operations.
33 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;
34 the constness is considered to apply to the bitmap's configuration, not 36 the constness is considered to apply to the bitmap's configuration, not
35 its contents. 37 its contents.
36 */ 38 */
(...skipping 654 matching lines...) Expand 10 before | Expand all | Expand 10 after
691 bool extractAlpha(SkBitmap* dst, const SkPaint* paint, Allocator* allocator, 693 bool extractAlpha(SkBitmap* dst, const SkPaint* paint, Allocator* allocator,
692 SkIPoint* offset) const; 694 SkIPoint* offset) const;
693 695
694 /** The following two functions provide the means to both flatten and 696 /** The following two functions provide the means to both flatten and
695 unflatten the bitmap AND its pixels into the provided buffer. 697 unflatten the bitmap AND its pixels into the provided buffer.
696 It is recommended that you do not call these functions directly, 698 It is recommended that you do not call these functions directly,
697 but instead call the write/readBitmap functions on the respective 699 but instead call the write/readBitmap functions on the respective
698 buffers as they can optimize the recording process and avoid recording 700 buffers as they can optimize the recording process and avoid recording
699 duplicate bitmaps and pixelRefs. 701 duplicate bitmaps and pixelRefs.
700 */ 702 */
703 #ifdef SK_SUPPORT_LEGACY_BITMAPFLATTEN
scroggo 2014/05/20 13:27:50 Could you move these before the comment, so the co
reed1 2014/05/20 17:49:58 Done.
704 public:
705 #else
706 private:
707 #endif
701 void flatten(SkWriteBuffer&) const; 708 void flatten(SkWriteBuffer&) const;
scroggo 2014/05/20 13:27:50 Can't we remove this entirely when SK_SUPPORT_LEGA
reed1 2014/05/20 17:49:58 Done.
702 void unflatten(SkReadBuffer&); 709 void unflatten(SkReadBuffer&);
710 public:
703 711
704 SkDEBUGCODE(void validate() const;) 712 SkDEBUGCODE(void validate() const;)
705 713
706 class Allocator : public SkRefCnt { 714 class Allocator : public SkRefCnt {
707 public: 715 public:
708 SK_DECLARE_INST_COUNT(Allocator) 716 SK_DECLARE_INST_COUNT(Allocator)
709 717
710 /** Allocate the pixel memory for the bitmap, given its dimensions and 718 /** Allocate the pixel memory for the bitmap, given its dimensions and
711 config. Return true on success, where success means either setPixels 719 config. Return true on success, where success means either setPixels
712 or setPixelRef was called. The pixels need not be locked when this 720 or setPixelRef was called. The pixels need not be locked when this
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
790 static size_t ComputeSafeSize(Config config, 798 static size_t ComputeSafeSize(Config config,
791 uint32_t width, 799 uint32_t width,
792 uint32_t height, 800 uint32_t height,
793 size_t rowBytes); 801 size_t rowBytes);
794 802
795 /* Unreference any pixelrefs or colortables 803 /* Unreference any pixelrefs or colortables
796 */ 804 */
797 void freePixels(); 805 void freePixels();
798 void updatePixelsFromRef() const; 806 void updatePixelsFromRef() const;
799 807
808 friend class SkBitmapSource; // unflatten
809 friend class SkReadBuffer; // unflatten
800 friend struct SkBitmapProcState; 810 friend struct SkBitmapProcState;
801 }; 811 };
802 812
803 class SkAutoLockPixels : SkNoncopyable { 813 class SkAutoLockPixels : SkNoncopyable {
804 public: 814 public:
805 SkAutoLockPixels(const SkBitmap& bm, bool doLock = true) : fBitmap(bm) { 815 SkAutoLockPixels(const SkBitmap& bm, bool doLock = true) : fBitmap(bm) {
806 fDidLock = doLock; 816 fDidLock = doLock;
807 if (doLock) { 817 if (doLock) {
808 bm.lockPixels(); 818 bm.lockPixels();
809 } 819 }
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
907 } 917 }
908 918
909 /////////////////////////////////////////////////////////////////////////////// 919 ///////////////////////////////////////////////////////////////////////////////
910 // 920 //
911 // Helpers until we can fully deprecate SkBitmap::Config 921 // Helpers until we can fully deprecate SkBitmap::Config
912 // 922 //
913 extern SkBitmap::Config SkColorTypeToBitmapConfig(SkColorType); 923 extern SkBitmap::Config SkColorTypeToBitmapConfig(SkColorType);
914 extern SkColorType SkBitmapConfigToColorType(SkBitmap::Config); 924 extern SkColorType SkBitmapConfigToColorType(SkBitmap::Config);
915 925
916 #endif 926 #endif
OLDNEW
« no previous file with comments | « no previous file | include/core/SkPicture.h » ('j') | include/core/SkReadBuffer.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698