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

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

Issue 2229953003: Support for custom primaries (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: test updated Created 4 years, 3 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 | cc/quads/draw_quad_unittest.cc » ('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 28 matching lines...) Expand all
39 }; 39 };
40 40
41 unsigned int ColorLUTCache::MakeLUT(const gfx::ColorSpace& from, 41 unsigned int ColorLUTCache::MakeLUT(const gfx::ColorSpace& from,
42 gfx::ColorSpace to, 42 gfx::ColorSpace to,
43 int lut_samples) { 43 int lut_samples) {
44 if (to == gfx::ColorSpace()) { 44 if (to == gfx::ColorSpace()) {
45 to = gfx::ColorSpace::CreateSRGB(); 45 to = gfx::ColorSpace::CreateSRGB();
46 } 46 }
47 std::unique_ptr<gfx::ColorTransform> transform( 47 std::unique_ptr<gfx::ColorTransform> transform(
48 gfx::ColorTransform::NewColorTransform( 48 gfx::ColorTransform::NewColorTransform(
49 from, to, gfx::ColorTransform::Intent::PERCEPTUAL)); 49 from, to, gfx::ColorTransform::Intent::INTENT_PERCEPTUAL));
50 50
51 int lut_entries = lut_samples * lut_samples * lut_samples; 51 int lut_entries = lut_samples * lut_samples * lut_samples;
52 float inverse = 1.0f / (lut_samples - 1); 52 float inverse = 1.0f / (lut_samples - 1);
53 std::vector<unsigned char> lut(lut_entries * 4); 53 std::vector<unsigned char> lut(lut_entries * 4);
54 std::vector<gfx::ColorTransform::TriStim> samples(lut_samples * 3); 54 std::vector<gfx::ColorTransform::TriStim> samples(lut_samples * 3);
55 unsigned char* lutp = lut.data(); 55 unsigned char* lutp = lut.data();
56 for (int y = 0; y < lut_samples; y++) { 56 for (int y = 0; y < lut_samples; y++) {
57 for (int v = 0; v < lut_samples; v++) { 57 for (int v = 0; v < lut_samples; v++) {
58 for (int u = 0; u < lut_samples; u++) { 58 for (int u = 0; u < lut_samples; u++) {
59 samples[u].set_x(y * inverse); 59 samples[u].set_x(y * inverse);
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 100
101 void ColorLUTCache::Swap() { 101 void ColorLUTCache::Swap() {
102 current_frame_++; 102 current_frame_++;
103 while (!lut_cache_.empty() && 103 while (!lut_cache_.empty() &&
104 current_frame_ - lut_cache_.rbegin()->second.first > 104 current_frame_ - lut_cache_.rbegin()->second.first >
105 kMaxFramesUnused) { 105 kMaxFramesUnused) {
106 gl_->DeleteTextures(1, &lut_cache_.rbegin()->second.first); 106 gl_->DeleteTextures(1, &lut_cache_.rbegin()->second.first);
107 lut_cache_.ShrinkToSize(lut_cache_.size() - 1); 107 lut_cache_.ShrinkToSize(lut_cache_.size() - 1);
108 } 108 }
109 } 109 }
OLDNEW
« no previous file with comments | « no previous file | cc/quads/draw_quad_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698