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

Side by Side Diff: src/core/SkImageInfo.cpp

Issue 2000713003: Add SkColorSpace to SkImageInfo (Closed) Base URL: https://skia.googlesource.com/skia.git@public
Patch Set: Created 4 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
OLDNEW
1 /* 1 /*
2 * Copyright 2010 Google Inc. 2 * Copyright 2010 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 #include "SkImageInfo.h" 8 #include "SkImageInfo.h"
9 #include "SkImageInfoPriv.h" 9 #include "SkImageInfoPriv.h"
10 #include "SkReadBuffer.h" 10 #include "SkReadBuffer.h"
(...skipping 12 matching lines...) Expand all
23 } 23 }
24 24
25 static bool alpha_type_is_valid(SkAlphaType alphaType) { 25 static bool alpha_type_is_valid(SkAlphaType alphaType) {
26 return (alphaType >= 0) && (alphaType <= kLastEnum_SkAlphaType); 26 return (alphaType >= 0) && (alphaType <= kLastEnum_SkAlphaType);
27 } 27 }
28 28
29 static bool color_type_is_valid(SkColorType colorType) { 29 static bool color_type_is_valid(SkColorType colorType) {
30 return (colorType >= 0) && (colorType <= kLastEnum_SkColorType); 30 return (colorType >= 0) && (colorType <= kLastEnum_SkColorType);
31 } 31 }
32 32
33 SkImageInfo SkImageInfo::Make(int width, int height, SkColorType ct, SkAlphaType at,
34 sk_sp<SkColorSpace> cs) {
35 return SkImageInfo(width, height, ct, at, SkDefaultColorProfile(), std::move (cs));
36 }
37
33 void SkImageInfo::unflatten(SkReadBuffer& buffer) { 38 void SkImageInfo::unflatten(SkReadBuffer& buffer) {
34 fWidth = buffer.read32(); 39 fWidth = buffer.read32();
35 fHeight = buffer.read32(); 40 fHeight = buffer.read32();
36 41
37 uint32_t packed = buffer.read32(); 42 uint32_t packed = buffer.read32();
38 SkASSERT(0 == (packed >> 24)); 43 SkASSERT(0 == (packed >> 24));
39 fProfileType = (SkColorProfileType)((packed >> 16) & 0xFF); 44 fProfileType = (SkColorProfileType)((packed >> 16) & 0xFF);
40 fAlphaType = (SkAlphaType)((packed >> 8) & 0xFF); 45 fAlphaType = (SkAlphaType)((packed >> 8) & 0xFF);
41 fColorType = (SkColorType)((packed >> 0) & 0xFF); 46 fColorType = (SkColorType)((packed >> 0) & 0xFF);
42 buffer.validate(profile_type_is_valid(fProfileType) && 47 buffer.validate(profile_type_is_valid(fProfileType) &&
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 } 128 }
124 // here x,y are either 0 or negative 129 // here x,y are either 0 or negative
125 fPixels = ((char*)fPixels - y * fRowBytes - x * fInfo.bytesPerPixel()); 130 fPixels = ((char*)fPixels - y * fRowBytes - x * fInfo.bytesPerPixel());
126 // the intersect may have shrunk info's logical size 131 // the intersect may have shrunk info's logical size
127 fInfo = fInfo.makeWH(srcR.width(), srcR.height()); 132 fInfo = fInfo.makeWH(srcR.width(), srcR.height());
128 fX = srcR.x(); 133 fX = srcR.x();
129 fY = srcR.y(); 134 fY = srcR.y();
130 135
131 return true; 136 return true;
132 } 137 }
OLDNEW
« include/core/SkImageInfo.h ('K') | « src/core/SkBitmap.cpp ('k') | src/core/SkMipMap.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698