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

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

Issue 2074103004: Revert of More removal of SkColorProfileType... (Closed) Base URL: https://skia.googlesource.com/skia.git@master
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
« no previous file with comments | « include/private/SkImageInfoPriv.h ('k') | src/core/SkImageInfo.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 2008 The Android Open Source Project 2 * Copyright 2008 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 #include "SkBitmapDevice.h" 8 #include "SkBitmapDevice.h"
9 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkCanvasPriv.h" 10 #include "SkCanvasPriv.h"
(...skipping 1159 matching lines...) Expand 10 before | Expand all | Expand 10 after
1170 p.setImageFilter(filter->makeWithLocalMatrix(ctm)); 1170 p.setImageFilter(filter->makeWithLocalMatrix(ctm));
1171 const SkScalar x = SkIntToScalar(src->getOrigin().x()); 1171 const SkScalar x = SkIntToScalar(src->getOrigin().x());
1172 const SkScalar y = SkIntToScalar(src->getOrigin().y()); 1172 const SkScalar y = SkIntToScalar(src->getOrigin().y());
1173 c.drawBitmap(srcBM, x, y, &p); 1173 c.drawBitmap(srcBM, x, y, &p);
1174 } 1174 }
1175 1175
1176 static SkImageInfo make_layer_info(const SkImageInfo& prev, int w, int h, bool i sOpaque, 1176 static SkImageInfo make_layer_info(const SkImageInfo& prev, int w, int h, bool i sOpaque,
1177 const SkPaint* paint) { 1177 const SkPaint* paint) {
1178 // need to force L32 for now if we have an image filter. Once filters suppor t other colortypes 1178 // need to force L32 for now if we have an image filter. Once filters suppor t other colortypes
1179 // e.g. sRGB or F16, we can remove this check 1179 // e.g. sRGB or F16, we can remove this check
1180 // SRGBTODO: Can we remove this check now?
1181 const bool hasImageFilter = paint && paint->getImageFilter(); 1180 const bool hasImageFilter = paint && paint->getImageFilter();
1182 1181
1183 SkAlphaType alphaType = isOpaque ? kOpaque_SkAlphaType : kPremul_SkAlphaType ; 1182 SkAlphaType alphaType = isOpaque ? kOpaque_SkAlphaType : kPremul_SkAlphaType ;
1184 if ((prev.bytesPerPixel() < 4) || hasImageFilter) { 1183 if ((prev.bytesPerPixel() < 4) || hasImageFilter) {
1185 // force to L32 1184 // force to L32
1186 return SkImageInfo::MakeN32(w, h, alphaType); 1185 return SkImageInfo::MakeN32(w, h, alphaType);
1187 } else { 1186 } else {
1188 // keep the same characteristics as the prev 1187 // keep the same characteristics as the prev
1189 return SkImageInfo::Make(w, h, prev.colorType(), alphaType, sk_ref_sp(pr ev.colorSpace())); 1188 return SkImageInfo::Make(w, h, prev.colorType(), alphaType, prev.profile Type());
1190 } 1189 }
1191 } 1190 }
1192 1191
1193 void SkCanvas::internalSaveLayer(const SaveLayerRec& rec, SaveLayerStrategy stra tegy) { 1192 void SkCanvas::internalSaveLayer(const SaveLayerRec& rec, SaveLayerStrategy stra tegy) {
1194 const SkRect* bounds = rec.fBounds; 1193 const SkRect* bounds = rec.fBounds;
1195 const SkPaint* paint = rec.fPaint; 1194 const SkPaint* paint = rec.fPaint;
1196 SaveLayerFlags saveLayerFlags = rec.fSaveLayerFlags; 1195 SaveLayerFlags saveLayerFlags = rec.fSaveLayerFlags;
1197 1196
1198 #ifndef SK_SUPPORT_LEGACY_CLIPTOLAYERFLAG 1197 #ifndef SK_SUPPORT_LEGACY_CLIPTOLAYERFLAG
1199 saveLayerFlags &= ~kDontClipToLayer_PrivateSaveLayerFlag; 1198 saveLayerFlags &= ~kDontClipToLayer_PrivateSaveLayerFlag;
(...skipping 1875 matching lines...) Expand 10 before | Expand all | Expand 10 after
3075 3074
3076 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() { 3075 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() {
3077 fCanvas->restoreToCount(fSaveCount); 3076 fCanvas->restoreToCount(fSaveCount);
3078 } 3077 }
3079 3078
3080 #ifdef SK_SUPPORT_LEGACY_NEW_SURFACE_API 3079 #ifdef SK_SUPPORT_LEGACY_NEW_SURFACE_API
3081 SkSurface* SkCanvas::newSurface(const SkImageInfo& info, const SkSurfaceProps* p rops) { 3080 SkSurface* SkCanvas::newSurface(const SkImageInfo& info, const SkSurfaceProps* p rops) {
3082 return this->makeSurface(info, props).release(); 3081 return this->makeSurface(info, props).release();
3083 } 3082 }
3084 #endif 3083 #endif
OLDNEW
« no previous file with comments | « include/private/SkImageInfoPriv.h ('k') | src/core/SkImageInfo.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698