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 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 combine_tables(concatA, tableA, innerBM.getAddr8(0, 0)); | 324 combine_tables(concatA, tableA, innerBM.getAddr8(0, 0)); |
325 combine_tables(concatR, tableR, innerBM.getAddr8(0, 1)); | 325 combine_tables(concatR, tableR, innerBM.getAddr8(0, 1)); |
326 combine_tables(concatG, tableG, innerBM.getAddr8(0, 2)); | 326 combine_tables(concatG, tableG, innerBM.getAddr8(0, 2)); |
327 combine_tables(concatB, tableB, innerBM.getAddr8(0, 3)); | 327 combine_tables(concatB, tableB, innerBM.getAddr8(0, 3)); |
328 | 328 |
329 return SkTableColorFilter::CreateARGB(concatA, concatR, concatG, concatB); | 329 return SkTableColorFilter::CreateARGB(concatA, concatR, concatG, concatB); |
330 } | 330 } |
331 | 331 |
332 #if SK_SUPPORT_GPU | 332 #if SK_SUPPORT_GPU |
333 | 333 |
| 334 #include "GrContext.h" |
334 #include "GrFragmentProcessor.h" | 335 #include "GrFragmentProcessor.h" |
335 #include "GrInvariantOutput.h" | 336 #include "GrInvariantOutput.h" |
336 #include "SkGr.h" | 337 #include "SkGr.h" |
337 #include "effects/GrTextureStripAtlas.h" | 338 #include "effects/GrTextureStripAtlas.h" |
338 #include "glsl/GrGLSLFragmentProcessor.h" | 339 #include "glsl/GrGLSLFragmentProcessor.h" |
339 #include "glsl/GrGLSLFragmentShaderBuilder.h" | 340 #include "glsl/GrGLSLFragmentShaderBuilder.h" |
340 #include "glsl/GrGLSLProgramDataManager.h" | 341 #include "glsl/GrGLSLProgramDataManager.h" |
341 #include "glsl/GrGLSLUniformHandler.h" | 342 #include "glsl/GrGLSLUniformHandler.h" |
342 | 343 |
343 class ColorTableEffect : public GrFragmentProcessor { | 344 class ColorTableEffect : public GrFragmentProcessor { |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
459 | 460 |
460 /////////////////////////////////////////////////////////////////////////////// | 461 /////////////////////////////////////////////////////////////////////////////// |
461 const GrFragmentProcessor* ColorTableEffect::Create(GrContext* context, SkBitmap
bitmap, | 462 const GrFragmentProcessor* ColorTableEffect::Create(GrContext* context, SkBitmap
bitmap, |
462 unsigned flags) { | 463 unsigned flags) { |
463 | 464 |
464 GrTextureStripAtlas::Desc desc; | 465 GrTextureStripAtlas::Desc desc; |
465 desc.fWidth = bitmap.width(); | 466 desc.fWidth = bitmap.width(); |
466 desc.fHeight = 128; | 467 desc.fHeight = 128; |
467 desc.fRowHeight = bitmap.height(); | 468 desc.fRowHeight = bitmap.height(); |
468 desc.fContext = context; | 469 desc.fContext = context; |
469 desc.fConfig = SkImageInfo2GrPixelConfig(bitmap.info()); | 470 desc.fConfig = SkImageInfo2GrPixelConfig(bitmap.info(), *context->caps()); |
470 GrTextureStripAtlas* atlas = GrTextureStripAtlas::GetAtlas(desc); | 471 GrTextureStripAtlas* atlas = GrTextureStripAtlas::GetAtlas(desc); |
471 int row = atlas->lockRow(bitmap); | 472 int row = atlas->lockRow(bitmap); |
472 SkAutoTUnref<GrTexture> texture; | 473 SkAutoTUnref<GrTexture> texture; |
473 if (-1 == row) { | 474 if (-1 == row) { |
474 atlas = nullptr; | 475 atlas = nullptr; |
475 texture.reset(GrRefCachedBitmapTexture(context, bitmap, GrTextureParams:
:ClampNoFilter())); | 476 texture.reset(GrRefCachedBitmapTexture(context, bitmap, GrTextureParams:
:ClampNoFilter())); |
476 } else { | 477 } else { |
477 texture.reset(SkRef(atlas->getTexture())); | 478 texture.reset(SkRef(atlas->getTexture())); |
478 } | 479 } |
479 | 480 |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
593 SkColorFilter* SkTableColorFilter::CreateARGB(const uint8_t tableA[256], | 594 SkColorFilter* SkTableColorFilter::CreateARGB(const uint8_t tableA[256], |
594 const uint8_t tableR[256], | 595 const uint8_t tableR[256], |
595 const uint8_t tableG[256], | 596 const uint8_t tableG[256], |
596 const uint8_t tableB[256]) { | 597 const uint8_t tableB[256]) { |
597 return new SkTable_ColorFilter(tableA, tableR, tableG, tableB); | 598 return new SkTable_ColorFilter(tableA, tableR, tableG, tableB); |
598 } | 599 } |
599 | 600 |
600 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkTableColorFilter) | 601 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkTableColorFilter) |
601 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkTable_ColorFilter) | 602 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkTable_ColorFilter) |
602 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END | 603 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END |
OLD | NEW |