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 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
468 desc.fWidth = bitmap.width(); | 468 desc.fWidth = bitmap.width(); |
469 desc.fHeight = 128; | 469 desc.fHeight = 128; |
470 desc.fRowHeight = bitmap.height(); | 470 desc.fRowHeight = bitmap.height(); |
471 desc.fContext = context; | 471 desc.fContext = context; |
472 desc.fConfig = SkImageInfo2GrPixelConfig(bitmap.info()); | 472 desc.fConfig = SkImageInfo2GrPixelConfig(bitmap.info()); |
473 GrTextureStripAtlas* atlas = GrTextureStripAtlas::GetAtlas(desc); | 473 GrTextureStripAtlas* atlas = GrTextureStripAtlas::GetAtlas(desc); |
474 int row = atlas->lockRow(bitmap); | 474 int row = atlas->lockRow(bitmap); |
475 SkAutoTUnref<GrTexture> texture; | 475 SkAutoTUnref<GrTexture> texture; |
476 if (-1 == row) { | 476 if (-1 == row) { |
477 atlas = nullptr; | 477 atlas = nullptr; |
478 // Passing params=nullptr because this effect does no tiling or filterin
g. | 478 texture.reset(GrRefCachedBitmapTexture(context, bitmap, GrTextureParams:
:ClampNoFilter())); |
479 texture.reset(GrRefCachedBitmapTexture(context, bitmap, nullptr)); | |
480 } else { | 479 } else { |
481 texture.reset(SkRef(atlas->getTexture())); | 480 texture.reset(SkRef(atlas->getTexture())); |
482 } | 481 } |
483 | 482 |
484 return new ColorTableEffect(texture, atlas, row, flags); | 483 return new ColorTableEffect(texture, atlas, row, flags); |
485 } | 484 } |
486 | 485 |
487 ColorTableEffect::ColorTableEffect(GrTexture* texture, GrTextureStripAtlas* atla
s, int row, | 486 ColorTableEffect::ColorTableEffect(GrTexture* texture, GrTextureStripAtlas* atla
s, int row, |
488 unsigned flags) | 487 unsigned flags) |
489 : fTextureAccess(texture, "a") | 488 : fTextureAccess(texture, "a") |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
597 SkColorFilter* SkTableColorFilter::CreateARGB(const uint8_t tableA[256], | 596 SkColorFilter* SkTableColorFilter::CreateARGB(const uint8_t tableA[256], |
598 const uint8_t tableR[256], | 597 const uint8_t tableR[256], |
599 const uint8_t tableG[256], | 598 const uint8_t tableG[256], |
600 const uint8_t tableB[256]) { | 599 const uint8_t tableB[256]) { |
601 return new SkTable_ColorFilter(tableA, tableR, tableG, tableB); | 600 return new SkTable_ColorFilter(tableA, tableR, tableG, tableB); |
602 } | 601 } |
603 | 602 |
604 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkTableColorFilter) | 603 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkTableColorFilter) |
605 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkTable_ColorFilter) | 604 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkTable_ColorFilter) |
606 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END | 605 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END |
OLD | NEW |