| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 "SkDither.h" | 8 #include "SkDither.h" |
| 9 #include "SkPerlinNoiseShader2.h" | 9 #include "SkPerlinNoiseShader2.h" |
| 10 #include "SkColorFilter.h" | 10 #include "SkColorFilter.h" |
| (...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 596 void SkPerlinNoiseShader2::PerlinNoiseShaderContext::shadeSpan( | 596 void SkPerlinNoiseShader2::PerlinNoiseShaderContext::shadeSpan( |
| 597 int x, int y, SkPMColor result[], int count) { | 597 int x, int y, SkPMColor result[], int count) { |
| 598 SkPoint point = SkPoint::Make(SkIntToScalar(x), SkIntToScalar(y)); | 598 SkPoint point = SkPoint::Make(SkIntToScalar(x), SkIntToScalar(y)); |
| 599 StitchData stitchData; | 599 StitchData stitchData; |
| 600 for (int i = 0; i < count; ++i) { | 600 for (int i = 0; i < count; ++i) { |
| 601 result[i] = shade(point, stitchData); | 601 result[i] = shade(point, stitchData); |
| 602 point.fX += SK_Scalar1; | 602 point.fX += SK_Scalar1; |
| 603 } | 603 } |
| 604 } | 604 } |
| 605 | 605 |
| 606 void SkPerlinNoiseShader2::PerlinNoiseShaderContext::shadeSpan16( | |
| 607 int x, int y, uint16_t result[], int count) { | |
| 608 SkPoint point = SkPoint::Make(SkIntToScalar(x), SkIntToScalar(y)); | |
| 609 StitchData stitchData; | |
| 610 DITHER_565_SCAN(y); | |
| 611 for (int i = 0; i < count; ++i) { | |
| 612 unsigned dither = DITHER_VALUE(x); | |
| 613 result[i] = SkDitherRGB32To565(shade(point, stitchData), dither); | |
| 614 DITHER_INC_X(x); | |
| 615 point.fX += SK_Scalar1; | |
| 616 } | |
| 617 } | |
| 618 | |
| 619 ///////////////////////////////////////////////////////////////////// | 606 ///////////////////////////////////////////////////////////////////// |
| 620 | 607 |
| 621 #if SK_SUPPORT_GPU | 608 #if SK_SUPPORT_GPU |
| 622 | 609 |
| 623 class GrGLPerlinNoise2 : public GrGLSLFragmentProcessor { | 610 class GrGLPerlinNoise2 : public GrGLSLFragmentProcessor { |
| 624 public: | 611 public: |
| 625 GrGLPerlinNoise2(const GrProcessor&); | 612 GrGLPerlinNoise2(const GrProcessor&); |
| 626 virtual ~GrGLPerlinNoise2() {} | 613 virtual ~GrGLPerlinNoise2() {} |
| 627 | 614 |
| 628 virtual void emitCode(EmitArgs&) override; | 615 virtual void emitCode(EmitArgs&) override; |
| (...skipping 800 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1429 str->append(" seed: "); | 1416 str->append(" seed: "); |
| 1430 str->appendScalar(fSeed); | 1417 str->appendScalar(fSeed); |
| 1431 str->append(" stitch tiles: "); | 1418 str->append(" stitch tiles: "); |
| 1432 str->append(fStitchTiles ? "true " : "false "); | 1419 str->append(fStitchTiles ? "true " : "false "); |
| 1433 | 1420 |
| 1434 this->INHERITED::toString(str); | 1421 this->INHERITED::toString(str); |
| 1435 | 1422 |
| 1436 str->append(")"); | 1423 str->append(")"); |
| 1437 } | 1424 } |
| 1438 #endif | 1425 #endif |
| OLD | NEW |