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

Side by Side Diff: dm/DMSrcSink.cpp

Issue 1010813003: Revert of Bmp Image Decoding (Closed) Base URL: https://skia.googlesource.com/skia.git@decode-leon-3
Patch Set: Created 5 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 | « no previous file | gyp/codec.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #include "DMSrcSink.h" 1 #include "DMSrcSink.h"
2 #include "SamplePipeControllers.h" 2 #include "SamplePipeControllers.h"
3 #include "SkCommonFlags.h" 3 #include "SkCommonFlags.h"
4 #include "SkCodec.h" 4 #include "SkCodec.h"
5 #include "SkDocument.h" 5 #include "SkDocument.h"
6 #include "SkError.h" 6 #include "SkError.h"
7 #include "SkMultiPictureDraw.h" 7 #include "SkMultiPictureDraw.h"
8 #include "SkNullCanvas.h" 8 #include "SkNullCanvas.h"
9 #include "SkOSFile.h" 9 #include "SkOSFile.h"
10 #include "SkPictureRecorder.h" 10 #include "SkPictureRecorder.h"
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 return Error::Nonfatal("Uninteresting to decode image with alpha into 565."); 133 return Error::Nonfatal("Uninteresting to decode image with alpha into 565.");
134 } 134 }
135 canvas->drawBitmap(subset, SkIntToScalar(x), SkIntToScalar(y)); 135 canvas->drawBitmap(subset, SkIntToScalar(x), SkIntToScalar(y));
136 } 136 }
137 } 137 }
138 return ""; 138 return "";
139 } 139 }
140 140
141 SkISize ImageSrc::size() const { 141 SkISize ImageSrc::size() const {
142 SkAutoTUnref<SkData> encoded(SkData::NewFromFileName(fPath.c_str())); 142 SkAutoTUnref<SkData> encoded(SkData::NewFromFileName(fPath.c_str()));
143 if (FLAGS_codec) { 143 SkBitmap bitmap;
144 SkAutoTDelete<SkCodec> codec(SkCodec::NewFromData(encoded)); 144 if (!encoded || !SkImageDecoder::DecodeMemory(encoded->data(),
145 if (!codec) { 145 encoded->size(),
146 return SkISize::Make(0,0); 146 &bitmap,
147 } 147 kUnknown_SkColorType,
148 SkImageInfo info; 148 SkImageDecoder::kDecodeBounds_ Mode)) {
149 if (!codec->getInfo(&info)) { 149 return SkISize::Make(0,0);
150 return SkISize::Make(0,0);
151 }
152 return info.dimensions();
153 } else {
154 SkBitmap bitmap;
155 if (!encoded || !SkImageDecoder::DecodeMemory(encoded->data(),
156 encoded->size(),
157 &bitmap,
158 kUnknown_SkColorType,
159 SkImageDecoder::kDecodeBou nds_Mode)) {
160 return SkISize::Make(0,0);
161 }
162 return bitmap.dimensions();
163 } 150 }
151 return bitmap.dimensions();
164 } 152 }
165 153
166 Name ImageSrc::name() const { 154 Name ImageSrc::name() const {
167 return SkOSPath::Basename(fPath.c_str()); 155 return SkOSPath::Basename(fPath.c_str());
168 } 156 }
169 157
170 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~*/ 158 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~*/
171 159
172 static const SkRect kSKPViewport = {0,0, 1000,1000}; 160 static const SkRect kSKPViewport = {0,0, 1000,1000};
173 161
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after
545 surfaces.unrefAll(); 533 surfaces.unrefAll();
546 return ""; 534 return "";
547 } 535 }
548 SkISize size() const SK_OVERRIDE { return fSize; } 536 SkISize size() const SK_OVERRIDE { return fSize; }
549 Name name() const SK_OVERRIDE { sk_throw(); return ""; } // No one shou ld be calling this. 537 Name name() const SK_OVERRIDE { sk_throw(); return ""; } // No one shou ld be calling this.
550 } proxy(fW, fH, pic, src.size()); 538 } proxy(fW, fH, pic, src.size());
551 return fSink->draw(proxy, bitmap, stream, log); 539 return fSink->draw(proxy, bitmap, stream, log);
552 } 540 }
553 541
554 } // namespace DM 542 } // namespace DM
OLDNEW
« no previous file with comments | « no previous file | gyp/codec.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698