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

Side by Side Diff: src/images/SkImageEncoder.cpp

Issue 1371983003: Revert of change pixel-serializer to support reencoding existing data (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 2 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/images/SkImageDecoder_ktx.cpp ('k') | tests/ImageTest.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 2009 The Android Open Source Project 2 * Copyright 2009 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 "SkImageEncoder.h" 8 #include "SkImageEncoder.h"
9 #include "SkBitmap.h" 9 #include "SkBitmap.h"
10 #include "SkStream.h" 10 #include "SkStream.h"
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 53
54 SkData* SkImageEncoder::EncodeData(const SkImageInfo& info, const void* pixels, size_t rowBytes, 54 SkData* SkImageEncoder::EncodeData(const SkImageInfo& info, const void* pixels, size_t rowBytes,
55 Type t, int quality) { 55 Type t, int quality) {
56 SkBitmap bm; 56 SkBitmap bm;
57 if (!bm.installPixels(info, const_cast<void*>(pixels), rowBytes)) { 57 if (!bm.installPixels(info, const_cast<void*>(pixels), rowBytes)) {
58 return nullptr; 58 return nullptr;
59 } 59 }
60 SkAutoTDelete<SkImageEncoder> enc(SkImageEncoder::Create(t)); 60 SkAutoTDelete<SkImageEncoder> enc(SkImageEncoder::Create(t));
61 return enc.get() ? enc.get()->encodeData(bm, quality) : nullptr; 61 return enc.get() ? enc.get()->encodeData(bm, quality) : nullptr;
62 } 62 }
63
64 SkData* SkImageEncoder::EncodeData(const SkPixmap& pmap, Type t, int quality) {
65 return EncodeData(pmap.info(), pmap.addr(), pmap.rowBytes(), t, quality);
66 }
67
68 SkData* SkImageEncoder::ReencodeData(SkData* encoded, Type t) {
69 SkAutoTDelete<SkImageEncoder> enc(SkImageEncoder::Create(t));
70 return enc.get() ? enc.get()->onReencodeData(encoded) : nullptr;
71 }
72
OLDNEW
« no previous file with comments | « src/images/SkImageDecoder_ktx.cpp ('k') | tests/ImageTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698