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

Side by Side Diff: third_party/WebKit/Source/platform/image-decoders/SkDataSegmentReader.cpp

Issue 1812273003: Eliminate copies of encoded image data (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "SkDataSegmentReader.h"
6
7 namespace blink {
8
9 SkDataSegmentReader::SkDataSegmentReader(PassRefPtr<SkData> data)
10 : m_data(skia::AdoptRef(data.leakRef())) {}
11
12 size_t SkDataSegmentReader::size() const
13 {
14 return m_data->size();
15 }
16
17 size_t SkDataSegmentReader::getSomeData(const char*& data, size_t position) cons t
18 {
19 if (position >= m_data->size())
20 return 0;
21
22 data = reinterpret_cast<const char*>(m_data->bytes() + position);
Peter Kasting 2016/03/23 02:42:59 I'm sort of tempted to suggest using uint8_t* ever
scroggo_chromium 2016/03/24 13:59:46 Haha +1!
23 return m_data->size() - position;
24 }
25
26 PassRefPtr<SkData> SkDataSegmentReader::getAsSkData() const
27 {
28 return m_data.get();
29 }
30
31 } // namespace blink
32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698