SkAndroidCodecAdapter.cpp 1.0 KB

123456789101112131415161718192021222324252627282930
  1. /*
  2. * Copyright 2015 Google Inc.
  3. *
  4. * Use of this source code is governed by a BSD-style license that can be
  5. * found in the LICENSE file.
  6. */
  7. #include "src/codec/SkAndroidCodecAdapter.h"
  8. #include "src/codec/SkCodecPriv.h"
  9. SkAndroidCodecAdapter::SkAndroidCodecAdapter(SkCodec* codec, ExifOrientationBehavior behavior)
  10. : INHERITED(codec, behavior)
  11. {}
  12. SkISize SkAndroidCodecAdapter::onGetSampledDimensions(int sampleSize) const {
  13. float scale = get_scale_from_sample_size(sampleSize);
  14. return this->codec()->getScaledDimensions(scale);
  15. }
  16. bool SkAndroidCodecAdapter::onGetSupportedSubset(SkIRect* desiredSubset) const {
  17. return this->codec()->getValidSubset(desiredSubset);
  18. }
  19. SkCodec::Result SkAndroidCodecAdapter::onGetAndroidPixels(const SkImageInfo& info, void* pixels,
  20. size_t rowBytes, const AndroidOptions& options) {
  21. SkCodec::Options codecOptions;
  22. codecOptions.fZeroInitialized = options.fZeroInitialized;
  23. codecOptions.fSubset = options.fSubset;
  24. return this->codec()->getPixels(info, pixels, rowBytes, &codecOptions);
  25. }