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

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

Issue 83093005: remove kA1_Config, as it is no longer supported (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years 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
OLDNEW
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
(...skipping 24 matching lines...) Expand all
35 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;
36 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
37 its contents. 37 its contents.
38 */ 38 */
39 class SK_API SkBitmap { 39 class SK_API SkBitmap {
40 public: 40 public:
41 class Allocator; 41 class Allocator;
42 42
43 enum Config { 43 enum Config {
44 kNo_Config, //!< bitmap has not been configured 44 kNo_Config, //!< bitmap has not been configured
45 /**
46 * 1-bit per pixel, (0 is transparent, 1 is opaque)
47 * Valid as a destination (target of a canvas), but not valid as a src.
48 * i.e. you can draw into a 1-bit bitmap, but you cannot draw from one.
49 */
50 kA1_Config,
51 kA8_Config, //!< 8-bits per pixel, with only alpha specified (0 is transparent, 0xFF is opaque) 45 kA8_Config, //!< 8-bits per pixel, with only alpha specified (0 is transparent, 0xFF is opaque)
52 kIndex8_Config, //!< 8-bits per pixel, using SkColorTable to specify the colors 46 kIndex8_Config, //!< 8-bits per pixel, using SkColorTable to specify the colors
53 kRGB_565_Config, //!< 16-bits per pixel, (see SkColorPriv.h for packi ng) 47 kRGB_565_Config, //!< 16-bits per pixel, (see SkColorPriv.h for packi ng)
54 kARGB_4444_Config, //!< 16-bits per pixel, (see SkColorPriv.h for packi ng) 48 kARGB_4444_Config, //!< 16-bits per pixel, (see SkColorPriv.h for packi ng)
55 kARGB_8888_Config, //!< 32-bits per pixel, (see SkColorPriv.h for packi ng) 49 kARGB_8888_Config, //!< 32-bits per pixel, (see SkColorPriv.h for packi ng)
56 }; 50 };
57 51
58 // do not add this to the Config enum, otherwise the compiler will let us 52 // do not add this to the Config enum, otherwise the compiler will let us
59 // pass this as a valid parameter for Config. 53 // pass this as a valid parameter for Config.
60 enum { 54 enum {
(...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after
482 */ 476 */
483 inline uint16_t* getAddr16(int x, int y) const; 477 inline uint16_t* getAddr16(int x, int y) const;
484 478
485 /** Returns the address of the pixel specified by x,y for 8bit pixels. 479 /** Returns the address of the pixel specified by x,y for 8bit pixels.
486 * In debug build, this asserts that the pixels are allocated and locked, 480 * In debug build, this asserts that the pixels are allocated and locked,
487 * and that the config is 8-bit, however none of these checks are performed 481 * and that the config is 8-bit, however none of these checks are performed
488 * in the release build. 482 * in the release build.
489 */ 483 */
490 inline uint8_t* getAddr8(int x, int y) const; 484 inline uint8_t* getAddr8(int x, int y) const;
491 485
492 /** Returns the address of the byte containing the pixel specified by x,y
493 * for 1bit pixels.
494 * In debug build, this asserts that the pixels are allocated and locked,
495 * and that the config is 1-bit, however none of these checks are performed
496 * in the release build.
497 */
498 inline uint8_t* getAddr1(int x, int y) const;
499
500 /** Returns the color corresponding to the pixel specified by x,y for 486 /** Returns the color corresponding to the pixel specified by x,y for
501 * colortable based bitmaps. 487 * colortable based bitmaps.
502 * In debug build, this asserts that the pixels are allocated and locked, 488 * In debug build, this asserts that the pixels are allocated and locked,
503 * that the config is kIndex8, and that the colortable is allocated, 489 * that the config is kIndex8, and that the colortable is allocated,
504 * however none of these checks are performed in the release build. 490 * however none of these checks are performed in the release build.
505 */ 491 */
506 inline SkPMColor getIndex8Color(int x, int y) const; 492 inline SkPMColor getIndex8Color(int x, int y) const;
507 493
508 /** Set dst to be a setset of this bitmap. If possible, it will share the 494 /** Set dst to be a setset of this bitmap. If possible, it will share the
509 pixel memory, and just point into a subset of it. However, if the config 495 pixel memory, and just point into a subset of it. However, if the config
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
811 } 797 }
812 798
813 inline SkPMColor SkBitmap::getIndex8Color(int x, int y) const { 799 inline SkPMColor SkBitmap::getIndex8Color(int x, int y) const {
814 SkASSERT(fPixels); 800 SkASSERT(fPixels);
815 SkASSERT(fConfig == kIndex8_Config); 801 SkASSERT(fConfig == kIndex8_Config);
816 SkASSERT((unsigned)x < fWidth && (unsigned)y < fHeight); 802 SkASSERT((unsigned)x < fWidth && (unsigned)y < fHeight);
817 SkASSERT(fColorTable); 803 SkASSERT(fColorTable);
818 return (*fColorTable)[*((const uint8_t*)fPixels + y * fRowBytes + x)]; 804 return (*fColorTable)[*((const uint8_t*)fPixels + y * fRowBytes + x)];
819 } 805 }
820 806
821 // returns the address of the byte that contains the x coordinate
822 inline uint8_t* SkBitmap::getAddr1(int x, int y) const {
823 SkASSERT(fPixels);
824 SkASSERT(fConfig == kA1_Config);
825 SkASSERT((unsigned)x < fWidth && (unsigned)y < fHeight);
826 return (uint8_t*)fPixels + y * fRowBytes + (x >> 3);
827 }
828
829 #endif 807 #endif
OLDNEW
« no previous file with comments | « gyp/core.gypi ('k') | include/core/SkImageDecoder.h » ('j') | include/core/SkImageDecoder.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698