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 574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
585 class Sk3DShader : public SkShader { | 585 class Sk3DShader : public SkShader { |
586 public: | 586 public: |
587 Sk3DShader(SkShader* proxy) : fProxy(proxy) { | 587 Sk3DShader(SkShader* proxy) : fProxy(proxy) { |
588 SkSafeRef(proxy); | 588 SkSafeRef(proxy); |
589 } | 589 } |
590 | 590 |
591 virtual ~Sk3DShader() { | 591 virtual ~Sk3DShader() { |
592 SkSafeUnref(fProxy); | 592 SkSafeUnref(fProxy); |
593 } | 593 } |
594 | 594 |
595 size_t contextSize(const ContextRec& rec) const override { | 595 size_t onContextSize(const ContextRec& rec) const override { |
596 size_t size = sizeof(Sk3DShaderContext); | 596 size_t size = sizeof(Sk3DShaderContext); |
597 if (fProxy) { | 597 if (fProxy) { |
598 size += fProxy->contextSize(rec); | 598 size += fProxy->contextSize(rec); |
599 } | 599 } |
600 return size; | 600 return size; |
601 } | 601 } |
602 | 602 |
603 Context* onCreateContext(const ContextRec& rec, void* storage) const overrid
e { | 603 Context* onCreateContext(const ContextRec& rec, void* storage) const overrid
e { |
604 SkShader::Context* proxyContext = nullptr; | 604 SkShader::Context* proxyContext = nullptr; |
605 if (fProxy) { | 605 if (fProxy) { |
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1009 fShaderContext->~Context(); | 1009 fShaderContext->~Context(); |
1010 SkShader::Context* ctx = fShader->createContext(rec, (void*)fShaderContext); | 1010 SkShader::Context* ctx = fShader->createContext(rec, (void*)fShaderContext); |
1011 if (nullptr == ctx) { | 1011 if (nullptr == ctx) { |
1012 // Need a valid context in fShaderContext's storage, so we can later (or
our caller) call | 1012 // Need a valid context in fShaderContext's storage, so we can later (or
our caller) call |
1013 // the in-place destructor. | 1013 // the in-place destructor. |
1014 new (fShaderContext) SkZeroShaderContext(*fShader, rec); | 1014 new (fShaderContext) SkZeroShaderContext(*fShader, rec); |
1015 return false; | 1015 return false; |
1016 } | 1016 } |
1017 return true; | 1017 return true; |
1018 } | 1018 } |
OLD | NEW |