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

Unified Diff: src/gpu/gl/GrGLPathRange.cpp

Issue 563283004: Use per-typeface sets of glyphs for nvpr text (Closed) Base URL: https://skia.googlesource.com/skia.git@upload_glyphmemorypath
Patch Set: Fix builds Created 6 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/gl/GrGLPathRange.h ('k') | src/gpu/gl/GrGLPathRendering.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/gl/GrGLPathRange.cpp
diff --git a/src/gpu/gl/GrGLPathRange.cpp b/src/gpu/gl/GrGLPathRange.cpp
index 48a073c096dae2c0904d23dd30bcea9e3c443864..12c96c6a3fbbf81658e96a082316f1300a57ac04 100644
--- a/src/gpu/gl/GrGLPathRange.cpp
+++ b/src/gpu/gl/GrGLPathRange.cpp
@@ -11,17 +11,29 @@
#include "GrGLPathRendering.h"
#include "GrGpuGL.h"
-GrGLPathRange::GrGLPathRange(GrGpuGL* gpu, size_t size, const SkStrokeRec& stroke)
- : INHERITED(gpu, size, stroke),
- fBasePathID(gpu->glPathRendering()->genPaths(fSize)),
- fNumDefinedPaths(0) {
+GrGLPathRange::GrGLPathRange(GrGpuGL* gpu, PathGenerator* pathGenerator, const SkStrokeRec& stroke)
+ : INHERITED(gpu, pathGenerator, stroke),
+ fBasePathID(gpu->glPathRendering()->genPaths(this->getNumPaths())),
+ fGpuMemorySize(0) {
+ this->registerWithCache();
+}
+
+GrGLPathRange::GrGLPathRange(GrGpuGL* gpu,
+ GrGLuint basePathID,
+ int numPaths,
+ size_t gpuMemorySize,
+ const SkStrokeRec& stroke)
+ : INHERITED(gpu, numPaths, stroke),
+ fBasePathID(basePathID),
+ fGpuMemorySize(gpuMemorySize) {
+ this->registerWithCache();
}
GrGLPathRange::~GrGLPathRange() {
this->release();
}
-void GrGLPathRange::initAt(size_t index, const SkPath& skPath) {
+void GrGLPathRange::onInitPath(int index, const SkPath& skPath) const {
GrGpuGL* gpu = static_cast<GrGpuGL*>(this->getGpu());
if (NULL == gpu) {
return;
@@ -33,16 +45,18 @@ void GrGLPathRange::initAt(size_t index, const SkPath& skPath) {
GR_GL_CALL_RET(gpu->glInterface(), isPath, IsPath(fBasePathID + index)));
SkASSERT(GR_GL_FALSE == isPath);
- GrGLPath::InitPathObject(gpu, fBasePathID + index, skPath, fStroke);
- ++fNumDefinedPaths;
- this->didChangeGpuMemorySize();
+ GrGLPath::InitPathObject(gpu, fBasePathID + index, skPath, this->getStroke());
+
+ // TODO: Use a better approximation for the individual path sizes.
+ fGpuMemorySize += 100;
}
void GrGLPathRange::onRelease() {
SkASSERT(this->getGpu());
if (0 != fBasePathID && !this->isWrapped()) {
- static_cast<GrGpuGL*>(this->getGpu())->glPathRendering()->deletePaths(fBasePathID, fSize);
+ static_cast<GrGpuGL*>(this->getGpu())->glPathRendering()->deletePaths(fBasePathID,
+ this->getNumPaths());
fBasePathID = 0;
}
« no previous file with comments | « src/gpu/gl/GrGLPathRange.h ('k') | src/gpu/gl/GrGLPathRendering.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698