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

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

Issue 17740003: remove kRLE_Index8_Config from SkBitmap (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 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 | Annotate | Revision Log
« 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 /* 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 * 1-bit per pixel, (0 is transparent, 1 is opaque) 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. 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. 48 * i.e. you can draw into a 1-bit bitmap, but you cannot draw from one.
49 */ 49 */
50 kA1_Config, 50 kA1_Config,
51 kA8_Config, //!< 8-bits per pixel, with only alpha specified (0 is transparent, 0xFF is opaque) 51 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 52 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) 53 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) 54 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) 55 kARGB_8888_Config, //!< 32-bits per pixel, (see SkColorPriv.h for packi ng)
56 /**
57 * Custom compressed format, not supported on all platforms.
58 * Cannot be used as a destination (target of a canvas).
59 * i.e. you may be able to draw from one, but you cannot draw into one.
60 */
61 kRLE_Index8_Config,
62 }; 56 };
63 57
64 // do not add this to the Config enum, otherwise the compiler will let us 58 // do not add this to the Config enum, otherwise the compiler will let us
65 // pass this as a valid parameter for Config. 59 // pass this as a valid parameter for Config.
66 enum { 60 enum {
67 kConfigCount = kRLE_Index8_Config + 1 61 kConfigCount = kARGB_8888_Config + 1
68 }; 62 };
69 63
70 /** 64 /**
71 * 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.
72 * Its config is set to kNo_Config. 66 * Its config is set to kNo_Config.
73 */ 67 */
74 SkBitmap(); 68 SkBitmap();
75 69
76 /** 70 /**
77 * 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
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 * modifications will be lost when unlockPixels() is called.) 353 * modifications will be lost when unlockPixels() is called.)
360 */ 354 */
361 bool lockPixelsAreWritable() const; 355 bool lockPixelsAreWritable() const;
362 356
363 /** Call this to be sure that the bitmap is valid enough to be drawn (i.e. 357 /** Call this to be sure that the bitmap is valid enough to be drawn (i.e.
364 it has non-null pixels, and if required by its config, it has a 358 it has non-null pixels, and if required by its config, it has a
365 non-null colortable. Returns true if all of the above are met. 359 non-null colortable. Returns true if all of the above are met.
366 */ 360 */
367 bool readyToDraw() const { 361 bool readyToDraw() const {
368 return this->getPixels() != NULL && 362 return this->getPixels() != NULL &&
369 ((this->config() != kIndex8_Config && 363 (this->config() != kIndex8_Config || NULL != fColorTable);
370 this->config() != kRLE_Index8_Config) ||
371 fColorTable != NULL);
372 } 364 }
373 365
374 /** Returns the pixelRef's texture, or NULL 366 /** Returns the pixelRef's texture, or NULL
375 */ 367 */
376 SkGpuTexture* getTexture() const; 368 SkGpuTexture* getTexture() const;
377 369
378 /** Return the bitmap's colortable, if it uses one (i.e. fConfig is 370 /** Return the bitmap's colortable, if it uses one (i.e. fConfig is
379 kIndex8_Config or kRLE_Index8_Config) and the pixels are locked. 371 kIndex8_Config) and the pixels are locked.
380 Otherwise returns NULL. Does not affect the colortable's 372 Otherwise returns NULL. Does not affect the colortable's
381 reference count. 373 reference count.
382 */ 374 */
383 SkColorTable* getColorTable() const { return fColorTable; } 375 SkColorTable* getColorTable() const { return fColorTable; }
384 376
385 /** Returns a non-zero, unique value corresponding to the pixels in our 377 /** Returns a non-zero, unique value corresponding to the pixels in our
386 pixelref. Each time the pixels are changed (and notifyPixelsChanged 378 pixelref. Each time the pixels are changed (and notifyPixelsChanged
387 is called), a different generation ID will be returned. Finally, if 379 is called), a different generation ID will be returned. Finally, if
388 their is no pixelRef then zero is returned. 380 their is no pixelRef then zero is returned.
389 */ 381 */
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after
803 795
804 // returns the address of the byte that contains the x coordinate 796 // returns the address of the byte that contains the x coordinate
805 inline uint8_t* SkBitmap::getAddr1(int x, int y) const { 797 inline uint8_t* SkBitmap::getAddr1(int x, int y) const {
806 SkASSERT(fPixels); 798 SkASSERT(fPixels);
807 SkASSERT(fConfig == kA1_Config); 799 SkASSERT(fConfig == kA1_Config);
808 SkASSERT((unsigned)x < fWidth && (unsigned)y < fHeight); 800 SkASSERT((unsigned)x < fWidth && (unsigned)y < fHeight);
809 return (uint8_t*)fPixels + y * fRowBytes + (x >> 3); 801 return (uint8_t*)fPixels + y * fRowBytes + (x >> 3);
810 } 802 }
811 803
812 #endif 804 #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