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

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

Issue 2052943002: SkPixmap::setColorSpace (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: std::move() 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
« no previous file with comments | « src/core/SkDraw.cpp ('k') | src/core/SkPixmap.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 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 14 matching lines...) Expand all
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, 33 SkImageInfo SkImageInfo::Make(int width, int height, SkColorType ct, SkAlphaType at,
34 sk_sp<SkColorSpace> cs) { 34 sk_sp<SkColorSpace> cs) {
35 return SkImageInfo(width, height, ct, at, SkDefaultColorProfile(), std::move (cs)); 35 SkColorProfileType pt = SkDefaultColorProfile();
36 // try to keep the enum and the colorspace in sync.
37 // TODO: eliminate the enum entirely, now that we have colorspace objects
38 if (cs && (SkColorSpace::kLinear_GammaNamed != cs->gammaNamed())) {
39 pt = kSRGB_SkColorProfileType;
40 }
41 return SkImageInfo(width, height, ct, at, pt, std::move(cs));
36 } 42 }
37 43
38 SkImageInfo SkImageInfo::MakeS32(int width, int height, SkAlphaType at) { 44 SkImageInfo SkImageInfo::MakeS32(int width, int height, SkAlphaType at) {
39 return SkImageInfo(width, height, kN32_SkColorType, at, kSRGB_SkColorProfile Type, 45 return SkImageInfo(width, height, kN32_SkColorType, at, kSRGB_SkColorProfile Type,
40 SkColorSpace::NewNamed(SkColorSpace::kSRGB_Named)); 46 SkColorSpace::NewNamed(SkColorSpace::kSRGB_Named));
41 } 47 }
42 48
43 void SkImageInfo::unflatten(SkReadBuffer& buffer) { 49 void SkImageInfo::unflatten(SkReadBuffer& buffer) {
44 fWidth = buffer.read32(); 50 fWidth = buffer.read32();
45 fHeight = buffer.read32(); 51 fHeight = buffer.read32();
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 } 139 }
134 // here x,y are either 0 or negative 140 // here x,y are either 0 or negative
135 fPixels = ((char*)fPixels - y * fRowBytes - x * fInfo.bytesPerPixel()); 141 fPixels = ((char*)fPixels - y * fRowBytes - x * fInfo.bytesPerPixel());
136 // the intersect may have shrunk info's logical size 142 // the intersect may have shrunk info's logical size
137 fInfo = fInfo.makeWH(srcR.width(), srcR.height()); 143 fInfo = fInfo.makeWH(srcR.width(), srcR.height());
138 fX = srcR.x(); 144 fX = srcR.x();
139 fY = srcR.y(); 145 fY = srcR.y();
140 146
141 return true; 147 return true;
142 } 148 }
OLDNEW
« no previous file with comments | « src/core/SkDraw.cpp ('k') | src/core/SkPixmap.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698