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

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

Issue 147213002: add optional SkAlphaType parameter to notifyPixelsChanged (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: fix dox 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | include/core/SkPixelRef.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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 than 1-byte per pixel (e.g. kA1_Config) 121 than 1-byte per pixel (e.g. kA1_Config)
122 */ 122 */
123 int rowBytesAsPixels() const { return fRowBytes >> (fBytesPerPixel >> 1); } 123 int rowBytesAsPixels() const { return fRowBytes >> (fBytesPerPixel >> 1); }
124 124
125 SkAlphaType alphaType() const { return (SkAlphaType)fAlphaType; } 125 SkAlphaType alphaType() const { return (SkAlphaType)fAlphaType; }
126 126
127 /** 127 /**
128 * Set the bitmap's alphaType, returning true on success. If false is 128 * Set the bitmap's alphaType, returning true on success. If false is
129 * returned, then the specified new alphaType is incompatible with the 129 * returned, then the specified new alphaType is incompatible with the
130 * Config, and the current alphaType is unchanged. 130 * Config, and the current alphaType is unchanged.
131 *
132 * Note: this changes the alphatype for the underlying pixels, which means
133 * that all bitmaps that might be sharing (subsets of) the pixels will
134 * be affected. This is an expensive change for some backends (e.g. GPU)
135 * since changing the alphatype can invalidate internal caches. Thus this
136 * call should only be made if it is associated with real changes to the
137 * pixel data.
131 */ 138 */
132 bool setAlphaType(SkAlphaType); 139 bool setAlphaType(SkAlphaType);
133 140
134 /** Return the address of the pixels for this SkBitmap. 141 /** Return the address of the pixels for this SkBitmap.
135 */ 142 */
136 void* getPixels() const { return fPixels; } 143 void* getPixels() const { return fPixels; }
137 144
138 /** Return the byte size of the pixels, based on the height and rowBytes. 145 /** Return the byte size of the pixels, based on the height and rowBytes.
139 Note this truncates the result to 32bits. Call getSize64() to detect 146 Note this truncates the result to 32bits. Call getSize64() to detect
140 if the real size exceeds 32bits. 147 if the real size exceeds 32bits.
(...skipping 730 matching lines...) Expand 10 before | Expand all | Expand 10 after
871 878
872 inline SkPMColor SkBitmap::getIndex8Color(int x, int y) const { 879 inline SkPMColor SkBitmap::getIndex8Color(int x, int y) const {
873 SkASSERT(fPixels); 880 SkASSERT(fPixels);
874 SkASSERT(fConfig == kIndex8_Config); 881 SkASSERT(fConfig == kIndex8_Config);
875 SkASSERT((unsigned)x < fWidth && (unsigned)y < fHeight); 882 SkASSERT((unsigned)x < fWidth && (unsigned)y < fHeight);
876 SkASSERT(fColorTable); 883 SkASSERT(fColorTable);
877 return (*fColorTable)[*((const uint8_t*)fPixels + y * fRowBytes + x)]; 884 return (*fColorTable)[*((const uint8_t*)fPixels + y * fRowBytes + x)];
878 } 885 }
879 886
880 #endif 887 #endif
OLDNEW
« no previous file with comments | « no previous file | include/core/SkPixelRef.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698