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

Unified Diff: gpu/command_buffer/service/path_manager.cc

Issue 169403005: command_buffer: Implement path rendering functions for CHROMIUM_path_rendering (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@nv-pr-02-texgen
Patch Set: improve parameter validation and write up the extension .txt file Created 6 years, 8 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
Index: gpu/command_buffer/service/path_manager.cc
diff --git a/gpu/command_buffer/service/path_manager.cc b/gpu/command_buffer/service/path_manager.cc
new file mode 100644
index 0000000000000000000000000000000000000000..d67de116676596c13740a1b29ac993f75d0ceaef
--- /dev/null
+++ b/gpu/command_buffer/service/path_manager.cc
@@ -0,0 +1,57 @@
+// Copyright (c) 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "gpu/command_buffer/service/path_manager.h"
+#include "base/logging.h"
+#include "base/strings/stringprintf.h"
+#include "gpu/command_buffer/common/gles2_cmd_utils.h"
+#include "ui/gl/gl_bindings.h"
+
+namespace gpu {
+namespace gles2 {
+
+PathManager::PathManager() : have_context_(true) {
+}
+
+PathManager::~PathManager() {
+ DCHECK(path_map_.empty());
+}
+
+void PathManager::Destroy(bool have_context) {
+ have_context_ = have_context;
+ if (have_context_) {
+ for (PathMap::iterator it = path_map_.begin(); it != path_map_.end();
+ ++it) {
+ glDeletePathsNV(it->second, 1);
+ }
+ }
+ path_map_.clear();
+}
+
+void PathManager::CreatePath(GLuint client_id, GLuint service_id) {
+ path_map_.insert(std::make_pair(client_id, service_id));
+}
+
+bool PathManager::GetPath(GLuint client_id, GLuint* service_id) {
+ PathMap::iterator it = path_map_.find(client_id);
+ if (it == path_map_.end())
+ return false;
+
+ if (service_id)
+ *service_id = it->second;
+ return true;
+}
+
+void PathManager::RemovePaths(GLuint path, GLuint range) {
+ for (GLuint ii = path; ii < path + range; ++ii) {
+ PathMap::iterator it = path_map_.find(ii);
+ if (it == path_map_.end())
+ continue;
+ glDeletePathsNV(it->second, 1);
+ path_map_.erase(it);
+ }
+}
+
+} // namespace gles2
+} // namespace gpu

Powered by Google App Engine
This is Rietveld 408576698