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

Side by Side Diff: tests/CodecTest.cpp

Issue 2311793004: Use demux API in SkWebpCodec (Closed)
Patch Set: Fix test Created 4 years, 3 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
« src/codec/SkCodec.cpp ('K') | « src/codec/SkWebpCodec.cpp ('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 "Resources.h" 8 #include "Resources.h"
9 #include "SkAndroidCodec.h" 9 #include "SkAndroidCodec.h"
10 #include "SkBitmap.h" 10 #include "SkBitmap.h"
(...skipping 861 matching lines...) Expand 10 before | Expand all | Expand 10 after
872 size_t peek(void* buf, size_t bytes) const override { 872 size_t peek(void* buf, size_t bytes) const override {
873 return fStream.peek(buf, SkTMin(bytes, fLimit)); 873 return fStream.peek(buf, SkTMin(bytes, fLimit));
874 } 874 }
875 size_t read(void* buf, size_t bytes) override { 875 size_t read(void* buf, size_t bytes) override {
876 return fStream.read(buf, bytes); 876 return fStream.read(buf, bytes);
877 } 877 }
878 bool rewind() override { 878 bool rewind() override {
879 return fStream.rewind(); 879 return fStream.rewind();
880 } 880 }
881 bool isAtEnd() const override { 881 bool isAtEnd() const override {
882 return false; 882 return fStream.isAtEnd();
883 } 883 }
884 private: 884 private:
885 SkMemoryStream fStream; 885 SkMemoryStream fStream;
886 const size_t fLimit; 886 const size_t fLimit;
887 }; 887 };
888 888
889 // Stream that is not an asset stream (!hasPosition() or !hasLength()) 889 // Stream that is not an asset stream (!hasPosition() or !hasLength())
890 class NotAssetMemStream : public SkStream { 890 class NotAssetMemStream : public SkStream {
891 public: 891 public:
892 NotAssetMemStream(sk_sp<SkData> data) : fStream(std::move(data)) {} 892 NotAssetMemStream(sk_sp<SkData> data) : fStream(std::move(data)) {}
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
1113 // Create an arbitrary gray bitmap. 1113 // Create an arbitrary gray bitmap.
1114 path = "grayscale.jpg"; 1114 path = "grayscale.jpg";
1115 stream.reset(resource(path)); 1115 stream.reset(resource(path));
1116 codec.reset(SkCodec::NewFromStream(stream.release())); 1116 codec.reset(SkCodec::NewFromStream(stream.release()));
1117 SkBitmap bm2; 1117 SkBitmap bm2;
1118 bm2.allocPixels(codec->getInfo()); 1118 bm2.allocPixels(codec->getInfo());
1119 result = codec->getPixels(codec->getInfo(), bm2.getPixels(), bm2.rowBytes()) ; 1119 result = codec->getPixels(codec->getInfo(), bm2.getPixels(), bm2.rowBytes()) ;
1120 REPORTER_ASSERT(r, SkCodec::kSuccess == result); 1120 REPORTER_ASSERT(r, SkCodec::kSuccess == result);
1121 check_round_trip(r, bm2); 1121 check_round_trip(r, bm2);
1122 } 1122 }
OLDNEW
« src/codec/SkCodec.cpp ('K') | « src/codec/SkWebpCodec.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698