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

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: 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 1850 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 bool releaseMode = false;
1904 if (nullptr == xmode) { 1905 if (nullptr == xmode) {
1905 xmode = SkXfermode::Create(SkXfermode::kModulate_Mode); 1906 xmode = SkXfermode::Make(SkXfermode::kModulate_Mode).release();
1906 releaseMode = true; 1907 releaseMode = true;
1907 } 1908 }
1908 p.setShader(sk_make_sp<SkComposeShader>(triShader, sk_ref_sp(shader) , xmode)); 1909 p.setShader(SkShader::MakeComposeShader(triShader, sk_ref_sp(shader) ,
1910 sk_ref_sp(xmode)));
1909 if (releaseMode) { 1911 if (releaseMode) {
1910 xmode->unref(); 1912 xmode->unref();
f(malita) 2016/03/28 18:44:59 Nit: looks a bit convoluted, plus we unnecessarily
reed1 2016/03/29 16:13:52 Good suggestion. Done.
1911 } 1913 }
1912 } 1914 }
1913 } 1915 }
1914 1916
1915 SkAutoBlitterChoose blitter(fDst, *fMatrix, p); 1917 SkAutoBlitterChoose blitter(fDst, *fMatrix, p);
1916 // Abort early if we failed to create a shader context. 1918 // Abort early if we failed to create a shader context.
1917 if (blitter->isNullBlitter()) { 1919 if (blitter->isNullBlitter()) {
1918 return; 1920 return;
1919 } 1921 }
1920 1922
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
2069 mask->fImage = SkMask::AllocImage(size); 2071 mask->fImage = SkMask::AllocImage(size);
2070 memset(mask->fImage, 0, mask->computeImageSize()); 2072 memset(mask->fImage, 0, mask->computeImageSize());
2071 } 2073 }
2072 2074
2073 if (SkMask::kJustComputeBounds_CreateMode != mode) { 2075 if (SkMask::kJustComputeBounds_CreateMode != mode) {
2074 draw_into_mask(*mask, devPath, style); 2076 draw_into_mask(*mask, devPath, style);
2075 } 2077 }
2076 2078
2077 return true; 2079 return true;
2078 } 2080 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698