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

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

Issue 340533002: hide SkBitmap::Config entirely (behind a flag) (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 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 | « gyp/skia_for_chromium_defines.gypi ('k') | include/core/SkImageDecoder.h » ('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 20 matching lines...) Expand all
31 Bitmaps can be drawn into a SkCanvas, but they are also used to specify the 31 Bitmaps can be drawn into a SkCanvas, but they are also used to specify the
32 target of a SkCanvas' drawing operations. 32 target of a SkCanvas' drawing operations.
33 A const SkBitmap exposes getAddr(), which lets a caller write its pixels; 33 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 34 the constness is considered to apply to the bitmap's configuration, not
35 its contents. 35 its contents.
36 */ 36 */
37 class SK_API SkBitmap { 37 class SK_API SkBitmap {
38 public: 38 public:
39 class SK_API Allocator; 39 class SK_API Allocator;
40 40
41 #ifdef SK_SUPPORT_LEGACY_BITMAP_CONFIG
41 enum Config { 42 enum Config {
42 kNo_Config, //!< bitmap has not been configured 43 kNo_Config, //!< bitmap has not been configured
43 kA8_Config, //!< 8-bits per pixel, with only alpha specified (0 is transparent, 0xFF is opaque) 44 kA8_Config, //!< 8-bits per pixel, with only alpha specified (0 is transparent, 0xFF is opaque)
44 kIndex8_Config, //!< 8-bits per pixel, using SkColorTable to specify the colors 45 kIndex8_Config, //!< 8-bits per pixel, using SkColorTable to specify the colors
45 kRGB_565_Config, //!< 16-bits per pixel, (see SkColorPriv.h for packi ng) 46 kRGB_565_Config, //!< 16-bits per pixel, (see SkColorPriv.h for packi ng)
46 kARGB_4444_Config, //!< 16-bits per pixel, (see SkColorPriv.h for packi ng) 47 kARGB_4444_Config, //!< 16-bits per pixel, (see SkColorPriv.h for packi ng)
47 kARGB_8888_Config, //!< 32-bits per pixel, (see SkColorPriv.h for packi ng) 48 kARGB_8888_Config, //!< 32-bits per pixel, (see SkColorPriv.h for packi ng)
48 }; 49 };
49 50
50 // do not add this to the Config enum, otherwise the compiler will let us 51 // do not add this to the Config enum, otherwise the compiler will let us
51 // pass this as a valid parameter for Config. 52 // pass this as a valid parameter for Config.
52 enum { 53 enum {
53 kConfigCount = kARGB_8888_Config + 1 54 kConfigCount = kARGB_8888_Config + 1
54 }; 55 };
55 56
56 /** Return the config for the bitmap. */ 57 /** Return the config for the bitmap. */
57 Config config() const; 58 Config config() const;
58 59
59 SK_ATTR_DEPRECATED("use config()") 60 SK_ATTR_DEPRECATED("use config()")
60 Config getConfig() const { return this->config(); } 61 Config getConfig() const { return this->config(); }
62 #endif
61 63
62 /** 64 /**
63 * Default construct creates a bitmap with zero width and height, and no pi xels. 65 * Default construct creates a bitmap with zero width and height, and no pi xels.
64 * Its colortype is set to kUnknown_SkColorType. 66 * Its colortype is set to kUnknown_SkColorType.
65 */ 67 */
66 SkBitmap(); 68 SkBitmap();
67 69
68 /** 70 /**
69 * Copy the settings from the src into this bitmap. If the src has pixels 71 * Copy the settings from the src into this bitmap. If the src has pixels
70 * allocated, they will be shared, not copied, so that the two bitmaps will 72 * allocated, they will be shared, not copied, so that the two bitmaps will
(...skipping 817 matching lines...) Expand 10 before | Expand all | Expand 10 after
888 } 890 }
889 891
890 inline SkPMColor SkBitmap::getIndex8Color(int x, int y) const { 892 inline SkPMColor SkBitmap::getIndex8Color(int x, int y) const {
891 SkASSERT(fPixels); 893 SkASSERT(fPixels);
892 SkASSERT(kIndex_8_SkColorType == this->colorType()); 894 SkASSERT(kIndex_8_SkColorType == this->colorType());
893 SkASSERT((unsigned)x < (unsigned)this->width() && (unsigned)y < (unsigned)th is->height()); 895 SkASSERT((unsigned)x < (unsigned)this->width() && (unsigned)y < (unsigned)th is->height());
894 SkASSERT(fColorTable); 896 SkASSERT(fColorTable);
895 return (*fColorTable)[*((const uint8_t*)fPixels + y * fRowBytes + x)]; 897 return (*fColorTable)[*((const uint8_t*)fPixels + y * fRowBytes + x)];
896 } 898 }
897 899
900 #ifdef SK_SUPPORT_LEGACY_BITMAP_CONFIG
898 /////////////////////////////////////////////////////////////////////////////// 901 ///////////////////////////////////////////////////////////////////////////////
899 // 902 //
900 // Helpers until we can fully deprecate SkBitmap::Config 903 // Helpers until we can fully deprecate SkBitmap::Config
901 // 904 //
902 extern SkBitmap::Config SkColorTypeToBitmapConfig(SkColorType); 905 extern SkBitmap::Config SkColorTypeToBitmapConfig(SkColorType);
903 extern SkColorType SkBitmapConfigToColorType(SkBitmap::Config); 906 extern SkColorType SkBitmapConfigToColorType(SkBitmap::Config);
907 #endif
904 908
905 #endif 909 #endif
OLDNEW
« no previous file with comments | « gyp/skia_for_chromium_defines.gypi ('k') | include/core/SkImageDecoder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698