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

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

Issue 134163010: Refactor read and write buffers. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: original write flags were fine 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
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
11 #include "SkTypes.h" 11 #include "SkTypes.h"
12 #include "SkSize.h" 12 #include "SkSize.h"
13 13
14 class SkFlattenableWriteBuffer; 14 class SkWriteBuffer;
15 class SkFlattenableReadBuffer; 15 class SkReadBuffer;
16 16
17 /** 17 /**
18 * Describes how to interpret the alpha compoent of a pixel. 18 * Describes how to interpret the alpha compoent of a pixel.
19 */ 19 */
20 enum SkAlphaType { 20 enum SkAlphaType {
21 /** 21 /**
22 * All pixels should be treated as opaque, regardless of the value stored 22 * All pixels should be treated as opaque, regardless of the value stored
23 * in their alpha field. Used for legacy images that wrote 0 or garbarge 23 * in their alpha field. Used for legacy images that wrote 0 or garbarge
24 * in their alpha field, but intended the RGB to be treated as opaque. 24 * in their alpha field, but intended the RGB to be treated as opaque.
25 */ 25 */
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 return fWidth * this->bytesPerPixel(); 171 return fWidth * this->bytesPerPixel();
172 } 172 }
173 173
174 bool operator==(const SkImageInfo& other) const { 174 bool operator==(const SkImageInfo& other) const {
175 return 0 == memcmp(this, &other, sizeof(other)); 175 return 0 == memcmp(this, &other, sizeof(other));
176 } 176 }
177 bool operator!=(const SkImageInfo& other) const { 177 bool operator!=(const SkImageInfo& other) const {
178 return 0 != memcmp(this, &other, sizeof(other)); 178 return 0 != memcmp(this, &other, sizeof(other));
179 } 179 }
180 180
181 void unflatten(SkFlattenableReadBuffer&); 181 void unflatten(SkReadBuffer&);
182 void flatten(SkFlattenableWriteBuffer&) const; 182 void flatten(SkWriteBuffer&) const;
183 183
184 size_t getSafeSize(size_t rowBytes) const { 184 size_t getSafeSize(size_t rowBytes) const {
185 if (0 == fHeight) { 185 if (0 == fHeight) {
186 return 0; 186 return 0;
187 } 187 }
188 return (fHeight - 1) * rowBytes + fWidth * this->bytesPerPixel(); 188 return (fHeight - 1) * rowBytes + fWidth * this->bytesPerPixel();
189 } 189 }
190 }; 190 };
191 191
192 #endif 192 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698