OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 "SkTableColorFilter.h" | 8 #include "SkTableColorFilter.h" |
9 | 9 |
10 #include "SkBitmap.h" | 10 #include "SkBitmap.h" |
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
466 desc.fWidth = bitmap.width(); | 466 desc.fWidth = bitmap.width(); |
467 desc.fHeight = 128; | 467 desc.fHeight = 128; |
468 desc.fRowHeight = bitmap.height(); | 468 desc.fRowHeight = bitmap.height(); |
469 desc.fContext = context; | 469 desc.fContext = context; |
470 desc.fConfig = SkImageInfo2GrPixelConfig(bitmap.info(), *context->caps()); | 470 desc.fConfig = SkImageInfo2GrPixelConfig(bitmap.info(), *context->caps()); |
471 GrTextureStripAtlas* atlas = GrTextureStripAtlas::GetAtlas(desc); | 471 GrTextureStripAtlas* atlas = GrTextureStripAtlas::GetAtlas(desc); |
472 int row = atlas->lockRow(bitmap); | 472 int row = atlas->lockRow(bitmap); |
473 SkAutoTUnref<GrTexture> texture; | 473 SkAutoTUnref<GrTexture> texture; |
474 if (-1 == row) { | 474 if (-1 == row) { |
475 atlas = nullptr; | 475 atlas = nullptr; |
476 texture.reset(GrRefCachedBitmapTexture(context, bitmap, GrTextureParams:
:ClampNoFilter())); | 476 texture.reset(GrRefCachedBitmapTexture(context, bitmap, GrTextureParams:
:ClampNoFilter(), |
| 477 SkSourceGammaTreatment::kRespect)
); |
477 } else { | 478 } else { |
478 texture.reset(SkRef(atlas->getTexture())); | 479 texture.reset(SkRef(atlas->getTexture())); |
479 } | 480 } |
480 | 481 |
481 return new ColorTableEffect(texture, atlas, row, flags); | 482 return new ColorTableEffect(texture, atlas, row, flags); |
482 } | 483 } |
483 | 484 |
484 ColorTableEffect::ColorTableEffect(GrTexture* texture, GrTextureStripAtlas* atla
s, int row, | 485 ColorTableEffect::ColorTableEffect(GrTexture* texture, GrTextureStripAtlas* atla
s, int row, |
485 unsigned flags) | 486 unsigned flags) |
486 : fTextureAccess(texture) | 487 : fTextureAccess(texture) |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
594 sk_sp<SkColorFilter> SkTableColorFilter::MakeARGB(const uint8_t tableA[256], | 595 sk_sp<SkColorFilter> SkTableColorFilter::MakeARGB(const uint8_t tableA[256], |
595 const uint8_t tableR[256], | 596 const uint8_t tableR[256], |
596 const uint8_t tableG[256], | 597 const uint8_t tableG[256], |
597 const uint8_t tableB[256]) { | 598 const uint8_t tableB[256]) { |
598 return sk_make_sp<SkTable_ColorFilter>(tableA, tableR, tableG, tableB); | 599 return sk_make_sp<SkTable_ColorFilter>(tableA, tableR, tableG, tableB); |
599 } | 600 } |
600 | 601 |
601 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkTableColorFilter) | 602 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkTableColorFilter) |
602 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkTable_ColorFilter) | 603 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkTable_ColorFilter) |
603 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END | 604 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END |
OLD | NEW |