Ruben Brunk | e507721 | 2014-04-28 16:39:12 -0700 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright 2014 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #include <img_utils/TiffEntryImpl.h> |
| 18 | #include <img_utils/TiffIfd.h> |
| 19 | |
| 20 | #include <utils/Vector.h> |
| 21 | |
| 22 | namespace android { |
| 23 | namespace img_utils { |
| 24 | |
| 25 | template<> |
| 26 | uint32_t TiffEntryImpl<TiffIfd>::getSize() const { |
| 27 | uint32_t total = 0; |
| 28 | for (uint32_t i = 0; i < mCount; ++i) { |
| 29 | total += mData[i].getSize(); |
| 30 | } |
| 31 | return total; |
| 32 | } |
| 33 | |
| 34 | template<> |
| 35 | status_t TiffEntryImpl<TiffIfd>::writeData(uint32_t offset, EndianOutput* out) const { |
| 36 | status_t ret = OK; |
| 37 | for (uint32_t i = 0; i < mCount; ++i) { |
| 38 | BAIL_ON_FAIL(mData[i].writeData(offset, out), ret); |
| 39 | } |
| 40 | return ret; |
| 41 | } |
| 42 | |
| 43 | } /*namespace img_utils*/ |
| 44 | } /*namespace android*/ |