Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(826)

Side by Side Diff: src/core/SkDraw.cpp

Issue 1832223002: switch xfermodes over to sk_sp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 14 matching lines...) Expand all
25 #include "SkShader.h" 25 #include "SkShader.h"
26 #include "SkSmallAllocator.h" 26 #include "SkSmallAllocator.h"
27 #include "SkString.h" 27 #include "SkString.h"
28 #include "SkStroke.h" 28 #include "SkStroke.h"
29 #include "SkStrokeRec.h" 29 #include "SkStrokeRec.h"
30 #include "SkTemplates.h" 30 #include "SkTemplates.h"
31 #include "SkTextMapStateProc.h" 31 #include "SkTextMapStateProc.h"
32 #include "SkTLazy.h" 32 #include "SkTLazy.h"
33 #include "SkUtils.h" 33 #include "SkUtils.h"
34 #include "SkVertState.h" 34 #include "SkVertState.h"
35 #include "SkXfermode.h"
35 36
36 #include "SkBitmapProcShader.h" 37 #include "SkBitmapProcShader.h"
37 #include "SkDrawProcs.h" 38 #include "SkDrawProcs.h"
38 #include "SkMatrixUtils.h" 39 #include "SkMatrixUtils.h"
39 40
40 //#define TRACE_BITMAP_DRAWS 41 //#define TRACE_BITMAP_DRAWS
41 42
42 // Helper function to fix code gen bug on ARM64. 43 // Helper function to fix code gen bug on ARM64.
43 // See SkFindAndPlaceGlyph.h for more details. 44 // See SkFindAndPlaceGlyph.h for more details.
44 void FixGCC49Arm64Bug(int v) { } 45 void FixGCC49Arm64Bug(int v) { }
(...skipping 1848 matching lines...) Expand 10 before | Expand all | Expand 10 after
1893 1894
1894 // setup the custom shader (if needed) 1895 // setup the custom shader (if needed)
1895 if (colors) { 1896 if (colors) {
1896 if (nullptr == textures) { 1897 if (nullptr == textures) {
1897 // just colors (no texture) 1898 // just colors (no texture)
1898 p.setShader(triShader); 1899 p.setShader(triShader);
1899 shader = p.getShader(); 1900 shader = p.getShader();
1900 } else { 1901 } else {
1901 // colors * texture 1902 // colors * texture
1902 SkASSERT(shader); 1903 SkASSERT(shader);
1903 bool releaseMode = false; 1904 sk_sp<SkXfermode> xfer = xmode ? sk_ref_sp(xmode)
1904 if (nullptr == xmode) { 1905 : SkXfermode::Make(SkXfermode::kModul ate_Mode);
1905 xmode = SkXfermode::Create(SkXfermode::kModulate_Mode); 1906 p.setShader(SkShader::MakeComposeShader(triShader, sk_ref_sp(shader) , std::move(xfer)));
1906 releaseMode = true;
1907 }
1908 p.setShader(sk_make_sp<SkComposeShader>(triShader, sk_ref_sp(shader) , xmode));
1909 if (releaseMode) {
1910 xmode->unref();
1911 }
1912 } 1907 }
1913 } 1908 }
1914 1909
1915 SkAutoBlitterChoose blitter(fDst, *fMatrix, p); 1910 SkAutoBlitterChoose blitter(fDst, *fMatrix, p);
1916 // Abort early if we failed to create a shader context. 1911 // Abort early if we failed to create a shader context.
1917 if (blitter->isNullBlitter()) { 1912 if (blitter->isNullBlitter()) {
1918 return; 1913 return;
1919 } 1914 }
1920 1915
1921 // setup our state and function pointer for iterating triangles 1916 // setup our state and function pointer for iterating triangles
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
2069 mask->fImage = SkMask::AllocImage(size); 2064 mask->fImage = SkMask::AllocImage(size);
2070 memset(mask->fImage, 0, mask->computeImageSize()); 2065 memset(mask->fImage, 0, mask->computeImageSize());
2071 } 2066 }
2072 2067
2073 if (SkMask::kJustComputeBounds_CreateMode != mode) { 2068 if (SkMask::kJustComputeBounds_CreateMode != mode) {
2074 draw_into_mask(*mask, devPath, style); 2069 draw_into_mask(*mask, devPath, style);
2075 } 2070 }
2076 2071
2077 return true; 2072 return true;
2078 } 2073 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698