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

Side by Side Diff: src/gpu/gl/GrGLPath.cpp

Issue 846303002: Make uncached textures uncached from the get go. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Add comment Created 5 years, 11 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 | « src/gpu/gl/GrGLIndexBuffer.cpp ('k') | src/gpu/gl/GrGLRenderTarget.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 "GrGLPath.h" 9 #include "GrGLPath.h"
10 #include "GrGLPathRendering.h" 10 #include "GrGLPathRendering.h"
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 81
82 inline void points_to_coords(const SkPoint points[], size_t first_point, size_t amount, 82 inline void points_to_coords(const SkPoint points[], size_t first_point, size_t amount,
83 GrGLfloat coords[]) { 83 GrGLfloat coords[]) {
84 for (size_t i = 0; i < amount; ++i) { 84 for (size_t i = 0; i < amount; ++i) {
85 coords[i * 2] = SkScalarToFloat(points[first_point + i].fX); 85 coords[i * 2] = SkScalarToFloat(points[first_point + i].fX);
86 coords[i * 2 + 1] = SkScalarToFloat(points[first_point + i].fY); 86 coords[i * 2 + 1] = SkScalarToFloat(points[first_point + i].fY);
87 } 87 }
88 } 88 }
89 } 89 }
90 90
91 static const bool kIsWrapped = false; // The constructor creates the GL path obj ect.
92
93 void GrGLPath::InitPathObject(GrGLGpu* gpu, 91 void GrGLPath::InitPathObject(GrGLGpu* gpu,
94 GrGLuint pathID, 92 GrGLuint pathID,
95 const SkPath& skPath, 93 const SkPath& skPath,
96 const SkStrokeRec& stroke) { 94 const SkStrokeRec& stroke) {
97 if (!skPath.isEmpty()) { 95 if (!skPath.isEmpty()) {
98 int verbCnt = skPath.countVerbs(); 96 int verbCnt = skPath.countVerbs();
99 int pointCnt = skPath.countPoints(); 97 int pointCnt = skPath.countPoints();
100 int minCoordCnt = pointCnt * 2; 98 int minCoordCnt = pointCnt * 2;
101 99
102 SkSTArray<16, GrGLubyte, true> pathCommands(verbCnt); 100 SkSTArray<16, GrGLubyte, true> pathCommands(verbCnt);
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 GR_GL_CALL(gpu->glInterface(), 175 GR_GL_CALL(gpu->glInterface(),
178 PathParameterf(pathID, GR_GL_PATH_MITER_LIMIT, SkScalarToFloat(strok e.getMiter()))); 176 PathParameterf(pathID, GR_GL_PATH_MITER_LIMIT, SkScalarToFloat(strok e.getMiter())));
179 GrGLenum join = join_to_gl_join(stroke.getJoin()); 177 GrGLenum join = join_to_gl_join(stroke.getJoin());
180 GR_GL_CALL(gpu->glInterface(), PathParameteri(pathID, GR_GL_PATH_JOIN_ST YLE, join)); 178 GR_GL_CALL(gpu->glInterface(), PathParameteri(pathID, GR_GL_PATH_JOIN_ST YLE, join));
181 GrGLenum cap = cap_to_gl_cap(stroke.getCap()); 179 GrGLenum cap = cap_to_gl_cap(stroke.getCap());
182 GR_GL_CALL(gpu->glInterface(), PathParameteri(pathID, GR_GL_PATH_END_CAP S, cap)); 180 GR_GL_CALL(gpu->glInterface(), PathParameteri(pathID, GR_GL_PATH_END_CAP S, cap));
183 } 181 }
184 } 182 }
185 183
186 GrGLPath::GrGLPath(GrGLGpu* gpu, const SkPath& path, const SkStrokeRec& stroke) 184 GrGLPath::GrGLPath(GrGLGpu* gpu, const SkPath& path, const SkStrokeRec& stroke)
187 : INHERITED(gpu, kIsWrapped, path, stroke), 185 : INHERITED(gpu, path, stroke),
188 fPathID(gpu->glPathRendering()->genPaths(1)) { 186 fPathID(gpu->glPathRendering()->genPaths(1)) {
189 187
190 InitPathObject(gpu, fPathID, fSkPath, stroke); 188 InitPathObject(gpu, fPathID, fSkPath, stroke);
191 189
192 if (stroke.needToApply()) { 190 if (stroke.needToApply()) {
193 // FIXME: try to account for stroking, without rasterizing the stroke. 191 // FIXME: try to account for stroking, without rasterizing the stroke.
194 fBounds.outset(stroke.getWidth(), stroke.getWidth()); 192 fBounds.outset(stroke.getWidth(), stroke.getWidth());
195 } 193 }
196 this->registerWithCache(); 194 this->registerWithCache();
197 } 195 }
198 196
199 void GrGLPath::onRelease() { 197 void GrGLPath::onRelease() {
200 if (0 != fPathID && !this->isWrapped()) { 198 if (0 != fPathID && !this->isWrapped()) {
201 static_cast<GrGLGpu*>(this->getGpu())->glPathRendering()->deletePaths(fP athID, 1); 199 static_cast<GrGLGpu*>(this->getGpu())->glPathRendering()->deletePaths(fP athID, 1);
202 fPathID = 0; 200 fPathID = 0;
203 } 201 }
204 202
205 INHERITED::onRelease(); 203 INHERITED::onRelease();
206 } 204 }
207 205
208 void GrGLPath::onAbandon() { 206 void GrGLPath::onAbandon() {
209 fPathID = 0; 207 fPathID = 0;
210 208
211 INHERITED::onAbandon(); 209 INHERITED::onAbandon();
212 } 210 }
OLDNEW
« no previous file with comments | « src/gpu/gl/GrGLIndexBuffer.cpp ('k') | src/gpu/gl/GrGLRenderTarget.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698