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

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

Issue 442603002: Calculate rough approximations for nvpr path sizes (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 4 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/GrGLPath.h ('k') | src/gpu/gl/GrGLPathRange.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/gl/GrGLPath.cpp
diff --git a/src/gpu/gl/GrGLPath.cpp b/src/gpu/gl/GrGLPath.cpp
index 6f158cdea9bc9ee4470c89d2fe10ba89e52b2a22..e80259ebc8fb807fb93db0801c6d840ca4687f9c 100644
--- a/src/gpu/gl/GrGLPath.cpp
+++ b/src/gpu/gl/GrGLPath.cpp
@@ -81,10 +81,10 @@ inline GrGLenum cap_to_gl_cap(SkPaint::Cap cap) {
static const bool kIsWrapped = false; // The constructor creates the GL path object.
-void GrGLPath::InitPathObject(GrGpuGL* gpu,
- GrGLuint pathID,
- const SkPath& skPath,
- const SkStrokeRec& stroke) {
+size_t GrGLPath::InitPathObject(GrGpuGL* gpu,
+ GrGLuint pathID,
+ const SkPath& skPath,
+ const SkStrokeRec& stroke) {
GrGLPathRendering* pr = gpu->pathRendering();
SkSTArray<16, GrGLubyte, true> pathCommands;
SkSTArray<16, SkPoint, true> pathPoints;
@@ -117,6 +117,13 @@ void GrGLPath::InitPathObject(GrGpuGL* gpu,
pr->pathParameteri(pathID, GR_GL_PATH_INITIAL_END_CAP, cap);
pr->pathParameteri(pathID, GR_GL_PATH_TERMINAL_END_CAP, cap);
}
+
+ size_t approximateSize = 5 * (verbCnt + pointCnt);
+ if (SkStrokeRec::kStrokeAndFill_Style == stroke.getStyle()) {
+ // It will take approxoimately twice the memory if it has both fill *and* stroke.
+ approximateSize *= 2;
+ }
+ return approximateSize;
}
GrGLPath::GrGLPath(GrGpuGL* gpu, const SkPath& path, const SkStrokeRec& stroke)
@@ -124,7 +131,7 @@ GrGLPath::GrGLPath(GrGpuGL* gpu, const SkPath& path, const SkStrokeRec& stroke)
fPathID(gpu->pathRendering()->genPaths(1)) {
SkASSERT(!path.isEmpty());
- InitPathObject(gpu, fPathID, fSkPath, stroke);
+ fGpuMemorySize = InitPathObject(gpu, fPathID, fSkPath, stroke);
if (stroke.needToApply()) {
// FIXME: try to account for stroking, without rasterizing the stroke.
« no previous file with comments | « src/gpu/gl/GrGLPath.h ('k') | src/gpu/gl/GrGLPathRange.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698