| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 "GrConfigConversionEffect.h" | 8 #include "GrConfigConversionEffect.h" |
| 9 #include "GrContext.h" | 9 #include "GrContext.h" |
| 10 #include "GrDrawContext.h" | 10 #include "GrDrawContext.h" |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 for (int x = 0; x < kSize; ++x) { | 167 for (int x = 0; x < kSize; ++x) { |
| 168 uint8_t* color = reinterpret_cast<uint8_t*>(&srcData[kSize*y + x]); | 168 uint8_t* color = reinterpret_cast<uint8_t*>(&srcData[kSize*y + x]); |
| 169 color[3] = y; | 169 color[3] = y; |
| 170 color[2] = SkTMin(x, y); | 170 color[2] = SkTMin(x, y); |
| 171 color[1] = SkTMin(x, y); | 171 color[1] = SkTMin(x, y); |
| 172 color[0] = SkTMin(x, y); | 172 color[0] = SkTMin(x, y); |
| 173 } | 173 } |
| 174 } | 174 } |
| 175 | 175 |
| 176 sk_sp<GrDrawContext> readDC(context->newDrawContext(SkBackingFit::kExact, kS
ize, kSize, | 176 sk_sp<GrDrawContext> readDC(context->newDrawContext(SkBackingFit::kExact, kS
ize, kSize, |
| 177 kConfig)); | 177 kConfig, nullptr)); |
| 178 sk_sp<GrDrawContext> tempDC(context->newDrawContext(SkBackingFit::kExact, kS
ize, kSize, | 178 sk_sp<GrDrawContext> tempDC(context->newDrawContext(SkBackingFit::kExact, kS
ize, kSize, |
| 179 kConfig)); | 179 kConfig, nullptr)); |
| 180 if (!readDC || !tempDC) { | 180 if (!readDC || !tempDC) { |
| 181 return; | 181 return; |
| 182 } | 182 } |
| 183 GrSurfaceDesc desc; | 183 GrSurfaceDesc desc; |
| 184 desc.fWidth = kSize; | 184 desc.fWidth = kSize; |
| 185 desc.fHeight = kSize; | 185 desc.fHeight = kSize; |
| 186 desc.fConfig = kConfig; | 186 desc.fConfig = kConfig; |
| 187 SkAutoTUnref<GrTexture> dataTex(context->textureProvider()->createTexture( | 187 SkAutoTUnref<GrTexture> dataTex(context->textureProvider()->createTexture( |
| 188 desc, SkBudgeted::kYes, data, 0)); | 188 desc, SkBudgeted::kYes, data, 0)); |
| 189 if (!dataTex.get()) { | 189 if (!dataTex.get()) { |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 if (kRGBA_8888_GrPixelConfig != texture->config() && | 265 if (kRGBA_8888_GrPixelConfig != texture->config() && |
| 266 kBGRA_8888_GrPixelConfig != texture->config() && | 266 kBGRA_8888_GrPixelConfig != texture->config() && |
| 267 kNone_PMConversion != pmConversion) { | 267 kNone_PMConversion != pmConversion) { |
| 268 // The PM conversions assume colors are 0..255 | 268 // The PM conversions assume colors are 0..255 |
| 269 return nullptr; | 269 return nullptr; |
| 270 } | 270 } |
| 271 return sk_sp<GrFragmentProcessor>( | 271 return sk_sp<GrFragmentProcessor>( |
| 272 new GrConfigConversionEffect(texture, swizzle, pmConversion, matrix)
); | 272 new GrConfigConversionEffect(texture, swizzle, pmConversion, matrix)
); |
| 273 } | 273 } |
| 274 } | 274 } |
| OLD | NEW |