Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(198)

Side by Side Diff: cc/output/color_lut_cache.cc

Issue 2696603003: color: Towards ColorTransform optimizations and code generation (Closed)
Patch Set: Keep fixing the windows build Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | ui/gfx/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « no previous file | ui/gfx/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698