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

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

Issue 137263009: change setAlphaType to not modify the pixelref's genID (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: 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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 * 131 *
132 * Note: this changes the alphatype for the underlying pixels, which means 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 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) 134 * be affected.
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.
138 */ 135 */
139 bool setAlphaType(SkAlphaType); 136 bool setAlphaType(SkAlphaType);
140 137
141 /** Return the address of the pixels for this SkBitmap. 138 /** Return the address of the pixels for this SkBitmap.
142 */ 139 */
143 void* getPixels() const { return fPixels; } 140 void* getPixels() const { return fPixels; }
144 141
145 /** Return the byte size of the pixels, based on the height and rowBytes. 142 /** Return the byte size of the pixels, based on the height and rowBytes.
146 Note this truncates the result to 32bits. Call getSize64() to detect 143 Note this truncates the result to 32bits. Call getSize64() to detect
147 if the real size exceeds 32bits. 144 if the real size exceeds 32bits.
(...skipping 730 matching lines...) Expand 10 before | Expand all | Expand 10 after
878 875
879 inline SkPMColor SkBitmap::getIndex8Color(int x, int y) const { 876 inline SkPMColor SkBitmap::getIndex8Color(int x, int y) const {
880 SkASSERT(fPixels); 877 SkASSERT(fPixels);
881 SkASSERT(fConfig == kIndex8_Config); 878 SkASSERT(fConfig == kIndex8_Config);
882 SkASSERT((unsigned)x < fWidth && (unsigned)y < fHeight); 879 SkASSERT((unsigned)x < fWidth && (unsigned)y < fHeight);
883 SkASSERT(fColorTable); 880 SkASSERT(fColorTable);
884 return (*fColorTable)[*((const uint8_t*)fPixels + y * fRowBytes + x)]; 881 return (*fColorTable)[*((const uint8_t*)fPixels + y * fRowBytes + x)];
885 } 882 }
886 883
887 #endif 884 #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