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

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

Issue 304403003: Generate path names on the client side (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 years, 6 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright 2011 Google Inc. 2 * Copyright 2011 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 8
9 #include "GrGpuGL.h" 9 #include "GrGpuGL.h"
10 #include "GrGLNameAllocator.h"
10 #include "GrGLStencilBuffer.h" 11 #include "GrGLStencilBuffer.h"
11 #include "GrGLPath.h" 12 #include "GrGLPath.h"
12 #include "GrGLShaderBuilder.h" 13 #include "GrGLShaderBuilder.h"
13 #include "GrTemplates.h" 14 #include "GrTemplates.h"
14 #include "GrTypes.h" 15 #include "GrTypes.h"
15 #include "SkStrokeRec.h" 16 #include "SkStrokeRec.h"
16 #include "SkTemplates.h" 17 #include "SkTemplates.h"
17 18
18 #define GL_CALL(X) GR_GL_CALL(this->glInterface(), X) 19 #define GL_CALL(X) GR_GL_CALL(this->glInterface(), X)
19 #define GL_CALL_RET(RET, X) GR_GL_CALL_RET(this->glInterface(), RET, X) 20 #define GL_CALL_RET(RET, X) GR_GL_CALL_RET(this->glInterface(), RET, X)
(...skipping 2352 matching lines...) Expand 10 before | Expand all | Expand 10 after
2372 2373
2373 void GrGpuGL::notifyTextureDelete(GrGLTexture* texture) { 2374 void GrGpuGL::notifyTextureDelete(GrGLTexture* texture) {
2374 for (int s = 0; s < fHWBoundTextures.count(); ++s) { 2375 for (int s = 0; s < fHWBoundTextures.count(); ++s) {
2375 if (fHWBoundTextures[s] == texture) { 2376 if (fHWBoundTextures[s] == texture) {
2376 // deleting bound texture does implied bind to 0 2377 // deleting bound texture does implied bind to 0
2377 fHWBoundTextures[s] = NULL; 2378 fHWBoundTextures[s] = NULL;
2378 } 2379 }
2379 } 2380 }
2380 } 2381 }
2381 2382
2383
2384 GrGLuint GrGpuGL::createGLPathObject() {
2385 if (NULL == fPathNameAllocator.get()) {
2386 static const int range = 65536;
2387 GrGLuint names;
2388 GL_CALL_RET(names, GenPaths(range));
2389 fPathNameAllocator.reset(SkNEW_ARGS(GrGLNameAllocator, (names, range)));
2390 }
2391
2392 GrGLuint name = fPathNameAllocator->allocateName();
2393 if (0 == name) {
2394 GL_CALL_RET(name, GenPaths(1));
2395 }
2396
2397 return name;
2398 }
2399
2400 void GrGpuGL::deleteGLPathObject(GrGLuint name) {
2401 SkASSERT(fPathNameAllocator.get());
2402 if (name < fPathNameAllocator->names()
2403 || name >= fPathNameAllocator->names() + fPathNameAllocator->range()) {
2404 // If we aren't inside fPathNameAllocator's range then this name was
2405 // generated by the GenPaths fallback.
2406 GL_CALL(DeletePaths(name, 1));
2407 return;
2408 }
2409
2410 // Make the path empty to save memory, but don't free the name in the driver .
2411 GL_CALL(PathCommands(name, 0, NULL, 0, GR_GL_FLOAT, NULL));
2412 fPathNameAllocator->freeName(name);
2413 }
2414
2382 bool GrGpuGL::configToGLFormats(GrPixelConfig config, 2415 bool GrGpuGL::configToGLFormats(GrPixelConfig config,
2383 bool getSizedInternalFormat, 2416 bool getSizedInternalFormat,
2384 GrGLenum* internalFormat, 2417 GrGLenum* internalFormat,
2385 GrGLenum* externalFormat, 2418 GrGLenum* externalFormat,
2386 GrGLenum* externalType) { 2419 GrGLenum* externalType) {
2387 GrGLenum dontCare; 2420 GrGLenum dontCare;
2388 if (NULL == internalFormat) { 2421 if (NULL == internalFormat) {
2389 internalFormat = &dontCare; 2422 internalFormat = &dontCare;
2390 } 2423 }
2391 if (NULL == externalFormat) { 2424 if (NULL == externalFormat) {
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after
2803 this->setVertexArrayID(gpu, 0); 2836 this->setVertexArrayID(gpu, 0);
2804 } 2837 }
2805 int attrCount = gpu->glCaps().maxVertexAttributes(); 2838 int attrCount = gpu->glCaps().maxVertexAttributes();
2806 if (fDefaultVertexArrayAttribState.count() != attrCount) { 2839 if (fDefaultVertexArrayAttribState.count() != attrCount) {
2807 fDefaultVertexArrayAttribState.resize(attrCount); 2840 fDefaultVertexArrayAttribState.resize(attrCount);
2808 } 2841 }
2809 attribState = &fDefaultVertexArrayAttribState; 2842 attribState = &fDefaultVertexArrayAttribState;
2810 } 2843 }
2811 return attribState; 2844 return attribState;
2812 } 2845 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698