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 696 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
707 | 707 |
708 this->INHERITED::toString(str); | 708 this->INHERITED::toString(str); |
709 | 709 |
710 str->append(")"); | 710 str->append(")"); |
711 } | 711 } |
712 #endif | 712 #endif |
713 | 713 |
714 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(Sk3DShader) | 714 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(Sk3DShader) |
715 | 715 |
716 protected: | 716 protected: |
| 717 #ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING |
717 Sk3DShader(SkReadBuffer& buffer) : INHERITED(buffer) { | 718 Sk3DShader(SkReadBuffer& buffer) : INHERITED(buffer) { |
718 fProxy = buffer.readShader(); | 719 fProxy = buffer.readShader(); |
719 // Leaving this here until we bump the picture version, though this | 720 // Leaving this here until we bump the picture version, though this |
720 // shader should never be recorded. | 721 // shader should never be recorded. |
721 buffer.readColor(); | 722 buffer.readColor(); |
722 } | 723 } |
| 724 #endif |
723 | 725 |
724 virtual void flatten(SkWriteBuffer& buffer) const SK_OVERRIDE { | 726 virtual void flatten(SkWriteBuffer& buffer) const SK_OVERRIDE { |
725 this->INHERITED::flatten(buffer); | |
726 buffer.writeFlattenable(fProxy); | 727 buffer.writeFlattenable(fProxy); |
727 // Leaving this here until we bump the picture version, though this | |
728 // shader should never be recorded. | |
729 buffer.writeColor(SkColor()); | |
730 } | 728 } |
731 | 729 |
732 private: | 730 private: |
733 SkShader* fProxy; | 731 SkShader* fProxy; |
734 | 732 |
735 typedef SkShader INHERITED; | 733 typedef SkShader INHERITED; |
736 }; | 734 }; |
737 | 735 |
| 736 SkFlattenable* Sk3DShader::CreateProc(SkReadBuffer& buffer) { |
| 737 SkAutoTUnref<SkShader> shader(buffer.readShader()); |
| 738 return SkNEW_ARGS(Sk3DShader, (shader)); |
| 739 } |
| 740 |
738 class Sk3DBlitter : public SkBlitter { | 741 class Sk3DBlitter : public SkBlitter { |
739 public: | 742 public: |
740 Sk3DBlitter(SkBlitter* proxy, Sk3DShader::Sk3DShaderContext* shaderContext) | 743 Sk3DBlitter(SkBlitter* proxy, Sk3DShader::Sk3DShaderContext* shaderContext) |
741 : fProxy(proxy) | 744 : fProxy(proxy) |
742 , f3DShaderContext(shaderContext) | 745 , f3DShaderContext(shaderContext) |
743 {} | 746 {} |
744 | 747 |
745 virtual void blitH(int x, int y, int width) { | 748 virtual void blitH(int x, int y, int width) { |
746 fProxy->blitH(x, y, width); | 749 fProxy->blitH(x, y, width); |
747 } | 750 } |
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1032 fShaderContext->~Context(); | 1035 fShaderContext->~Context(); |
1033 SkShader::Context* ctx = fShader->createContext(rec, (void*)fShaderContext); | 1036 SkShader::Context* ctx = fShader->createContext(rec, (void*)fShaderContext); |
1034 if (NULL == ctx) { | 1037 if (NULL == ctx) { |
1035 // Need a valid context in fShaderContext's storage, so we can later (or
our caller) call | 1038 // Need a valid context in fShaderContext's storage, so we can later (or
our caller) call |
1036 // the in-place destructor. | 1039 // the in-place destructor. |
1037 SkNEW_PLACEMENT_ARGS(fShaderContext, SkTransparentShaderContext, (*fShad
er, rec)); | 1040 SkNEW_PLACEMENT_ARGS(fShaderContext, SkTransparentShaderContext, (*fShad
er, rec)); |
1038 return false; | 1041 return false; |
1039 } | 1042 } |
1040 return true; | 1043 return true; |
1041 } | 1044 } |
OLD | NEW |