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

Side by Side Diff: src/gpu/GrAARectRenderer.cpp

Issue 672473002: Widen the set of nested rects that can be drawn natively on the GPU (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 2 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 | src/gpu/GrContext.cpp » ('j') | 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 2012 Google Inc. 2 * Copyright 2012 Google Inc.
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 7
8 #include "GrAARectRenderer.h" 8 #include "GrAARectRenderer.h"
9 #include "GrGpu.h" 9 #include "GrGpu.h"
10 #include "gl/builders/GrGLProgramBuilder.h" 10 #include "gl/builders/GrGLProgramBuilder.h"
(...skipping 840 matching lines...) Expand 10 before | Expand all | Expand 10 after
851 // We create vertices for four nested rectangles. There are two ramps from 0 to full 851 // We create vertices for four nested rectangles. There are two ramps from 0 to full
852 // coverage, one on the exterior of the stroke and the other on the interior . 852 // coverage, one on the exterior of the stroke and the other on the interior .
853 // The following pointers refer to the four rects, from outermost to innermo st. 853 // The following pointers refer to the four rects, from outermost to innermo st.
854 SkPoint* fan0Pos = reinterpret_cast<SkPoint*>(verts); 854 SkPoint* fan0Pos = reinterpret_cast<SkPoint*>(verts);
855 SkPoint* fan1Pos = reinterpret_cast<SkPoint*>(verts + outerVertexNum * vstri de); 855 SkPoint* fan1Pos = reinterpret_cast<SkPoint*>(verts + outerVertexNum * vstri de);
856 SkPoint* fan2Pos = reinterpret_cast<SkPoint*>(verts + 2 * outerVertexNum * v stride); 856 SkPoint* fan2Pos = reinterpret_cast<SkPoint*>(verts + 2 * outerVertexNum * v stride);
857 SkPoint* fan3Pos = reinterpret_cast<SkPoint*>(verts + (2 * outerVertexNum + innerVertexNum) * vstride); 857 SkPoint* fan3Pos = reinterpret_cast<SkPoint*>(verts + (2 * outerVertexNum + innerVertexNum) * vstride);
858 858
859 #ifndef SK_IGNORE_THIN_STROKED_RECT_FIX 859 #ifndef SK_IGNORE_THIN_STROKED_RECT_FIX
860 // TODO: this only really works if the X & Y margins are the same all around 860 // TODO: this only really works if the X & Y margins are the same all around
861 // the rect 861 // the rect (or if they are all >= 1.0).
862 SkScalar inset = SkMinScalar(SK_Scalar1, devOutside.fRight - devInside.fRigh t); 862 SkScalar inset = SkMinScalar(SK_Scalar1, devOutside.fRight - devInside.fRigh t);
863 inset = SkMinScalar(inset, devInside.fLeft - devOutside.fLeft); 863 inset = SkMinScalar(inset, devInside.fLeft - devOutside.fLeft);
864 inset = SkMinScalar(inset, devInside.fTop - devOutside.fTop); 864 inset = SkMinScalar(inset, devInside.fTop - devOutside.fTop);
865 if (miterStroke) { 865 if (miterStroke) {
866 inset = SK_ScalarHalf * SkMinScalar(inset, devOutside.fBottom - devInsid e.fBottom); 866 inset = SK_ScalarHalf * SkMinScalar(inset, devOutside.fBottom - devInsid e.fBottom);
867 } else { 867 } else {
868 inset = SK_ScalarHalf * SkMinScalar(inset, devOutsideAssist.fBottom - de vInside.fBottom); 868 inset = SK_ScalarHalf * SkMinScalar(inset, devOutsideAssist.fBottom - de vInside.fBottom);
869 } 869 }
870 SkASSERT(inset >= 0); 870 SkASSERT(inset >= 0);
871 #else 871 #else
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
961 // can't call mapRect for devInside since it calls sort 961 // can't call mapRect for devInside since it calls sort
962 combinedMatrix.mapPoints((SkPoint*)&devInside, (const SkPoint*)&rects[1], 2) ; 962 combinedMatrix.mapPoints((SkPoint*)&devInside, (const SkPoint*)&rects[1], 2) ;
963 963
964 if (devInside.isEmpty()) { 964 if (devInside.isEmpty()) {
965 this->fillAARect(gpu, target, devOutside, SkMatrix::I(), devOutside); 965 this->fillAARect(gpu, target, devOutside, SkMatrix::I(), devOutside);
966 return; 966 return;
967 } 967 }
968 968
969 this->geometryStrokeAARect(gpu, target, devOutside, devOutsideAssist, devIns ide, true); 969 this->geometryStrokeAARect(gpu, target, devOutside, devOutsideAssist, devIns ide, true);
970 } 970 }
OLDNEW
« no previous file with comments | « no previous file | src/gpu/GrContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698