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

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

Issue 1790303002: Avoid unneeded ref churn in SkDraw::drawVertices (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: Created 4 years, 9 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1876 matching lines...) Expand 10 before | Expand all | Expand 10 after
1887 if (nullptr == shader) { 1887 if (nullptr == shader) {
1888 // if we have no shader, we ignore the texture coordinates 1888 // if we have no shader, we ignore the texture coordinates
1889 textures = nullptr; 1889 textures = nullptr;
1890 } else if (nullptr == textures) { 1890 } else if (nullptr == textures) {
1891 // if we don't have texture coordinates, ignore the shader 1891 // if we don't have texture coordinates, ignore the shader
1892 p.setShader(nullptr); 1892 p.setShader(nullptr);
1893 shader = nullptr; 1893 shader = nullptr;
1894 } 1894 }
1895 1895
1896 // setup the custom shader (if needed) 1896 // setup the custom shader (if needed)
1897 sk_sp<SkShader> composeShader;
1898 if (colors) { 1897 if (colors) {
1899 if (nullptr == textures) { 1898 if (nullptr == textures) {
1900 // just colors (no texture) 1899 // just colors (no texture)
1901 p.setShader(triShader); 1900 p.setShader(triShader);
1902 shader = p.getShader(); 1901 shader = p.getShader();
1903 } else { 1902 } else {
1904 // colors * texture 1903 // colors * texture
1905 SkASSERT(shader); 1904 SkASSERT(shader);
1906 bool releaseMode = false; 1905 bool releaseMode = false;
1907 if (nullptr == xmode) { 1906 if (nullptr == xmode) {
1908 xmode = SkXfermode::Create(SkXfermode::kModulate_Mode); 1907 xmode = SkXfermode::Create(SkXfermode::kModulate_Mode);
1909 releaseMode = true; 1908 releaseMode = true;
1910 } 1909 }
1911 composeShader = sk_make_sp<SkComposeShader>(triShader, sk_ref_sp(sha der), xmode); 1910 p.setShader(sk_make_sp<SkComposeShader>(triShader, sk_ref_sp(shader) , xmode));
1912 p.setShader(composeShader);
1913 if (releaseMode) { 1911 if (releaseMode) {
1914 xmode->unref(); 1912 xmode->unref();
1915 } 1913 }
1916 } 1914 }
1917 } 1915 }
1918 1916
1919 SkAutoBlitterChoose blitter(fDst, *fMatrix, p); 1917 SkAutoBlitterChoose blitter(fDst, *fMatrix, p);
1920 // Abort early if we failed to create a shader context. 1918 // Abort early if we failed to create a shader context.
1921 if (blitter->isNullBlitter()) { 1919 if (blitter->isNullBlitter()) {
1922 return; 1920 return;
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
2073 mask->fImage = SkMask::AllocImage(size); 2071 mask->fImage = SkMask::AllocImage(size);
2074 memset(mask->fImage, 0, mask->computeImageSize()); 2072 memset(mask->fImage, 0, mask->computeImageSize());
2075 } 2073 }
2076 2074
2077 if (SkMask::kJustComputeBounds_CreateMode != mode) { 2075 if (SkMask::kJustComputeBounds_CreateMode != mode) {
2078 draw_into_mask(*mask, devPath, style); 2076 draw_into_mask(*mask, devPath, style);
2079 } 2077 }
2080 2078
2081 return true; 2079 return true;
2082 } 2080 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698