| 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 "SkDraw.h" | 8 #include "SkDraw.h" |
| 9 #include "SkBlitter.h" | 9 #include "SkBlitter.h" |
| 10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
| (...skipping 1998 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2009 dst[0] = verts[state.f0]; | 2009 dst[0] = verts[state.f0]; |
| 2010 dst[1] = verts[state.f1]; | 2010 dst[1] = verts[state.f1]; |
| 2011 dst[2] = verts[state.f2]; | 2011 dst[2] = verts[state.f2]; |
| 2012 return matrix->setPolyToPoly(src, dst, 3); | 2012 return matrix->setPolyToPoly(src, dst, 3); |
| 2013 } | 2013 } |
| 2014 | 2014 |
| 2015 class SkTriColorShader : public SkShader { | 2015 class SkTriColorShader : public SkShader { |
| 2016 public: | 2016 public: |
| 2017 SkTriColorShader() {} | 2017 SkTriColorShader() {} |
| 2018 | 2018 |
| 2019 virtual size_t contextSize() const SK_OVERRIDE; | 2019 size_t contextSize() const SK_OVERRIDE; |
| 2020 | 2020 |
| 2021 class TriColorShaderContext : public SkShader::Context { | 2021 class TriColorShaderContext : public SkShader::Context { |
| 2022 public: | 2022 public: |
| 2023 TriColorShaderContext(const SkTriColorShader& shader, const ContextRec&)
; | 2023 TriColorShaderContext(const SkTriColorShader& shader, const ContextRec&)
; |
| 2024 virtual ~TriColorShaderContext(); | 2024 virtual ~TriColorShaderContext(); |
| 2025 | 2025 |
| 2026 bool setup(const SkPoint pts[], const SkColor colors[], int, int, int); | 2026 bool setup(const SkPoint pts[], const SkColor colors[], int, int, int); |
| 2027 | 2027 |
| 2028 virtual void shadeSpan(int x, int y, SkPMColor dstC[], int count) SK_OVE
RRIDE; | 2028 void shadeSpan(int x, int y, SkPMColor dstC[], int count) SK_OVERRIDE; |
| 2029 | 2029 |
| 2030 private: | 2030 private: |
| 2031 SkMatrix fDstToUnit; | 2031 SkMatrix fDstToUnit; |
| 2032 SkPMColor fColors[3]; | 2032 SkPMColor fColors[3]; |
| 2033 | 2033 |
| 2034 typedef SkShader::Context INHERITED; | 2034 typedef SkShader::Context INHERITED; |
| 2035 }; | 2035 }; |
| 2036 | 2036 |
| 2037 SK_TO_STRING_OVERRIDE() | 2037 SK_TO_STRING_OVERRIDE() |
| 2038 | 2038 |
| 2039 // For serialization. This will never be called. | 2039 // For serialization. This will never be called. |
| 2040 Factory getFactory() const SK_OVERRIDE { sk_throw(); return NULL; } | 2040 Factory getFactory() const SK_OVERRIDE { sk_throw(); return NULL; } |
| 2041 | 2041 |
| 2042 protected: | 2042 protected: |
| 2043 virtual Context* onCreateContext(const ContextRec& rec, void* storage) const
SK_OVERRIDE { | 2043 Context* onCreateContext(const ContextRec& rec, void* storage) const SK_OVER
RIDE { |
| 2044 return SkNEW_PLACEMENT_ARGS(storage, TriColorShaderContext, (*this, rec)
); | 2044 return SkNEW_PLACEMENT_ARGS(storage, TriColorShaderContext, (*this, rec)
); |
| 2045 } | 2045 } |
| 2046 | 2046 |
| 2047 private: | 2047 private: |
| 2048 typedef SkShader INHERITED; | 2048 typedef SkShader INHERITED; |
| 2049 }; | 2049 }; |
| 2050 | 2050 |
| 2051 bool SkTriColorShader::TriColorShaderContext::setup(const SkPoint pts[], const S
kColor colors[], | 2051 bool SkTriColorShader::TriColorShaderContext::setup(const SkPoint pts[], const S
kColor colors[], |
| 2052 int index0, int index1, int
index2) { | 2052 int index0, int index1, int
index2) { |
| 2053 | 2053 |
| (...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2391 mask->fImage = SkMask::AllocImage(size); | 2391 mask->fImage = SkMask::AllocImage(size); |
| 2392 memset(mask->fImage, 0, mask->computeImageSize()); | 2392 memset(mask->fImage, 0, mask->computeImageSize()); |
| 2393 } | 2393 } |
| 2394 | 2394 |
| 2395 if (SkMask::kJustComputeBounds_CreateMode != mode) { | 2395 if (SkMask::kJustComputeBounds_CreateMode != mode) { |
| 2396 draw_into_mask(*mask, devPath, style); | 2396 draw_into_mask(*mask, devPath, style); |
| 2397 } | 2397 } |
| 2398 | 2398 |
| 2399 return true; | 2399 return true; |
| 2400 } | 2400 } |
| OLD | NEW |