SkYUVASizeInfo.cpp 666 B

1234567891011121314151617181920212223
  1. /*
  2. * Copyright 2018 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 "include/core/SkYUVASizeInfo.h"
  8. #include "include/private/SkTemplates.h"
  9. void SkYUVASizeInfo::computePlanes(void* base, void* planes[SkYUVASizeInfo::kMaxCount]) const {
  10. planes[0] = base;
  11. int i = 1;
  12. for (; i < SkYUVASizeInfo::kMaxCount; ++i) {
  13. if (fSizes[i].isEmpty()) {
  14. break;
  15. }
  16. planes[i] = SkTAddOffset<void>(planes[i - 1], fWidthBytes[i - 1] * fSizes[i - 1].height());
  17. }
  18. for (; i < SkYUVASizeInfo::kMaxCount; ++i) {
  19. planes[i] = nullptr;
  20. }
  21. }