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

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

Issue 783763002: Initial CL to move color / coverage off of drawstate (Closed) Base URL: https://skia.googlesource.com/skia.git@no-static-gp
Patch Set: bug fix Created 6 years 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 | « src/gpu/GrSoftwarePathRenderer.h ('k') | src/gpu/GrStencilAndCoverPathRenderer.h » ('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 /* 2 /*
3 * Copyright 2012 Google Inc. 3 * Copyright 2012 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 #include "GrSoftwarePathRenderer.h" 9 #include "GrSoftwarePathRenderer.h"
10 #include "GrContext.h" 10 #include "GrContext.h"
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 } else { 71 } else {
72 *devPathBounds = SkIRect::EmptyIRect(); 72 *devPathBounds = SkIRect::EmptyIRect();
73 return false; 73 return false;
74 } 74 }
75 return true; 75 return true;
76 } 76 }
77 77
78 //////////////////////////////////////////////////////////////////////////////// 78 ////////////////////////////////////////////////////////////////////////////////
79 void draw_around_inv_path(GrDrawTarget* target, 79 void draw_around_inv_path(GrDrawTarget* target,
80 GrDrawState* drawState, 80 GrDrawState* drawState,
81 GrColor color,
81 const SkIRect& devClipBounds, 82 const SkIRect& devClipBounds,
82 const SkIRect& devPathBounds) { 83 const SkIRect& devPathBounds) {
83 GrDrawState::AutoViewMatrixRestore avmr; 84 GrDrawState::AutoViewMatrixRestore avmr;
84 if (!avmr.setIdentity(drawState)) { 85 if (!avmr.setIdentity(drawState)) {
85 return; 86 return;
86 } 87 }
87 SkRect rect; 88 SkRect rect;
88 if (devClipBounds.fTop < devPathBounds.fTop) { 89 if (devClipBounds.fTop < devPathBounds.fTop) {
89 rect.iset(devClipBounds.fLeft, devClipBounds.fTop, 90 rect.iset(devClipBounds.fLeft, devClipBounds.fTop,
90 devClipBounds.fRight, devPathBounds.fTop); 91 devClipBounds.fRight, devPathBounds.fTop);
91 target->drawSimpleRect(drawState, rect); 92 target->drawSimpleRect(drawState, color, rect);
92 } 93 }
93 if (devClipBounds.fLeft < devPathBounds.fLeft) { 94 if (devClipBounds.fLeft < devPathBounds.fLeft) {
94 rect.iset(devClipBounds.fLeft, devPathBounds.fTop, 95 rect.iset(devClipBounds.fLeft, devPathBounds.fTop,
95 devPathBounds.fLeft, devPathBounds.fBottom); 96 devPathBounds.fLeft, devPathBounds.fBottom);
96 target->drawSimpleRect(drawState, rect); 97 target->drawSimpleRect(drawState, color, rect);
97 } 98 }
98 if (devClipBounds.fRight > devPathBounds.fRight) { 99 if (devClipBounds.fRight > devPathBounds.fRight) {
99 rect.iset(devPathBounds.fRight, devPathBounds.fTop, 100 rect.iset(devPathBounds.fRight, devPathBounds.fTop,
100 devClipBounds.fRight, devPathBounds.fBottom); 101 devClipBounds.fRight, devPathBounds.fBottom);
101 target->drawSimpleRect(drawState, rect); 102 target->drawSimpleRect(drawState, color, rect);
102 } 103 }
103 if (devClipBounds.fBottom > devPathBounds.fBottom) { 104 if (devClipBounds.fBottom > devPathBounds.fBottom) {
104 rect.iset(devClipBounds.fLeft, devPathBounds.fBottom, 105 rect.iset(devClipBounds.fLeft, devPathBounds.fBottom,
105 devClipBounds.fRight, devClipBounds.fBottom); 106 devClipBounds.fRight, devClipBounds.fBottom);
106 target->drawSimpleRect(drawState, rect); 107 target->drawSimpleRect(drawState, color, rect);
107 } 108 }
108 } 109 }
109 110
110 } 111 }
111 112
112 //////////////////////////////////////////////////////////////////////////////// 113 ////////////////////////////////////////////////////////////////////////////////
113 // return true on success; false on failure 114 // return true on success; false on failure
114 bool GrSoftwarePathRenderer::onDrawPath(GrDrawTarget* target, 115 bool GrSoftwarePathRenderer::onDrawPath(GrDrawTarget* target,
115 GrDrawState* drawState, 116 GrDrawState* drawState,
117 GrColor color,
116 const SkPath& path, 118 const SkPath& path,
117 const SkStrokeRec& stroke, 119 const SkStrokeRec& stroke,
118 bool antiAlias) { 120 bool antiAlias) {
119 121
120 if (NULL == fContext) { 122 if (NULL == fContext) {
121 return false; 123 return false;
122 } 124 }
123 125
124 SkMatrix vm = drawState->getViewMatrix(); 126 SkMatrix vm = drawState->getViewMatrix();
125 127
126 SkIRect devPathBounds, devClipBounds; 128 SkIRect devPathBounds, devClipBounds;
127 if (!get_path_and_clip_bounds(target, drawState, path, vm, 129 if (!get_path_and_clip_bounds(target, drawState, path, vm,
128 &devPathBounds, &devClipBounds)) { 130 &devPathBounds, &devClipBounds)) {
129 if (path.isInverseFillType()) { 131 if (path.isInverseFillType()) {
130 draw_around_inv_path(target, drawState, devClipBounds, devPathBounds ); 132 draw_around_inv_path(target, drawState, color, devClipBounds, devPat hBounds);
131 } 133 }
132 return true; 134 return true;
133 } 135 }
134 136
135 SkAutoTUnref<GrTexture> texture( 137 SkAutoTUnref<GrTexture> texture(
136 GrSWMaskHelper::DrawPathMaskToTexture(fContext, path, stroke, 138 GrSWMaskHelper::DrawPathMaskToTexture(fContext, path, stroke,
137 devPathBounds, 139 devPathBounds,
138 antiAlias, &vm)); 140 antiAlias, &vm));
139 if (NULL == texture) { 141 if (NULL == texture) {
140 return false; 142 return false;
141 } 143 }
142 144
143 GrDrawState copy = *drawState; 145 GrDrawState copy = *drawState;
144 GrSWMaskHelper::DrawToTargetWithPathMask(texture, target, &copy, devPathBoun ds); 146 GrSWMaskHelper::DrawToTargetWithPathMask(texture, target, &copy, color, devP athBounds);
145 147
146 if (path.isInverseFillType()) { 148 if (path.isInverseFillType()) {
147 draw_around_inv_path(target, drawState, devClipBounds, devPathBounds); 149 draw_around_inv_path(target, drawState, color, devClipBounds, devPathBou nds);
148 } 150 }
149 151
150 return true; 152 return true;
151 } 153 }
OLDNEW
« no previous file with comments | « src/gpu/GrSoftwarePathRenderer.h ('k') | src/gpu/GrStencilAndCoverPathRenderer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698