diff options
author | 2015-03-02 12:23:48 -0800 | |
---|---|---|
committer | 2015-03-02 12:23:48 -0800 | |
commit | ca358852b4fed656d11107b2aaf28318a4518b49 (patch) | |
tree | 88ccb56a0f51ac9c40d639a095e328a3ac380257 /gyp/copy_file.py | |
parent | d0f5457c5ec974b3a0b080125a5ba07214c6d9d2 (diff) |
Add SkCodec, including PNG implementation.
DM:
Add a flag to use SkCodec instead of SkImageDecoder.
SkCodec:
Base class for codecs, allowing creation from an SkStream or an SkData.
An SkCodec, on creation, knows properties of the data like its width and height. Further calls can be used to generate the image.
TODO: Add scanline iterator
SkPngCodec:
New decoder for png. Wraps libpng. The code has been repurposed from SkImageDecoder_libpng.
TODO: Handle other destination colortypes
TODO: Substitute the transpose color
TODO: Allow silencing warnings
TODO: Use RGB instead of filler?
TODO: sRGB
SkSwizzler:
Simplified version of SkScaledSampler. Unlike the sampler, this object does no sampling.
TODO: Implement other swizzles.
BUG=skia:3257
Review URL: https://codereview.chromium.org/930283002
Diffstat (limited to 'gyp/copy_file.py')
-rw-r--r-- | gyp/copy_file.py | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/gyp/copy_file.py b/gyp/copy_file.py new file mode 100644 index 0000000000..7268bf216f --- /dev/null +++ b/gyp/copy_file.py @@ -0,0 +1,39 @@ +#!/usr/bin/python + +# Copyright 2015 Google Inc. +# +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Copy a file. +""" + +import argparse +import os +import shutil + +if __name__ == '__main__': + parser = argparse.ArgumentParser() + parser.add_argument('src', help='File to copy.') + parser.add_argument('dst', help='Location to copy to.') + args = parser.parse_args() + + src = os.path.abspath(os.path.join(os.getcwd(), args.src)) + dst = os.path.abspath(os.path.join(os.getcwd(), args.dst)) + + print 'Copying from %s to %s' % (src, dst) + + src_dir = os.path.dirname(src) + if not os.path.exists(src_dir): + raise AssertionError('src directory %s does not exist!' % src_dir) + + if not os.path.exists(src): + raise AssertionError('file to copy %s does not exist' % src) + + dst_dir = os.path.dirname(dst) + if not os.path.exists(dst_dir): + print 'dst directory %s does not exist! creating it!' % dst_dir + os.makedirs(dst_dir) + + shutil.copyfile(src, dst) |