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

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

Issue 346593003: Adjust the alpha type for pixelRefs. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix alignment. Created 6 years, 5 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 | « 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 * Copyright 2013 Google Inc. 2 * Copyright 2013 Google Inc.
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 SkImageInfo_DEFINED 8 #ifndef SkImageInfo_DEFINED
9 #define SkImageInfo_DEFINED 9 #define SkImageInfo_DEFINED
10 10
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 return width * SkColorTypeBytesPerPixel(ct); 113 return width * SkColorTypeBytesPerPixel(ct);
114 } 114 }
115 115
116 static inline bool SkColorTypeIsValid(unsigned value) { 116 static inline bool SkColorTypeIsValid(unsigned value) {
117 return value <= kLastEnum_SkColorType; 117 return value <= kLastEnum_SkColorType;
118 } 118 }
119 119
120 /////////////////////////////////////////////////////////////////////////////// 120 ///////////////////////////////////////////////////////////////////////////////
121 121
122 /** 122 /**
123 * Return true if alphaType is supported by colorType. If there is a canonical
124 * alphaType for this colorType, return it in canonical.
125 */
126 bool SkColorTypeValidateAlphaType(SkColorType colorType, SkAlphaType alphaType,
127 SkAlphaType* canonical = NULL);
128
129 ///////////////////////////////////////////////////////////////////////////////
130
131 /**
123 * Describe an image's dimensions and pixel type. 132 * Describe an image's dimensions and pixel type.
124 */ 133 */
125 struct SkImageInfo { 134 struct SkImageInfo {
126 int fWidth; 135 int fWidth;
127 int fHeight; 136 int fHeight;
128 SkColorType fColorType; 137 SkColorType fColorType;
129 SkAlphaType fAlphaType; 138 SkAlphaType fAlphaType;
130 139
131 static SkImageInfo Make(int width, int height, SkColorType ct, SkAlphaType a t) { 140 static SkImageInfo Make(int width, int height, SkColorType ct, SkAlphaType a t) {
132 SkImageInfo info = { 141 SkImageInfo info = {
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 248
240 bool validRowBytes(size_t rowBytes) const { 249 bool validRowBytes(size_t rowBytes) const {
241 uint64_t rb = sk_64_mul(fWidth, this->bytesPerPixel()); 250 uint64_t rb = sk_64_mul(fWidth, this->bytesPerPixel());
242 return rowBytes >= rb; 251 return rowBytes >= rb;
243 } 252 }
244 253
245 SkDEBUGCODE(void validate() const;) 254 SkDEBUGCODE(void validate() const;)
246 }; 255 };
247 256
248 #endif 257 #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