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 1882 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1893 dst[0] = verts[state.f0]; | 1893 dst[0] = verts[state.f0]; |
1894 dst[1] = verts[state.f1]; | 1894 dst[1] = verts[state.f1]; |
1895 dst[2] = verts[state.f2]; | 1895 dst[2] = verts[state.f2]; |
1896 return matrix->setPolyToPoly(src, dst, 3); | 1896 return matrix->setPolyToPoly(src, dst, 3); |
1897 } | 1897 } |
1898 | 1898 |
1899 class SkTriColorShader : public SkShader { | 1899 class SkTriColorShader : public SkShader { |
1900 public: | 1900 public: |
1901 SkTriColorShader() {} | 1901 SkTriColorShader() {} |
1902 | 1902 |
1903 size_t contextSize() const SK_OVERRIDE; | 1903 size_t contextSize() const override; |
1904 | 1904 |
1905 class TriColorShaderContext : public SkShader::Context { | 1905 class TriColorShaderContext : public SkShader::Context { |
1906 public: | 1906 public: |
1907 TriColorShaderContext(const SkTriColorShader& shader, const ContextRec&)
; | 1907 TriColorShaderContext(const SkTriColorShader& shader, const ContextRec&)
; |
1908 virtual ~TriColorShaderContext(); | 1908 virtual ~TriColorShaderContext(); |
1909 | 1909 |
1910 bool setup(const SkPoint pts[], const SkColor colors[], int, int, int); | 1910 bool setup(const SkPoint pts[], const SkColor colors[], int, int, int); |
1911 | 1911 |
1912 void shadeSpan(int x, int y, SkPMColor dstC[], int count) SK_OVERRIDE; | 1912 void shadeSpan(int x, int y, SkPMColor dstC[], int count) override; |
1913 | 1913 |
1914 private: | 1914 private: |
1915 SkMatrix fDstToUnit; | 1915 SkMatrix fDstToUnit; |
1916 SkPMColor fColors[3]; | 1916 SkPMColor fColors[3]; |
1917 | 1917 |
1918 typedef SkShader::Context INHERITED; | 1918 typedef SkShader::Context INHERITED; |
1919 }; | 1919 }; |
1920 | 1920 |
1921 SK_TO_STRING_OVERRIDE() | 1921 SK_TO_STRING_OVERRIDE() |
1922 | 1922 |
1923 // For serialization. This will never be called. | 1923 // For serialization. This will never be called. |
1924 Factory getFactory() const SK_OVERRIDE { sk_throw(); return NULL; } | 1924 Factory getFactory() const override { sk_throw(); return NULL; } |
1925 | 1925 |
1926 protected: | 1926 protected: |
1927 Context* onCreateContext(const ContextRec& rec, void* storage) const SK_OVER
RIDE { | 1927 Context* onCreateContext(const ContextRec& rec, void* storage) const overrid
e { |
1928 return SkNEW_PLACEMENT_ARGS(storage, TriColorShaderContext, (*this, rec)
); | 1928 return SkNEW_PLACEMENT_ARGS(storage, TriColorShaderContext, (*this, rec)
); |
1929 } | 1929 } |
1930 | 1930 |
1931 private: | 1931 private: |
1932 typedef SkShader INHERITED; | 1932 typedef SkShader INHERITED; |
1933 }; | 1933 }; |
1934 | 1934 |
1935 bool SkTriColorShader::TriColorShaderContext::setup(const SkPoint pts[], const S
kColor colors[], | 1935 bool SkTriColorShader::TriColorShaderContext::setup(const SkPoint pts[], const S
kColor colors[], |
1936 int index0, int index1, int
index2) { | 1936 int index0, int index1, int
index2) { |
1937 | 1937 |
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2269 mask->fImage = SkMask::AllocImage(size); | 2269 mask->fImage = SkMask::AllocImage(size); |
2270 memset(mask->fImage, 0, mask->computeImageSize()); | 2270 memset(mask->fImage, 0, mask->computeImageSize()); |
2271 } | 2271 } |
2272 | 2272 |
2273 if (SkMask::kJustComputeBounds_CreateMode != mode) { | 2273 if (SkMask::kJustComputeBounds_CreateMode != mode) { |
2274 draw_into_mask(*mask, devPath, style); | 2274 draw_into_mask(*mask, devPath, style); |
2275 } | 2275 } |
2276 | 2276 |
2277 return true; | 2277 return true; |
2278 } | 2278 } |
OLD | NEW |