| 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 #define __STDC_LIMIT_MACROS | 7 #define __STDC_LIMIT_MACROS |
| 8 | 8 |
| 9 #include "SkDraw.h" | 9 #include "SkDraw.h" |
| 10 #include "SkBlitter.h" | 10 #include "SkBlitter.h" |
| (...skipping 1901 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1912 typedef SkShader::Context INHERITED; | 1912 typedef SkShader::Context INHERITED; |
| 1913 }; | 1913 }; |
| 1914 | 1914 |
| 1915 SK_TO_STRING_OVERRIDE() | 1915 SK_TO_STRING_OVERRIDE() |
| 1916 | 1916 |
| 1917 // For serialization. This will never be called. | 1917 // For serialization. This will never be called. |
| 1918 Factory getFactory() const override { sk_throw(); return NULL; } | 1918 Factory getFactory() const override { sk_throw(); return NULL; } |
| 1919 | 1919 |
| 1920 protected: | 1920 protected: |
| 1921 Context* onCreateContext(const ContextRec& rec, void* storage) const overrid
e { | 1921 Context* onCreateContext(const ContextRec& rec, void* storage) const overrid
e { |
| 1922 return SkNEW_PLACEMENT_ARGS(storage, TriColorShaderContext, (*this, rec)
); | 1922 return new (storage) TriColorShaderContext(*this, rec); |
| 1923 } | 1923 } |
| 1924 | 1924 |
| 1925 private: | 1925 private: |
| 1926 typedef SkShader INHERITED; | 1926 typedef SkShader INHERITED; |
| 1927 }; | 1927 }; |
| 1928 | 1928 |
| 1929 bool SkTriColorShader::TriColorShaderContext::setup(const SkPoint pts[], const S
kColor colors[], | 1929 bool SkTriColorShader::TriColorShaderContext::setup(const SkPoint pts[], const S
kColor colors[], |
| 1930 int index0, int index1, int
index2) { | 1930 int index0, int index1, int
index2) { |
| 1931 | 1931 |
| 1932 fColors[0] = SkPreMultiplyColor(colors[index0]); | 1932 fColors[0] = SkPreMultiplyColor(colors[index0]); |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2069 // just colors (no texture) | 2069 // just colors (no texture) |
| 2070 shader = p.setShader(&triShader); | 2070 shader = p.setShader(&triShader); |
| 2071 } else { | 2071 } else { |
| 2072 // colors * texture | 2072 // colors * texture |
| 2073 SkASSERT(shader); | 2073 SkASSERT(shader); |
| 2074 bool releaseMode = false; | 2074 bool releaseMode = false; |
| 2075 if (NULL == xmode) { | 2075 if (NULL == xmode) { |
| 2076 xmode = SkXfermode::Create(SkXfermode::kModulate_Mode); | 2076 xmode = SkXfermode::Create(SkXfermode::kModulate_Mode); |
| 2077 releaseMode = true; | 2077 releaseMode = true; |
| 2078 } | 2078 } |
| 2079 composeShader.reset(SkNEW_ARGS(SkComposeShader, (&triShader, shader,
xmode))); | 2079 composeShader.reset(new SkComposeShader(&triShader, shader, xmode)); |
| 2080 p.setShader(composeShader); | 2080 p.setShader(composeShader); |
| 2081 if (releaseMode) { | 2081 if (releaseMode) { |
| 2082 xmode->unref(); | 2082 xmode->unref(); |
| 2083 } | 2083 } |
| 2084 } | 2084 } |
| 2085 } | 2085 } |
| 2086 | 2086 |
| 2087 SkAutoBlitterChoose blitter(fDst, *fMatrix, p); | 2087 SkAutoBlitterChoose blitter(fDst, *fMatrix, p); |
| 2088 // Abort early if we failed to create a shader context. | 2088 // Abort early if we failed to create a shader context. |
| 2089 if (blitter->isNullBlitter()) { | 2089 if (blitter->isNullBlitter()) { |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2260 mask->fImage = SkMask::AllocImage(size); | 2260 mask->fImage = SkMask::AllocImage(size); |
| 2261 memset(mask->fImage, 0, mask->computeImageSize()); | 2261 memset(mask->fImage, 0, mask->computeImageSize()); |
| 2262 } | 2262 } |
| 2263 | 2263 |
| 2264 if (SkMask::kJustComputeBounds_CreateMode != mode) { | 2264 if (SkMask::kJustComputeBounds_CreateMode != mode) { |
| 2265 draw_into_mask(*mask, devPath, style); | 2265 draw_into_mask(*mask, devPath, style); |
| 2266 } | 2266 } |
| 2267 | 2267 |
| 2268 return true; | 2268 return true; |
| 2269 } | 2269 } |
| OLD | NEW |