| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "cc/output/color_lut_cache.h" | 5 #include "cc/output/color_lut_cache.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 #include <cmath> | 8 #include <cmath> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 float one = 1.0f; | 69 float one = 1.0f; |
| 70 T alpha; | 70 T alpha; |
| 71 FloatToLUT(&one, &alpha, 1); | 71 FloatToLUT(&one, &alpha, 1); |
| 72 for (int v = 0; v < lut_samples; v++) { | 72 for (int v = 0; v < lut_samples; v++) { |
| 73 for (int u = 0; u < lut_samples; u++) { | 73 for (int u = 0; u < lut_samples; u++) { |
| 74 for (int y = 0; y < lut_samples; y++) { | 74 for (int y = 0; y < lut_samples; y++) { |
| 75 samples[y].set_x(y * inverse); | 75 samples[y].set_x(y * inverse); |
| 76 samples[y].set_y(u * inverse); | 76 samples[y].set_y(u * inverse); |
| 77 samples[y].set_z(v * inverse); | 77 samples[y].set_z(v * inverse); |
| 78 } | 78 } |
| 79 transform->transform(samples.data(), samples.size()); | 79 transform->Transform(samples.data(), samples.size()); |
| 80 T* lutp2 = lutp + lut_samples; | 80 T* lutp2 = lutp + lut_samples; |
| 81 FloatToLUT(reinterpret_cast<float*>(samples.data()), lutp2, | 81 FloatToLUT(reinterpret_cast<float*>(samples.data()), lutp2, |
| 82 lut_samples * 3); | 82 lut_samples * 3); |
| 83 for (int i = 0; i < lut_samples; i++) { | 83 for (int i = 0; i < lut_samples; i++) { |
| 84 *(lutp++) = *(lutp2++); | 84 *(lutp++) = *(lutp2++); |
| 85 *(lutp++) = *(lutp2++); | 85 *(lutp++) = *(lutp2++); |
| 86 *(lutp++) = *(lutp2++); | 86 *(lutp++) = *(lutp2++); |
| 87 *(lutp++) = alpha; | 87 *(lutp++) = alpha; |
| 88 } | 88 } |
| 89 } | 89 } |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 | 131 |
| 132 void ColorLUTCache::Swap() { | 132 void ColorLUTCache::Swap() { |
| 133 current_frame_++; | 133 current_frame_++; |
| 134 while (!lut_cache_.empty() && | 134 while (!lut_cache_.empty() && |
| 135 current_frame_ - lut_cache_.rbegin()->second.last_used_frame > | 135 current_frame_ - lut_cache_.rbegin()->second.last_used_frame > |
| 136 kMaxFramesUnused) { | 136 kMaxFramesUnused) { |
| 137 gl_->DeleteTextures(1, &lut_cache_.rbegin()->second.lut.texture); | 137 gl_->DeleteTextures(1, &lut_cache_.rbegin()->second.lut.texture); |
| 138 lut_cache_.ShrinkToSize(lut_cache_.size() - 1); | 138 lut_cache_.ShrinkToSize(lut_cache_.size() - 1); |
| 139 } | 139 } |
| 140 } | 140 } |
| OLD | NEW |