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

Side by Side Diff: third_party/WebKit/Source/platform/graphics/PictureSnapshot.cpp

Issue 2454123002: Refactor image decoders to use 'colorSpace' instead of 'colorProfile' (Closed)
Patch Set: Fix legacy ImageFrame Created 4 years, 1 month 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 (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 class SkiaImageDecoder final : public SkImageDeserializer { 60 class SkiaImageDecoder final : public SkImageDeserializer {
61 public: 61 public:
62 sk_sp<SkImage> makeFromMemory(const void* data, 62 sk_sp<SkImage> makeFromMemory(const void* data,
63 size_t length, 63 size_t length,
64 const SkIRect* subset) override { 64 const SkIRect* subset) override {
65 // No need to copy the data; this decodes immediately. 65 // No need to copy the data; this decodes immediately.
66 RefPtr<SegmentReader> segmentReader = 66 RefPtr<SegmentReader> segmentReader =
67 SegmentReader::createFromSkData(SkData::MakeWithoutCopy(data, length)); 67 SegmentReader::createFromSkData(SkData::MakeWithoutCopy(data, length));
68 std::unique_ptr<ImageDecoder> imageDecoder = ImageDecoder::create( 68 std::unique_ptr<ImageDecoder> imageDecoder = ImageDecoder::create(
69 segmentReader.release(), true, ImageDecoder::AlphaPremultiplied, 69 segmentReader.release(), true, ImageDecoder::AlphaPremultiplied,
70 ImageDecoder::GammaAndColorProfileIgnored); 70 ImageDecoder::ColorSpaceIgnored);
71 if (!imageDecoder) 71 if (!imageDecoder)
72 return nullptr; 72 return nullptr;
73 73
74 ImageFrame* frame = imageDecoder->frameBufferAtIndex(0); 74 ImageFrame* frame = imageDecoder->frameBufferAtIndex(0);
75 return (frame && !imageDecoder->failed()) 75 return (frame && !imageDecoder->failed())
76 ? frame->finalizePixelsAndGetImage() 76 ? frame->finalizePixelsAndGetImage()
77 : nullptr; 77 : nullptr;
78 } 78 }
79 sk_sp<SkImage> makeFromData(SkData* data, const SkIRect* subset) override { 79 sk_sp<SkImage> makeFromData(SkData* data, const SkIRect* subset) override {
80 return this->makeFromMemory(data->data(), data->size(), subset); 80 return this->makeFromMemory(data->data(), data->size(), subset);
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 } 196 }
197 197
198 std::unique_ptr<JSONArray> PictureSnapshot::snapshotCommandLog() const { 198 std::unique_ptr<JSONArray> PictureSnapshot::snapshotCommandLog() const {
199 const SkIRect bounds = m_picture->cullRect().roundOut(); 199 const SkIRect bounds = m_picture->cullRect().roundOut();
200 LoggingCanvas canvas(bounds.width(), bounds.height()); 200 LoggingCanvas canvas(bounds.width(), bounds.height());
201 m_picture->playback(&canvas); 201 m_picture->playback(&canvas);
202 return canvas.log(); 202 return canvas.log();
203 } 203 }
204 204
205 } // namespace blink 205 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698