aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrTexture.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gpu/GrTexture.cpp')
-rw-r--r--src/gpu/GrTexture.cpp41
1 files changed, 41 insertions, 0 deletions
diff --git a/src/gpu/GrTexture.cpp b/src/gpu/GrTexture.cpp
new file mode 100644
index 0000000000..77868dfc9f
--- /dev/null
+++ b/src/gpu/GrTexture.cpp
@@ -0,0 +1,41 @@
+
+/*
+ * Copyright 2011 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+
+#include "GrTexture.h"
+
+#include "GrContext.h"
+#include "GrGpu.h"
+#include "GrRenderTarget.h"
+
+bool GrTexture::readPixels(int left, int top, int width, int height,
+ GrPixelConfig config, void* buffer) {
+ // go through context so that all necessary flushing occurs
+ GrContext* context = this->getGpu()->getContext();
+ GrAssert(NULL != context);
+ return context->readTexturePixels(this,
+ left, top,
+ width, height,
+ config, buffer);
+}
+
+void GrTexture::releaseRenderTarget() {
+ if (NULL != fRenderTarget) {
+ GrAssert(fRenderTarget->asTexture() == this);
+ fRenderTarget->onTextureReleaseRenderTarget();
+ fRenderTarget->unref();
+ fRenderTarget = NULL;
+ }
+}
+
+void GrTexture::onAbandon() {
+ if (NULL != fRenderTarget) {
+ fRenderTarget->abandon();
+ }
+}
+