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

Unified Diff: gm/factory.cpp

Issue 14336003: Move MMap to SkData. (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Work on Linux. Created 7 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | include/core/SkData.h » ('j') | src/core/SkStream.cpp » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/factory.cpp
===================================================================
--- gm/factory.cpp (revision 8838)
+++ gm/factory.cpp (working copy)
@@ -32,12 +32,12 @@
// Copyright-free file from http://openclipart.org/detail/29213/paper-plane-by-ddoo
filename.append("plane.png");
- SkFILEStream stream(filename.c_str());
- if (stream.isValid()) {
- stream.rewind();
- size_t length = stream.getLength();
+ SkAutoTUnref<SkStream> stream(SkStream::NewFromFile(filename.c_str()));
+ if (NULL != stream.get()) {
+ stream->rewind();
+ size_t length = stream->getLength();
void* buffer = sk_malloc_throw(length);
- stream.read(buffer, length);
+ stream->read(buffer, length);
SkAutoDataUnref data(SkData::NewFromMalloc(buffer, length));
SkBitmapFactory factory(&SkImageDecoder::DecodeMemoryToTarget);
// Create a cache which will boot the pixels out anytime the
« no previous file with comments | « no previous file | include/core/SkData.h » ('j') | src/core/SkStream.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698