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

Side by Side Diff: dm/DMSrcSink.cpp

Issue 1711143002: DM: support --config {f16,srgb} (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: stray Created 4 years, 9 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 | « dm/DMSrcSink.h ('k') | no next file » | 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 2015 Google Inc. 2 * Copyright 2015 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 "DMSrcSink.h" 8 #include "DMSrcSink.h"
9 #include "SkAndroidCodec.h" 9 #include "SkAndroidCodec.h"
10 #include "SkCodec.h" 10 #include "SkCodec.h"
(...skipping 1015 matching lines...) Expand 10 before | Expand all | Expand 10 after
1026 Error SVGSink::draw(const Src& src, SkBitmap*, SkWStream* dst, SkString*) const { 1026 Error SVGSink::draw(const Src& src, SkBitmap*, SkWStream* dst, SkString*) const {
1027 SkAutoTDelete<SkXMLWriter> xmlWriter(new SkXMLStreamWriter(dst)); 1027 SkAutoTDelete<SkXMLWriter> xmlWriter(new SkXMLStreamWriter(dst));
1028 SkAutoTUnref<SkCanvas> canvas(SkSVGCanvas::Create( 1028 SkAutoTUnref<SkCanvas> canvas(SkSVGCanvas::Create(
1029 SkRect::MakeWH(SkIntToScalar(src.size().width()), SkIntToScalar(src.size ().height())), 1029 SkRect::MakeWH(SkIntToScalar(src.size().width()), SkIntToScalar(src.size ().height())),
1030 xmlWriter)); 1030 xmlWriter));
1031 return src.draw(canvas); 1031 return src.draw(canvas);
1032 } 1032 }
1033 1033
1034 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~*/ 1034 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~*/
1035 1035
1036 RasterSink::RasterSink(SkColorType colorType) : fColorType(colorType) {} 1036 RasterSink::RasterSink(SkColorType colorType, SkColorProfileType profileType)
1037 : fColorType(colorType)
1038 , fProfileType(profileType) {}
1037 1039
1038 Error RasterSink::draw(const Src& src, SkBitmap* dst, SkWStream*, SkString*) con st { 1040 Error RasterSink::draw(const Src& src, SkBitmap* dst, SkWStream*, SkString*) con st {
1039 const SkISize size = src.size(); 1041 const SkISize size = src.size();
1040 // If there's an appropriate alpha type for this color type, use it, otherwi se use premul. 1042 // If there's an appropriate alpha type for this color type, use it, otherwi se use premul.
1041 SkAlphaType alphaType = kPremul_SkAlphaType; 1043 SkAlphaType alphaType = kPremul_SkAlphaType;
1042 (void)SkColorTypeValidateAlphaType(fColorType, alphaType, &alphaType); 1044 (void)SkColorTypeValidateAlphaType(fColorType, alphaType, &alphaType);
1043 1045
1044 SkMallocPixelRef::ZeroedPRFactory factory; 1046 SkMallocPixelRef::ZeroedPRFactory factory;
1045 dst->allocPixels(SkImageInfo::Make(size.width(), size.height(), fColorType, alphaType), 1047 dst->allocPixels(SkImageInfo::Make(size.width(), size.height(),
1048 fColorType, alphaType, fProfileType),
1046 &factory, 1049 &factory,
1047 nullptr/*colortable*/); 1050 nullptr/*colortable*/);
1048 SkCanvas canvas(*dst); 1051 SkCanvas canvas(*dst);
1049 return src.draw(&canvas); 1052 return src.draw(&canvas);
1050 } 1053 }
1051 1054
1052 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~*/ 1055 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~*/
1053 1056
1054 // Handy for front-patching a Src. Do whatever up-front work you need, then cal l draw_to_canvas(), 1057 // Handy for front-patching a Src. Do whatever up-front work you need, then cal l draw_to_canvas(),
1055 // passing the Sink draw() arguments, a size, and a function draws into an SkCan vas. 1058 // passing the Sink draw() arguments, a size, and a function draws into an SkCan vas.
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after
1419 skr.visit<void>(i, drawsAsSingletonPictures); 1422 skr.visit<void>(i, drawsAsSingletonPictures);
1420 } 1423 }
1421 SkAutoTUnref<SkPicture> macroPic(macroRec.endRecordingAsPicture()); 1424 SkAutoTUnref<SkPicture> macroPic(macroRec.endRecordingAsPicture());
1422 1425
1423 canvas->drawPicture(macroPic); 1426 canvas->drawPicture(macroPic);
1424 return check_against_reference(bitmap, src, fSink); 1427 return check_against_reference(bitmap, src, fSink);
1425 }); 1428 });
1426 } 1429 }
1427 1430
1428 } // namespace DM 1431 } // namespace DM
OLDNEW
« no previous file with comments | « dm/DMSrcSink.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698