OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2006 The Android Open Source Project | 2 * Copyright 2006 The Android Open Source Project |
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 "SkBlitter.h" | 8 #include "SkBlitter.h" |
9 #include "SkAntiRun.h" | 9 #include "SkAntiRun.h" |
10 #include "SkColor.h" | 10 #include "SkColor.h" |
(...skipping 712 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
723 void flatten(SkWriteBuffer& buffer) const override { | 723 void flatten(SkWriteBuffer& buffer) const override { |
724 buffer.writeFlattenable(fProxy.get()); | 724 buffer.writeFlattenable(fProxy.get()); |
725 } | 725 } |
726 | 726 |
727 private: | 727 private: |
728 sk_sp<SkShader> fProxy; | 728 sk_sp<SkShader> fProxy; |
729 | 729 |
730 typedef SkShader INHERITED; | 730 typedef SkShader INHERITED; |
731 }; | 731 }; |
732 | 732 |
733 SkFlattenable* Sk3DShader::CreateProc(SkReadBuffer& buffer) { | 733 sk_sp<SkFlattenable> Sk3DShader::CreateProc(SkReadBuffer& buffer) { |
734 return new Sk3DShader(buffer.readShader()); | 734 return sk_make_sp<Sk3DShader>(buffer.readShader()); |
735 } | 735 } |
736 | 736 |
737 class Sk3DBlitter : public SkBlitter { | 737 class Sk3DBlitter : public SkBlitter { |
738 public: | 738 public: |
739 Sk3DBlitter(SkBlitter* proxy, SkShader::Context* shaderContext) | 739 Sk3DBlitter(SkBlitter* proxy, SkShader::Context* shaderContext) |
740 : fProxy(proxy) | 740 : fProxy(proxy) |
741 , fShaderContext(shaderContext) | 741 , fShaderContext(shaderContext) |
742 {} | 742 {} |
743 | 743 |
744 void blitH(int x, int y, int width) override { | 744 void blitH(int x, int y, int width) override { |
745 fProxy->blitH(x, y, width); | 745 fProxy->blitH(x, y, width); |
746 } | 746 } |
747 | 747 |
748 virtual void blitAntiH(int x, int y, const SkAlpha antialias[], | 748 void blitAntiH(int x, int y, const SkAlpha antialias[], const int16_t runs[]
) override { |
749 const int16_t runs[]) override { | |
750 fProxy->blitAntiH(x, y, antialias, runs); | 749 fProxy->blitAntiH(x, y, antialias, runs); |
751 } | 750 } |
752 | 751 |
753 void blitV(int x, int y, int height, SkAlpha alpha) override { | 752 void blitV(int x, int y, int height, SkAlpha alpha) override { |
754 fProxy->blitV(x, y, height, alpha); | 753 fProxy->blitV(x, y, height, alpha); |
755 } | 754 } |
756 | 755 |
757 void blitRect(int x, int y, int width, int height) override { | 756 void blitRect(int x, int y, int width, int height) override { |
758 fProxy->blitRect(x, y, width, height); | 757 fProxy->blitRect(x, y, width, height); |
759 } | 758 } |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1004 fShaderContext->~Context(); | 1003 fShaderContext->~Context(); |
1005 SkShader::Context* ctx = fShader->createContext(rec, (void*)fShaderContext); | 1004 SkShader::Context* ctx = fShader->createContext(rec, (void*)fShaderContext); |
1006 if (nullptr == ctx) { | 1005 if (nullptr == ctx) { |
1007 // Need a valid context in fShaderContext's storage, so we can later (or
our caller) call | 1006 // Need a valid context in fShaderContext's storage, so we can later (or
our caller) call |
1008 // the in-place destructor. | 1007 // the in-place destructor. |
1009 new (fShaderContext) SkZeroShaderContext(*fShader, rec); | 1008 new (fShaderContext) SkZeroShaderContext(*fShader, rec); |
1010 return false; | 1009 return false; |
1011 } | 1010 } |
1012 return true; | 1011 return true; |
1013 } | 1012 } |
OLD | NEW |