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

Side by Side Diff: gm/colorcube.cpp

Issue 1262703002: make tests portable by using 565 compatible colors (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix dstreadshuffle text portable gm Created 5 years, 4 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 | « gm/bmpfilterqualityrepeat.cpp ('k') | gm/discard.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2014 Google Inc. 2 * Copyright 2014 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "gm.h" 8 #include "gm.h"
9 #include "SkColorCubeFilter.h" 9 #include "SkColorCubeFilter.h"
10 #include "SkBitmapSource.h" 10 #include "SkBitmapSource.h"
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 uint8_t* lut = (uint8_t*)lutMemory.get(); 78 uint8_t* lut = (uint8_t*)lutMemory.get();
79 uint8_t* invLut = (uint8_t*)invLutMemory.get(); 79 uint8_t* invLut = (uint8_t*)invLutMemory.get();
80 const int maxIndex = size - 1; 80 const int maxIndex = size - 1;
81 for (int i = 0; i < size; i++) { 81 for (int i = 0; i < size; i++) {
82 lut[i] = (i * 255) / maxIndex; 82 lut[i] = (i * 255) / maxIndex;
83 invLut[i] = ((maxIndex - i) * 255) / maxIndex; 83 invLut[i] = ((maxIndex - i) * 255) / maxIndex;
84 } 84 }
85 for (int r = 0; r < size; ++r) { 85 for (int r = 0; r < size; ++r) {
86 for (int g = 0; g < size; ++g) { 86 for (int g = 0; g < size; ++g) {
87 for (int b = 0; b < size; ++b) { 87 for (int b = 0; b < size; ++b) {
88 pixels[(size * ((size * b) + g)) + r] = SkColorSetARGB(0xFF, 88 pixels[(size * ((size * b) + g)) + r] = sk_tool_utils::color _to_565(
89 SkColorSetARGB(0xFF,
89 invR ? invLut[r] : lut[r], 90 invR ? invLut[r] : lut[r],
90 invG ? invLut[g] : lut[g], 91 invG ? invLut[g] : lut[g],
91 invB ? invLut[b] : lut[b]); 92 invB ? invLut[b] : lut[b]));
92 } 93 }
93 } 94 }
94 } 95 }
95 } 96 }
96 97
97 virtual SkISize onISize() { 98 virtual SkISize onISize() {
98 return SkISize::Make(500, 100); 99 return SkISize::Make(500, 100);
99 } 100 }
100 101
101 virtual void onDraw(SkCanvas* canvas) { 102 virtual void onDraw(SkCanvas* canvas) {
(...skipping 30 matching lines...) Expand all
132 SkData* f3DLut32; 133 SkData* f3DLut32;
133 SkData* f3DLut64; 134 SkData* f3DLut64;
134 }; 135 };
135 136
136 ////////////////////////////////////////////////////////////////////////////// 137 //////////////////////////////////////////////////////////////////////////////
137 138
138 static GM* MyFactory(void*) { return new ColorCubeGM; } 139 static GM* MyFactory(void*) { return new ColorCubeGM; }
139 static GMRegistry reg(MyFactory); 140 static GMRegistry reg(MyFactory);
140 141
141 } 142 }
OLDNEW
« no previous file with comments | « gm/bmpfilterqualityrepeat.cpp ('k') | gm/discard.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698